/* Copyright (C) 1989, 1990 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
This file is part of groff.
groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along
with groff; see the file LICENSE. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int non_empty_flag;
char *strsave(const char *);
void yyerror(const char *);
/* these are handled in the lexer */
/* The original eqn manual says that `left' is right associative. It's lying.
Consider `left ( ~ left ( ~ right ) right )'. */
%right LPILE RPILE CPILE PILE TEXT QUOTED_TEXT MATRIX MARK LINEUP '^' '~' '\t' '{' SPLIT NOSPLIT
%left SQRT OVER SMALLOVER
%right ROMAN BOLD ITALIC FAT FONT SIZE FWD BACK DOWN UP TYPE VCENTER
%type <b> mark from_to sqrt_over script simple equation nonsup
%type <pb> pile_element_list pile_arg
%type <col> column column_arg column_element_list
{ $1->top_level(); non_empty_flag = 1; }
list_box *lb = $1->to_list_box();
{ $$ = make_mark_box($2); }
{ $$ = make_lineup_box($2); }
{ $$ = make_limit_box($1, 0, $3); }
| sqrt_over FROM sqrt_over
{ $$ = make_limit_box($1, $3, 0); }
| sqrt_over FROM sqrt_over TO from_to
{ $$ = make_limit_box($1, $3, $5); }
| sqrt_over FROM sqrt_over FROM from_to
{ $$ = make_limit_box($1, make_limit_box($3, $5, 0), 0); }
{ $$ = make_sqrt_box($2); }
| sqrt_over OVER sqrt_over
{ $$ = make_over_box($1, $3); }
| sqrt_over SMALLOVER sqrt_over
{ $$ = make_small_over_box($1, $3); }
{ $$ = make_script_box($1, 0, $3); }
{ $$ = make_script_box($1, $3, 0); }
| simple SUB simple SUP script
{ $$ = make_script_box($1, $3, $5); }
{ $$ = new quoted_text_box($1); }
{ $$ = new quoted_text_box($2); }
{ $$ = new half_space_box; }
{ $2->set_alignment(CENTER_ALIGN); $$ = $2; }
{ $2->set_alignment(LEFT_ALIGN); $$ = $2; }
{ $2->set_alignment(RIGHT_ALIGN); $$ = $2; }
{ $2->set_alignment(CENTER_ALIGN); $$ = $2; }
| MATRIX '{' column_list '}'
| LEFT delim equation RIGHT delim
{ $$ = make_delim_box($2, $3, $5); }
{ $$ = make_delim_box($2, $3, 0); }
{ $$ = make_overline_box($1); }
{ $$ = make_underline_box($1); }
{ $$ = make_prime_box($1); }
{ $$ = make_accent_box($1, $3); }
{ $$ = make_uaccent_box($1, $3); }
{ $$ = new font_box(strsave(get_grfont()), $2); }
{ $$ = new font_box(strsave(get_gbfont()), $2); }
{ $$ = new font_box(strsave(get_gfont()), $2); }
{ $$ = new fat_box($2); }
{ $$ = new font_box($2, $3); }
{ $$ = new size_box($2, $3); }
{ $$ = new hmotion_box($2, $3); }
{ $$ = new hmotion_box(-$2, $3); }
{ $$ = new vmotion_box($2, $3); }
{ $$ = new vmotion_box(-$2, $3); }
{ $3->set_spacing_type($2); $$ = $3; }
{ $$ = new vcenter_box($2); }
if (sscanf($1, "%d", &n) == 1)
{ $$ = new pile_box($1); }
| pile_element_list ABOVE equation
{ $1->append($3); $$ = $1; }
'{' pile_element_list '}'
| number '{' pile_element_list '}'
{ $3->set_space($1); $$ = $3; }
{ $$ = new matrix_box($1); }
{ $1->append($2); $$ = $1; }
| column_element_list ABOVE equation
{ $1->append($3); $$ = $1; }
'{' column_element_list '}'
| number '{' column_element_list '}'
{ $3->set_space($1); $$ = $3; }
{ $2->set_alignment(CENTER_ALIGN); $$ = $2; }
{ $2->set_alignment(LEFT_ALIGN); $$ = $2; }
{ $2->set_alignment(RIGHT_ALIGN); $$ = $2; }
{ $2->set_alignment(CENTER_ALIGN); $$ = $2; }