Whitespace cleanup.
[mdwtools] / syntax.dtx
index 627f8c8..c6f04db 100644 (file)
@@ -4,14 +4,14 @@
 %
 % Syntax typesetting package for LaTeX 2e
 %
-% (c) 1996 Mark Wooding
+% (c) 2003 Mark Wooding
 %
 % \end{meta-comment}
 %
 % \begin{meta-comment} <general public licence>
 %%
 %% syntax package -- typesetting syntax descriptions
-%% Copyright (c) 1996 Mark Wooding
+%% Copyright (c) 2003 Mark Wooding
 %%
 %% This program is free software; you can redistribute it and/or modify
 %% it under the terms of the GNU General Public License as published by
 % \begin{meta-comment} <Package preamble>
 %<+package>\NeedsTeXFormat{LaTeX2e}
 %<+package>\ProvidesPackage{syntax}
-%<+package>                [1996/05/17 1.07 Syntax typesetting (MDW)]
+%<+package>                [2003/08/25 1.08 Syntax typesetting (MDW)]
 % \end{meta-comment}
 %
-% ^^A \CheckSum{1504}
+% \CheckSum{1616}
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
 % \begin{listing}
 %\def\<#1>{\synt{#1}}
 % \end{listing}
-% to allow you to type "\\<"<text>">" as an alternative to 
+% to allow you to type "\\<"<text>">" as an alternative to
 % "\\synt{"<text>"}".
 %
 % \DescribeMacro\lit
 % \DescribeMacro{\[[}
 % \DescribeMacro{\]]}
 % You can use syntax diagrams (see below) instead of a straight piece of BNF
-% by enclosing it in a |\[[| \dots |\]]| pair.  Note that you can't mix 
+% by enclosing it in a |\[[| \dots |\]]| pair.  Note that you can't mix
 % syntax diagrams and BNF in a production rule, and you will get something
 % which looks very strange if you try.
 %
 %
 % \DescribeMacro\tok
 % You can also include text using the |\tok| command.  The argument of this
-% command is typeset in \LaTeX's LR~mode and inserted into the diagram. 
+% command is typeset in \LaTeX's LR~mode and inserted into the diagram.
 % Syntax abbreviations are allowed within the argument, so you can, for
 % example, include textual descriptions like
 % \begin{listing}
 %
 % Note that items on the backwards arrow of a \env{rep} construction should
 % be displayed \emph{backwards}.  You must put the individual items in
-% reverse order when building this part of your diagrams.  \syn\ will 
+% reverse order when building this part of your diagrams.  \syn\ will
 % correctly reverse the arrows on \env{rep} structures, but apart from
 % this, you must cope on your own.  You are recommended to keep these parts
 % of your diagrams as simple as possible to avoid confusing readers.
 %
 % You can also alter the appearance of \env{stack}s and \env{rep}s by using
 % their optional positioning arguments.  By default, \env{stack}s descend
-% below the main line of the diagram, and \env{rep}s extend above it.  
+% below the main line of the diagram, and \env{rep}s extend above it.
 % Specifying an optional argument of |[b]| for either environment reverses
 % this, putting \env{stack}s above and \env{rep}s below the line.
 %
 % commands, in \env{grammar} environments, and in syntax diagrams.
 %
 %
-% \section{Change history}
-%
-% \subsection*{Version 1.07}
-%
-% \begin{itemize}
-% \item Fixed problem with underscore hacking in a \env{tabbing} environment.
-% \end{itemize}
-%
-% \subsection*{Version 1.06}
-%
-% \begin{itemize}
-% \item Added style hooks for syntax items.
-% \item Improved colour handling in syntax diagrams, thanks to the |\doafter|
-%       package.
-% \item Fixed some nasty bugs in the \env{grammar} environment which confused
-%       other lists and ruined the spacing.  The \env{grammar} handling is
-%       now much tidier in general.
-% \end{itemize}
-%
-% \subsection*{Version 1.05}
-%
-% \begin{itemize}
-% \item Fixed `the bug' in the syntax diagram typesetting.  It now breaks
-%       lines almost psychically, and doesn't break in the wrong places.
-% \item Almost rewrote the \env{grammar} environment.  It now does lots of
-%       the list handling itself, to allow more versatile typesetting of the
-%       left hand sides.  There's lots of evil in there now.
-% \item Added some more configurability.  In particular, two new settings
-%       have been added to control \env{grammar} environments, and a neat
-%       way of adding new syntax diagram structures has been introduced.
-% \end{itemize}
-%
-% \subsection*{Version 1.04}
-%
-% \begin{itemize}
-% \item Changed the vertical positioning of the rules, to make all the text
-%       line up properly.  While the old version was elegant and simple, it
-%       had the drawback of looking nasty.
-% \item Allow line breaks at underscores, but don't if there's another one
-%       afterwards.  Also, prevent losing following space if underscore is
-%       written to a file.
-% \end{itemize}
-%
-% \subsection*{Version 1.02}
-%
-% \begin{itemize}
-% \item Added support for rounded corners in syntax diagrams.
-% \item Changed lots of |\hskip| commands to |\kern|s, to prevent possible
-%       line breaks.
-% \end{itemize}
-%
-% \subsection*{Version 1.01}
-%
-% \begin{itemize}
-% \item Allowed disabling of underscore active character, to avoid messing
-%       up filenames.
-% \item Added |\grammarparsep| and |\grammarindent| length parameters to
-%       control the appearance of grammars.
-% \end{itemize}
-%
 % \implementation
 %
 % \section{Implementation of \syn}
 % characters through.  By default, we re-enable |\|, and make `\verb*" "'
 % typeset some space glue, rather than a space character.  A macro
 % `\verb*"\ "' is defined to actually print a space character, which yield
-% `\verb*" "' in the `|\tt|' font. 
+% `\verb*" "' in the `|\tt|' font.
 %
 % Finally, it defines a |\ch| command, which, given a single-character
 % control sequence as its argument, typesets the character.  This is useful,
   \addspecial\|%
   \addspecial\"%
   \catcode`\|\active%
-  \catcode`\<\active% 
+  \catcode`\<\active%
   \catcode`\"\active%
   \catcode`\`\active%
 }
 }
 \def\sd@leftarr{%
   \bgroup%
-  \raise\sd@mid\hbox{\@linefnt\char'33\kern-6\p@}%
+  \setbox\tw@\hbox{\@linefnt\char'33\kern-6\p@}%
   \sd@arrow%
 }
 %    \end{macrocode}