1 : |
jhr |
97 |
% grammar.hva
|
2 : |
|
|
%
|
3 : |
|
|
% COPYRIGHT (c) 1999 Bell Labs, Lucent Technologies.
|
4 : |
|
|
%
|
5 : |
|
|
% HeVeA macro definitions to simulate the grammar.sty commands.
|
6 : |
|
|
%
|
7 : |
|
|
|
8 : |
|
|
\newboolean{GGanchors} % true means lhs nonterm is anchor
|
9 : |
|
|
\newboolean{GGfirstrule}
|
10 : |
|
|
\newboolean{GGfirstrhs}
|
11 : |
|
|
\newcommand{\GGfirstcell}{
|
12 : |
|
|
\@open{TD}{WIDTH="20"}
|
13 : |
|
|
\@close{TD}
|
14 : |
|
|
}
|
15 : |
|
|
\newcommand{\GGsepsymb}{
|
16 : |
|
|
\GGfirstcell{}
|
17 : |
|
|
\ifthenelse{\boolean{GGfirstrhs}}{
|
18 : |
|
|
\@open{TD}{ALIGN=CENTER VALIGN=BOTTOM}
|
19 : |
|
|
::=
|
20 : |
|
|
\@close{TD}
|
21 : |
|
|
\setboolean{GGfirstrhs}{false}
|
22 : |
|
|
}{
|
23 : |
|
|
\@open{TD}{ALIGN=CENTER VALIGN=BOTTOM}
|
24 : |
|
|
|
|
25 : |
|
|
\@close{TD}
|
26 : |
|
|
}
|
27 : |
|
|
}
|
28 : |
|
|
|
29 : |
|
|
\newcommand{\GGRHS}[2][]{
|
30 : |
|
|
\@open{TR}{}
|
31 : |
|
|
\GGsepsymb{}
|
32 : |
|
|
\@open{TD}{NOWRAP VALIGN=BOTTOM}
|
33 : |
|
|
#2
|
34 : |
|
|
\@close{TD}
|
35 : |
|
|
\@open{TD}{ALIGN=RIGHT VALIGN=TOP}
|
36 : |
|
|
#1
|
37 : |
|
|
\@close{TD}
|
38 : |
|
|
\@close{TR}
|
39 : |
|
|
}
|
40 : |
|
|
\newcommand{\GGCONT}[1]{
|
41 : |
|
|
\@open{TR}{}
|
42 : |
|
|
\@open{TD}{COLSPAN="2"}
|
43 : |
|
|
\@close{TD}
|
44 : |
|
|
\@open{TD}{NOWRAP VALIGN=BOTTOM}
|
45 : |
|
|
\@print{ }
|
46 : |
|
|
#1
|
47 : |
|
|
\@close{TD}
|
48 : |
|
|
\@close{TR}
|
49 : |
|
|
}
|
50 : |
|
|
\newcommand{\GGITEM}[1]{%
|
51 : |
|
|
\ifthenelse{\boolean{GGfirstrhs}}{\setboolean{GGfirstrhs}{false}}{
|
52 : |
|
|
\@print{ | }
|
53 : |
|
|
}%
|
54 : |
|
|
#1
|
55 : |
|
|
}
|
56 : |
|
|
|
57 : |
|
|
%
|
58 : |
|
|
% font commands
|
59 : |
|
|
\newcommand{\kw}[1]{{\@style{B}{\@style{TT}#1}}}
|
60 : |
|
|
\newcommand{\GGnt}[1]{{\@style{I}#1}}
|
61 : |
|
|
\newcommand{\nt}[1]{\GGnt{\url{\#nt:#1}{#1}}}
|
62 : |
|
|
\newcommand{\term}[1]{{\@style{I}#1}}
|
63 : |
|
|
\newcommand{\sym}[1]{\kw{#1}}
|
64 : |
|
|
|
65 : |
|
|
\newenvironment{Grammar}[1][]{%
|
66 : |
|
|
\setboolean{GGanchors}{\equal{#1}{anchors}}%
|
67 : |
|
|
\setboolean{GGfirstrule}{true}%
|
68 : |
|
|
\newcommand{\GRP}[1]{$(\text{##1})$}%
|
69 : |
|
|
\newcommand{\OPT}[1]{$\text{\protect{##1}}^{\textit{opt}}$}%
|
70 : |
|
|
\newcommand{\OPTGRP}[1]{$(\text{##1})^{\textit{opt}}$}%
|
71 : |
|
|
\newcommand{\LIST}[1]{$\text{\protect{##1}}^{*}$}%
|
72 : |
|
|
\newcommand{\LISTGRP}[1]{$(\text{##1})^{*}$}%
|
73 : |
|
|
\newcommand{\LISTONE}[1]{$\text{\protect{##1}}^{+}$}%
|
74 : |
|
|
\newcommand{\LISTONEGRP}[1]{$(\text{##1})^{+}$}%
|
75 : |
|
|
\newenvironment{Rules}[1]{%
|
76 : |
|
|
\setboolean{GGfirstrhs}{true}%
|
77 : |
|
|
\newcommand{\RHS}{\GGRHS}%
|
78 : |
|
|
\newcommand{\CONT}{\GGCONT}%
|
79 : |
|
|
\ifthenelse{\boolean{GGfirstrule}}{
|
80 : |
|
|
\setboolean{GGfirstrule}{false}%
|
81 : |
|
|
}{
|
82 : |
|
|
\@open{TR}{}
|
83 : |
|
|
\@open{TD}{}\@print{ }\@close{TD}
|
84 : |
|
|
\@close{TR}
|
85 : |
|
|
}
|
86 : |
|
|
\@open{TR}{}
|
87 : |
|
|
\@open{TD}{ALIGN=LEFT COLSPAN="3"}
|
88 : |
|
|
\ifthenelse{\boolean{GGanchors}}{\anchor{nt:##1}}{}
|
89 : |
|
|
\GGnt{##1}
|
90 : |
|
|
\@close{TD}
|
91 : |
|
|
\@close{TR}
|
92 : |
|
|
}{%
|
93 : |
|
|
}
|
94 : |
|
|
\newenvironment{OneOfRule}[1]{%
|
95 : |
|
|
\setboolean{GGfirstrhs}{true}%
|
96 : |
|
|
\newcommand{\ITEM}{\GGITEM}%
|
97 : |
|
|
\ifthenelse{\boolean{GGfirstrule}}{}{
|
98 : |
|
|
\@open{TR}{}
|
99 : |
|
|
\@open{TD}{}\@print{ }\@close{TD}
|
100 : |
|
|
\@close{TR}
|
101 : |
|
|
}
|
102 : |
|
|
\@open{TR}{}
|
103 : |
|
|
\@open{TD}{ALIGN=LEFT COLSPAN="3"}
|
104 : |
|
|
\ifthenelse{\boolean{GGanchors}}{\anchor{nt:##1}}{}
|
105 : |
|
|
\GGnt{##1}
|
106 : |
|
|
\@close{TD}
|
107 : |
|
|
\@close{TR}
|
108 : |
|
|
\@open{TR}{}
|
109 : |
|
|
\GGfirstcell{}
|
110 : |
|
|
\@open{TD}{ALIGN=CENTER VALIGN=BOTTOM}
|
111 : |
|
|
::=
|
112 : |
|
|
\@close{TD}
|
113 : |
|
|
\@open{TD}{}
|
114 : |
|
|
}{%
|
115 : |
|
|
\@close{TD}
|
116 : |
|
|
\@close{TR}
|
117 : |
|
|
}
|
118 : |
|
|
\@open{TABLE}{}
|
119 : |
|
|
}{%
|
120 : |
|
|
\@close{TABLE}
|
121 : |
|
|
}
|
122 : |
|
|
|