2 /* This Lex script acts as a filter to pre-process Latex files.
4 It surrounds groups of lines beginning with a ">" sign, and
5 preceded and followed by a blank line, with \begin{verbatim}
6 and \end{verbatim}. The ">" may be preceded by a digit or digit
7 range (eg 4>, 2-5>, 3->); in this case the digits are removed.
8 They are meant to be used for filtering out versions.
10 It takes words surrounded with @ signs (thus @letrec@) and makes them
11 come out in typewriter font, regardless of the current mode.
14 %START NORM VERB VERBENV
18 miranda ([0-9]+(\-([0-9]+)?)?)?>
20 #define PUSH states[top++] =
21 #define POP BEGIN states[--top]
29 <NORM>@@ { printf ("@"); }
30 <NORM>@ { printf ("<tt>"); PUSH NORM; BEGIN VERB; }
31 <NORM>\\% { printf ("%"); }
33 <VERB>@ { printf ("</tt>"); POP; }
34 <VERB>@@ { printf ("@"); }
35 <VERB>\> { printf (">"); }
36 <VERB>\< { printf ("<"); }
37 <VERB>\# { printf ("#"); }
38 <VERB>\$ { printf ("$"); }
39 <VERB>\% { printf ("%"); }
40 <VERB>\& { printf ("&"); }
41 <VERB>\~ { printf ("˜"); }
42 <VERB>\^ { printf ("ˆ"); }
44 <NORM>\<verb\> { printf ("<verb>"); PUSH NORM; BEGIN VERBENV; }
45 <NORM>\<code\> { printf ("<code>"); PUSH NORM; BEGIN VERBENV; }
46 <NORM>\\begin\{code\} { printf ("<code>"); PUSH NORM; BEGIN VERBENV; }
47 <VERBENV>\<\/verb\> { printf ("</verb>"); POP; }
48 <VERBENV>\<\/code\> { printf ("</code>"); POP; }
49 <VERBENV>\<\\end\{code\} { printf ("</code>"); POP; }
50 <VERBENV>\&\& { printf ("&"); }
51 <VERBENV>\& { printf ("&ero;"); }
52 <VERBENV>\<\/ { printf ("&etago;"); }
63 <VERB>\_ { printf ("{\\char'137}"); }
64 <VERB>\\ { printf ("{\\char'134}"); }
65 <VERB>\{ { printf ("{\\char'173}"); }
66 <VERB>\} { printf ("{\\char'175}"); }