Generated: September 15, 2004, 10:52:27 | Copyright © 2004 , Kurt Nørmark | ![]() |
The pretty printer handles all aspects of Scheme which has special lexical syntax: lists, pairs (dot notation), booleans, chars, vectors, and quasi quotation (backquoting). In addition, the pretty printing function handles Scheme special forms such as cond, let, define, if, etc.
A few parameters (global variables) control the pretty printer.
Convential comments read by the this pretty printer are lost. This library assumes that comments are represented as syntactical forms like (comment!!! n "A comment"). The LAML schemedoc tool contains a procedure lexical-to-syntactical-comments! which converts conventional, semicolon Lisp comments to the syntactical comments expected by the pretty printing library. The variable syntactical-comment-symbol (and the variable COMMENT-FORM-START in SchemeDoc) allows you to control the prefix symbol of syntactical comments.
The important top level functions of this library are pretty-print-lisp-file and pretty-print-lisp-form.
Internally, the pretty printer adds pretty-print tokens (strings or chars) to a list, which finally is reversed and linearized into a string.
This library relies on the general and file-read libraries (not loaded by this library).
In the laml.scm file there are LAML procedures scheme-pp and scheme-pp-simple which pretty print Scheme and Lisp files. pp-scheme handles comments properly. These are the most top-level Scheme pretty printing procedures in the LAML system.
indentation-delta | indentation-delta | An integer which gives the level of indentation |
prefered-maximum-width | prefered-maximum-width | An integer that expresses the preferred maximum column width |
pretty-print-lisp-file | (pretty-print-lisp-file in-file-path [out-file-path]) | Assume that in-file-path contains a lisp file with one or lisp forms. |
pretty-print-lisp-form | (pretty-print-lisp-form form) | Pretty print form and return the pretty printed string |
syntactical-comment-symbol | syntactical-comment-symbol | The symbol which is used for syntactical comments, such as (comment 2 "This is a comment"). |
use-single-lining | use-single-lining | A boolean which controls the application of single line pretty printing. |