1 /* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc.
2 Written by James Clark (jjc@jclark.com)
4 This file is part of groff.
6 groff is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License along
17 with groff; see the file COPYING. If not, write to the Free Software
18 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
26 extern
int non_empty_flag
;
28 void yyerror(const char *);
64 %token
<str
> QUOTED_TEXT
84 /* these are handled in the lexer */
101 /* The original eqn manual says that `left' is right associative. It's lying.
102 Consider `left ( ~ left ( ~ right ) right )'. */
106 %right LPILE RPILE CPILE PILE TEXT QUOTED_TEXT MATRIX MARK LINEUP
'^' '~' '\t' '{' SPLIT NOSPLIT
108 %left SQRT OVER SMALLOVER
110 %right ROMAN BOLD ITALIC FAT FONT SIZE FWD BACK DOWN UP TYPE VCENTER SPECIAL
111 %right BAR UNDER PRIME
114 %type
<b
> mark from_to sqrt_over script simple equation nonsup
116 %type
<str
> text delim
117 %type
<pb
> pile_element_list pile_arg
118 %type
<mb
> column_list
119 %type
<col
> column column_arg column_element_list
125 { $1->top_level
(); non_empty_flag
= 1; }
133 list_box
*lb
= $1->to_list_box
();
135 lb
= new list_box
($1);
145 { $$
= make_mark_box
($2); }
147 { $$
= make_lineup_box
($2); }
153 | sqrt_over TO from_to
154 { $$
= make_limit_box
($1, 0, $3); }
155 | sqrt_over FROM sqrt_over
156 { $$
= make_limit_box
($1, $3, 0); }
157 | sqrt_over FROM sqrt_over TO from_to
158 { $$
= make_limit_box
($1, $3, $5); }
159 | sqrt_over FROM sqrt_over FROM from_to
160 { $$
= make_limit_box
($1, make_limit_box
($3, $5, 0), 0); }
167 { $$
= make_sqrt_box
($2); }
168 | sqrt_over OVER sqrt_over
169 { $$
= make_over_box
($1, $3); }
170 | sqrt_over SMALLOVER sqrt_over
171 { $$
= make_small_over_box
($1, $3); }
178 { $$
= make_script_box
($1, 0, $3); }
185 { $$
= make_script_box
($1, $3, 0); }
186 | simple SUB simple SUP script
187 { $$
= make_script_box
($1, $3, $5); }
192 { $$
= split_text
($1); }
194 { $$
= new quoted_text_box
($1); }
196 { $$
= split_text
($2); }
198 { $$
= new quoted_text_box
($2); }
200 { $$
= new half_space_box
; }
202 { $$
= new space_box
; }
204 { $$
= new tab_box
; }
208 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
210 { $2->set_alignment
(LEFT_ALIGN
); $$
= $2; }
212 { $2->set_alignment
(RIGHT_ALIGN
); $$
= $2; }
214 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
215 | MATRIX
'{' column_list
'}'
217 | LEFT delim equation RIGHT delim
218 { $$
= make_delim_box
($2, $3, $5); }
219 | LEFT delim equation
220 { $$
= make_delim_box
($2, $3, 0); }
222 { $$
= make_overline_box
($1); }
224 { $$
= make_underline_box
($1); }
226 { $$
= make_prime_box
($1); }
227 | simple ACCENT simple
228 { $$
= make_accent_box
($1, $3); }
229 | simple UACCENT simple
230 { $$
= make_uaccent_box
($1, $3); }
232 { $$
= new font_box
(strsave
(get_grfont
()), $2); }
234 { $$
= new font_box
(strsave
(get_gbfont
()), $2); }
236 { $$
= new font_box
(strsave
(get_gfont
()), $2); }
238 { $$
= new fat_box
($2); }
240 { $$
= new font_box
($2, $3); }
242 { $$
= new size_box
($2, $3); }
244 { $$
= new hmotion_box
($2, $3); }
246 { $$
= new hmotion_box
(-$2, $3); }
248 { $$
= new vmotion_box
($2, $3); }
250 { $$
= new vmotion_box
(-$2, $3); }
252 { $3->set_spacing_type
($2); $$
= $3; }
254 { $$
= new vcenter_box
($2); }
255 | SPECIAL text simple
256 { $$
= make_special_box
($2, $3); }
263 if
(sscanf
($1, "%d", &n
) == 1)
271 { $$
= new pile_box
($1); }
272 | pile_element_list ABOVE equation
273 { $1->append
($3); $$
= $1; }
277 '{' pile_element_list
'}'
279 | number
'{' pile_element_list
'}'
280 { $3->set_space
($1); $$
= $3; }
285 { $$
= new matrix_box
($1); }
287 { $1->append
($2); $$
= $1; }
292 { $$
= new column
($1); }
293 | column_element_list ABOVE equation
294 { $1->append
($3); $$
= $1; }
298 '{' column_element_list
'}'
300 | number
'{' column_element_list
'}'
301 { $3->set_space
($1); $$
= $3; }
306 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
308 { $2->set_alignment
(LEFT_ALIGN
); $$
= $2; }
310 { $2->set_alignment
(RIGHT_ALIGN
); $$
= $2; }
312 { $2->set_alignment
(CENTER_ALIGN
); $$
= $2; }
325 { $$
= strsave
("{"); }
327 { $$
= strsave
("}"); }