3 /* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc.
4 Written by James Clark (jjc@jclark.com)
6 This file is part of groff.
8 groff is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with groff; see the file COPYING. If not, write to the Free Software
20 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
28 extern
int non_empty_flag
;
30 void yyerror(const char *);
66 %token
<str
> QUOTED_TEXT
86 /* these are handled in the lexer */
103 /* The original eqn manual says that `left' is right associative. It's lying.
104 Consider `left ( ~ left ( ~ right ) right )'. */
108 %right LPILE RPILE CPILE PILE TEXT QUOTED_TEXT MATRIX MARK LINEUP
'^' '~' '\t' '{' SPLIT NOSPLIT
110 %left SQRT OVER SMALLOVER
112 %right ROMAN BOLD ITALIC FAT FONT SIZE FWD BACK DOWN UP TYPE VCENTER SPECIAL
113 %right BAR UNDER PRIME
116 %type
<b
> mark from_to sqrt_over script simple equation nonsup
118 %type
<str
> text delim
119 %type
<pb
> pile_element_list pile_arg
120 %type
<mb
> column_list
121 %type
<col
> column column_arg column_element_list
127 { $1->top_level
(); non_empty_flag
= 1; }
135 list_box
*lb
= $1->to_list_box
();
137 lb
= new list_box
($1);
147 { $$
= make_mark_box
($2); }
149 { $$
= make_lineup_box
($2); }
155 | sqrt_over TO from_to
156 { $$
= make_limit_box
($1, 0, $3); }
157 | sqrt_over FROM sqrt_over
158 { $$
= make_limit_box
($1, $3, 0); }
159 | sqrt_over FROM sqrt_over TO from_to
160 { $$
= make_limit_box
($1, $3, $5); }
161 | sqrt_over FROM sqrt_over FROM from_to
162 { $$
= make_limit_box
($1, make_limit_box
($3, $5, 0), 0); }
169 { $$
= make_sqrt_box
($2); }
170 | sqrt_over OVER sqrt_over
171 { $$
= make_over_box
($1, $3); }
172 | sqrt_over SMALLOVER sqrt_over
173 { $$
= make_small_over_box
($1, $3); }
180 { $$
= make_script_box
($1, 0, $3); }
187 { $$
= make_script_box
($1, $3, 0); }
188 | simple SUB simple SUP script
189 { $$
= make_script_box
($1, $3, $5); }
194 { $$
= split_text
($1); }
196 { $$
= new quoted_text_box
($1); }
198 { $$
= split_text
($2); }
200 { $$
= new quoted_text_box
($2); }
202 { $$
= new half_space_box
; }
204 { $$
= new space_box
; }
206 { $$
= new tab_box
; }
210 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
212 { $2->set_alignment
(LEFT_ALIGN
); $$
= $2; }
214 { $2->set_alignment
(RIGHT_ALIGN
); $$
= $2; }
216 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
217 | MATRIX
'{' column_list
'}'
219 | LEFT delim equation RIGHT delim
220 { $$
= make_delim_box
($2, $3, $5); }
221 | LEFT delim equation
222 { $$
= make_delim_box
($2, $3, 0); }
224 { $$
= make_overline_box
($1); }
226 { $$
= make_underline_box
($1); }
228 { $$
= make_prime_box
($1); }
229 | simple ACCENT simple
230 { $$
= make_accent_box
($1, $3); }
231 | simple UACCENT simple
232 { $$
= make_uaccent_box
($1, $3); }
234 { $$
= new font_box
(strsave
(get_grfont
()), $2); }
236 { $$
= new font_box
(strsave
(get_gbfont
()), $2); }
238 { $$
= new font_box
(strsave
(get_gfont
()), $2); }
240 { $$
= new fat_box
($2); }
242 { $$
= new font_box
($2, $3); }
244 { $$
= new size_box
($2, $3); }
246 { $$
= new hmotion_box
($2, $3); }
248 { $$
= new hmotion_box
(-$2, $3); }
250 { $$
= new vmotion_box
($2, $3); }
252 { $$
= new vmotion_box
(-$2, $3); }
254 { $3->set_spacing_type
($2); $$
= $3; }
256 { $$
= new vcenter_box
($2); }
257 | SPECIAL text simple
258 { $$
= make_special_box
($2, $3); }
265 if
(sscanf
($1, "%d", &n
) == 1)
273 { $$
= new pile_box
($1); }
274 | pile_element_list ABOVE equation
275 { $1->append
($3); $$
= $1; }
279 '{' pile_element_list
'}'
281 | number
'{' pile_element_list
'}'
282 { $3->set_space
($1); $$
= $3; }
287 { $$
= new matrix_box
($1); }
289 { $1->append
($2); $$
= $1; }
294 { $$
= new column
($1); }
295 | column_element_list ABOVE equation
296 { $1->append
($3); $$
= $1; }
300 '{' column_element_list
'}'
302 | number
'{' column_element_list
'}'
303 { $3->set_space
($1); $$
= $3; }
308 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
310 { $2->set_alignment
(LEFT_ALIGN
); $$
= $2; }
312 { $2->set_alignment
(RIGHT_ALIGN
); $$
= $2; }
314 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
327 { $$
= strsave
("{"); }
329 { $$
= strsave
("}"); }