M3PrettyDoc.tioga
Mike Spreitzer:PARC:Xerox, February 1, 1993 1:33 pm PST
M3Pretty
PCEDAR 2.0 %
M3Pretty
Mike Spreitzer
Ó Copyright 1991 Xerox Corporation. All rights reserved.
Abstract: M3Pretty provides some basic friendliness towards Modula 3. The package includes a lexer (M3Scan), a Tioga operation to set looks in a Mesa-like fashion, and a Tioga operation to extend the Tioga primary selection to the next larger enclosing compound statement.
Created by: Mike Spreitzer
Maintained by: Mike Spreitzer <Mike Spreitzer:PARC:Xerox>
Keywords: Modula 3, Lexical Analysis, Scanner, Looks
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

1. Commander Commands
name M3WC
syntax
M3WC filename ...
description
Just like UNIX's ``wc'', except that the count of ``words'' is actually a count of Modula 3 tokens. A comment counts as one token (and nested comments don't count at all); pragmas are treated the same way.
examples
% M3WC /import/m3/interfaces/Wr.i3 /import/m3/interfaces/Rd.i3
185  234  6386 /import/m3/interfaces/Wr.i3
292  326  9716 /import/m3/interfaces/Rd.i3
477  560  16102 Total
%
stop/undo
As usual for a commander command.
2. Tioga Commands
SetM3Looks
Analogous to SetMesaLooks. The ``Tioga Atom'' is $SetM3Looks. If you add M3Pretty.tip to your Cedar user profile's Tioga.TiogaTIP, Tioga.TypescriptTIP, and Tioga.ReadonlyTiogaTIP entries, "Alt-M" invokes this operation (on a Type 4 keyboard, anyway); this TIP table also maps "Alt-Shift-M" to the operation { PARAM "m3pp" UnixFilter } --- which does a plain-text pretty-print using the UNIX facilities.
SetM3Looks marks:
(1) keywords with "k" looks;
(2) comments with "c" looks;
(3) procedure (but not method) and exception names in declarations with "n" looks;
(4) interface and module names in declarations with "n" and "l" looks;
(5) and lexing errors with "w" looks.
SetM3Looks resets the lexer state at each node boundary (as SetM3Looks does). This means that comments that span nodes will be marked differently than comments that stay entirely within nodes.
ExpandM3Sel
Sets the primary selection to be the smallest compound statement that begins before the caret and ends after it. The ``Tioga Atom'' is $ExpandM3Sel. If you add M3Pretty.tip to your Cedar user profile's Tioga.TiogaTIP, Tioga.TypescriptTIP, and Tioga.ReadonlyTiogaTIP entries, "Alt-E" invokes this operation (on a Type 4 keyboard, anyway).
3. Mesa Interfaces
The Mesa interface M3Scan describes the lexer.