OLD | NEW |
| (Empty) |
1 %This _sty_ file was developed by Hugh Osborne at the University of | |
2 %Nijmegen, The Netherlands. It may be freely distributed under | |
3 %condition that this notice is always included in any copy distributed. | |
4 %No charge may be made for (copies of) this file, nor may any other | |
5 %remuneration be requested. | |
6 | |
7 \typeout{Style-Option: `bnf' v1.1a <92/01/30> (Hugh Osborne/br)} | |
8 | |
9 \def\@actifygrammarchars{% | |
10 \catcode`\"\active% | |
11 \catcode`\:\active% | |
12 \catcode`\,\active% | |
13 \catcode`\;\active% | |
14 \catcode`\.\active% | |
15 \catcode`\<\active% | |
16 \catcode`\>\active} | |
17 | |
18 \def\@deactifygrammarchars{% | |
19 \@makeother\"% | |
20 \@makeother\:% | |
21 \@makeother\,% | |
22 \@makeother\;% | |
23 \@makeother\.% | |
24 \@makeother\<% | |
25 \@makeother\>} | |
26 | |
27 \let\escapegrammar=\@deactifygrammarchars | |
28 | |
29 \begingroup | |
30 \@deactifygrammarchars | |
31 \global\let\quotesymbol=" | |
32 \global\let\lessthan=< | |
33 \global\let\greaterthan=> | |
34 \endgroup | |
35 | |
36 \newif\if@outsidestring \@outsidestringtrue | |
37 | |
38 \def\@first#1#2{#1} | |
39 \def\@second#1#2{#2} | |
40 | |
41 \begingroup | |
42 | |
43 \@actifygrammarchars | |
44 | |
45 \gdef\@defcolon#1{ | |
46 \catcode`\:\active | |
47 \def:{\def\newline{\hfill\break\hspace*{2em}}{\@deactifygrammarchars #1}} | |
48 \@makeother\:} | |
49 | |
50 \gdef\@defcomma#1{ | |
51 \catcode`\,\active | |
52 \def,{\def\newline{\hfill\break\hspace*{4em}}{\@deactifygrammarchars #1}} | |
53 \@makeother\,} | |
54 | |
55 \gdef\@defsemicolon#1{ | |
56 \catcode`\;\active | |
57 \def;{\def\newline{\hfill\break\hspace*{2em}}{\@deactifygrammarchars #1}} | |
58 \@makeother\;} | |
59 | |
60 \gdef\@defperiod#1{ | |
61 \catcode`\.\active | |
62 \def.{\def\newline{\vskip10pt plus10pt minus5pt}{\@deactifygrammarchars #1}} | |
63 \@makeother\.} | |
64 | |
65 \gdef\@defnonterminal#1{ | |
66 \catcode`\<\active | |
67 \catcode`\>\active | |
68 \def<{% | |
69 \begingroup% | |
70 \@first#1% | |
71 \@deactifygrammarchars% | |
72 \catcode`\>\active} | |
73 \def>{% | |
74 \@second#1% | |
75 \endgroup} | |
76 \@makeother\< | |
77 \@makeother\>} | |
78 | |
79 \gdef\@defquote#1{ | |
80 \catcode`\"\active | |
81 \def"{% | |
82 \if@outsidestring% | |
83 \@outsidestringfalse% | |
84 \begingroup% | |
85 \@deactifygrammarchars% | |
86 \catcode`\"\active% | |
87 \@first#1% | |
88 \else% | |
89 \@second#1% | |
90 \endgroup% | |
91 \@outsidestringtrue% | |
92 \fi} | |
93 \@makeother\"} | |
94 | |
95 \endgroup | |
96 | |
97 \let\@defterminal=\@defquote | |
98 | |
99 \newenvironment{grammar}% | |
100 { | |
101 \begin{quote}% | |
102 \@defaultchardefs% | |
103 \@dogrammarchars}% | |
104 {\@deactifygrammarchars% | |
105 \end{quote} | |
106 } | |
107 | |
108 \def\@dogrammarchars{ | |
109 \@actifygrammarchars | |
110 \@ifnextchar [{\@deactifygrammarchars\@getchardef}{}} | |
111 | |
112 \def\@getchardef[(#1)#2]{ | |
113 \@dogrammarchar{#1}[#2] | |
114 \@dogrammarchars} | |
115 | |
116 \def\@dogrammarchar#1[#2]{ | |
117 \csname @def#1\endcsname{#2}} | |
118 | |
119 \def\@defaultchardefs{ | |
120 \@defquote{{``}{''}}% | |
121 \@defnonterminal{{$<$}{$>$}}% | |
122 \@defcolon{:\\ {\hbox{ }} }% | |
123 \@defsemicolon{ $|$\\{\hbox{ }}}% | |
124 \@defperiod{\\{\hbox{ }};\\ }% | |
125 \@defcomma{, }}% | |
OLD | NEW |