1: \{#
   2: #
   3: int fromflg 0;
   4: \}
   5: %term   CONTIG QTEXT  SPACE THIN TAB
   6: %term   UP DOWN BACK FWD
   7: %term   MATRIX LCOL CCOL RCOL COL
   8: %term   MARK LINEUP
   9: %term   SUM INT PROD UNION INTER
  10: %term   LPILE PILE CPILE RPILE ABOVE
  11: %term   DEFINE DELIM  GSIZE GFONT
  12: %right  FROM TO
  13: %left   OVER SQRT
  14: %right  SUPER SUB
  15: %right  SIZE FONT ROMAN ITALIC BOLD
  16: %left   MQ MQ1
  17: %left   LEFT RIGHT
  18: %right  DOT DOTDOT HAT TILDE BAR UNDER
  19: 
  20: %%
  21: 
  22: stuff   : eqn   ={ putout($1); }
  23:     | error ={ error(!FATAL, "syntax error in equation %d", first);  }
  24:     |   ={ eqnreg = 0; }
  25:     ;
  26: 
  27: eqn : box   ={ if(dbg)printf(".\teqn: S%d\n",$1); }
  28:     | eqn box   ={ eqnbox($1,$2); }
  29:     | eqn MARK  ={ mark($1); }
  30:     | MARK  ={ mark(0); }
  31:     | eqn LINEUP    ={ lineup($1); }
  32:     | LINEUP    ={ lineup(0); }
  33:     ;
  34: 
  35: matrix  : MATRIX    ={ $$ = ct; } ;
  36: 
  37: collist : column
  38:     | collist column
  39:     ;
  40: 
  41: column  : lcol MQ list MQ1  ={ column('L',$1,$3); }
  42:     | ccol MQ list MQ1  ={ column('C',$1,$3); }
  43:     | rcol MQ list MQ1  ={ column('R',$1,$3); }
  44:     | col MQ list MQ1   ={ column('-',$1,$3); }
  45:     ;
  46: 
  47: lcol    : LCOL  ={ $$ = ct++; } ;
  48: ccol    : CCOL  ={ $$ = ct++; } ;
  49: rcol    : RCOL  ={ $$ = ct++; } ;
  50: col : COL   ={ $$ = ct++; } ;
  51: 
  52: sbox    : super box %prec SUPER
  53:         ={ $$ = $2; }
  54:     |   %prec SUB
  55:         ={ $$ = 0; }
  56:     ;
  57: 
  58: box : box OVER box  ={ boverb($1,$3); }
  59:     | size box  %prec SIZE
  60:         ={ size($1,$2); }
  61:     | font box  %prec FONT
  62:         ={ font($1,$2); }
  63:     | SQRT box  ={ sqrt($2); }
  64:     | lpile MQ list MQ1 %prec LPILE
  65:         ={ lpile('L', $1, ct); ct=$1; }
  66:     | cpile MQ list MQ1 %prec CPILE
  67:         ={ lpile('C', $1, ct); ct=$1; }
  68:     | rpile MQ list MQ1 %prec RPILE
  69:         ={ lpile('R', $1, ct); ct=$1; }
  70:     | pile MQ list MQ1  %prec PILE
  71:         ={ lpile('-', $1, ct); ct=$1; }
  72:     | box sub box sbox  %prec SUB
  73:         ={ if(dbg)printf(".\t sub box %d %d %d\n",$1,$3,$4);
  74:             if($4 == 0)bshiftb($1,$2,$3);
  75:             else shift2($1,$3,$4);
  76:         }
  77:     | box super box     %prec SUPER
  78:         ={ bshiftb($1,$2,$3); }
  79:     | left eqn right    %prec LEFT
  80:         ={ paren($1,$2,$3); }
  81:     | pbox
  82:     | box from box to  box  %prec TO
  83:         ={ fromto($1,$3,$5); fromflg=0; }
  84:     | box from box  %prec FROM
  85:         ={ fromto($1,$3,0); fromflg=0; }
  86:     | box to box    %prec TO
  87:         ={ fromto($1,0,$3); }
  88:     | box diacrit   ={ diacrit($1,$2); }
  89:     | fwd box   ={ move(0,$1,$2); }
  90:     | up box    ={ move(1,$1,$2); }
  91:     | back box  ={ move(2,$1,$2); }
  92:     | down box  ={ move(3,$1,$2); }
  93:     | matrix MQ collist MQ1 ={ matrix($1,$3); }
  94:     ;
  95: 
  96: fwd : FWD text  ={ $$ = numb($1); } ;
  97: up  : UP text   ={ $$ = numb($1); } ;
  98: back    : BACK text ={ $$ = numb($1); } ;
  99: down    : DOWN text ={ $$ = numb($1); } ;
 100: 
 101: diacrit : HAT   ={ $$ = 'H'; }
 102:     | BAR   ={ $$ = 'B'; }
 103:     | UNDER ={ $$ = 'N'; }  /* under bar */
 104:     | DOT   ={ $$ = 'D'; }
 105:     | TILDE ={ $$ = 'T'; }
 106:     | DOTDOT    ={ $$ = 'U'; } /* umlaut = double dot */
 107:     ;
 108: 
 109: from    : FROM
 110:     ;
 111: to  : TO
 112:     ;
 113: 
 114: left    : LEFT text ={ $$ = $2->c1; }
 115:     | LEFT MQ   ={ $$ = '{'; }
 116:     ;
 117: 
 118: right   : RIGHT text    ={ $$ = $2->c1; }
 119:     | RIGHT MQ1 ={ $$ = '}'; }
 120:     |       ={ $$ = 0; }
 121:     ;
 122: 
 123: list    : eqn   ={ lp[ct++] = $1; }
 124:     | list ABOVE eqn    ={ lp[ct++] = $3; }
 125:     ;
 126: 
 127: lpile   : LPILE ={ $$=ct; } ;
 128: cpile   : CPILE ={ $$=ct; } ;
 129: pile    : PILE  ={ $$=ct; } ;
 130: rpile   : RPILE ={ $$=ct; } ;
 131: 
 132: size    : SIZE text
 133:     ;
 134: 
 135: font    : ROMAN
 136:     | ITALIC
 137:     | BOLD
 138:     | FONT text
 139:     ;
 140: 
 141: sub : SUB   ={ shift(1); } ;
 142: 
 143: super   : SUPER ={ shift(-1); } ;
 144: 
 145: pbox    : MQ eqn MQ1    ={ $$ = $2; }
 146:     | QTEXT ={ text('q',$1); }
 147:     | CONTIG    ={ text('c',$1); }
 148:     | SPACE ={ text('~', $1); }
 149:     | THIN  ={ text('^', $1); }
 150:     | TAB   ={ text('\t', $1); }
 151:     | SUM   ={  text('c', "SIGMA"); }
 152:     | PROD  ={  text('c', "PI"); }
 153:     | INT   ={  text('c', "^"); }
 154:     | UNION ={  text('c' ,"U"); }
 155:     | INTER ={  text('c', "A"); }
 156:     ;
 157: 
 158: text    : CONTIG
 159:     | QTEXT
 160:     | SPACE ={ $$ = & "\\|\\|"; }
 161:     | THIN  ={ $$ = & "\\|"; }
 162:     ;
 163: 
 164: %%

Defined variables

_fromflg defined in line 3; used 2 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 709
Valid CSS Valid XHTML 1.0 Strict