Annotation of researchv9/cmd/eqn/eqn.y, revision 1.1.1.1

1.1       root        1: %term  CONTIG QTEXT SPACE THIN TAB
                      2: %term  MATRIX LCOL CCOL RCOL COL ABOVE
                      3: %term  MARK LINEUP
                      4: %term  SUM INT PROD UNION INTER
                      5: %term  DEFINE TDEFINE NDEFINE DELIM GSIZE GFONT INCLUDE SPACE IFDEF
                      6: %term  DOTEQ DOTEN
                      7: 
                      8: %right FROM TO
                      9: %left  OVER SQRT
                     10: %right SUP SUB
                     11: %right SIZE FONT ROMAN ITALIC BOLD FAT
                     12: %right UP DOWN BACK FWD
                     13: %left  LEFT RIGHT
                     14: %right DOT DOTDOT HAT TILDE BAR LOWBAR HIGHBAR UNDER VEC DYAD UTILDE
                     15: 
                     16: %{
                     17: #include "e.h"
                     18: %}
                     19: 
                     20: %%
                     21: 
                     22: stuff  : eqn           { putout($1); }
                     23:        | error         { error(!FATAL, "syntax error"); }
                     24:        |               { eqnreg = 0; }
                     25:        ;
                     26: 
                     27: eqn    : box
                     28:        | eqn box       { eqnbox($1, $2, 0); }
                     29:        | eqn lineupbox { eqnbox($1, $2, 1); }
                     30:        | LINEUP        { lineup(0); }
                     31:        ;
                     32: 
                     33: lineupbox: LINEUP box  { $$ = $2; lineup(1); }
                     34:        ;
                     35: 
                     36: sbox   : SUP box       %prec SUP       { $$ = $2; }
                     37:        |               %prec SUP       { $$ = 0; }
                     38:        ;
                     39: 
                     40: tbox   : TO box        %prec TO        { $$ = $2; }
                     41:        |               %prec FROM      { $$ = 0; }
                     42:        ;
                     43: 
                     44: box    : '{' eqn '}'   { $$ = $2; }
                     45:        | QTEXT         { text(QTEXT, (char *) $1); }
                     46:        | CONTIG        { text(CONTIG, (char *) $1); }
                     47:        | SPACE         { text(SPACE, 0); }
                     48:        | THIN          { text(THIN, 0); }
                     49:        | TAB           { text(TAB, 0); }
                     50:        | SUM           { funny(SUM); }
                     51:        | PROD          { funny(PROD); }
                     52:        | UNION         { funny(UNION); }
                     53:        | INTER         { funny(INTER); }
                     54:        | box OVER box                  { boverb($1, $3); }
                     55:        | MARK box                      { mark($2); }
                     56:        | size box      %prec SIZE      { size($1, $2); }
                     57:        | font box      %prec FONT      { font($1, $2); }
                     58:        | FAT box                       { fatbox($2); }
                     59:        | SQRT box                      { sqrt($2); }
                     60:        | box SUB {ps -= deltaps;} box sbox     %prec SUB       { subsup($1, $4, $5); }
                     61:        | box SUP {ps -= deltaps;} box          %prec SUP       { subsup($1, 0, $4); }
                     62:        | int SUB {ps -= deltaps;} box sbox     %prec SUB       { integral($1, $4, $5); }
                     63:        | int SUP {ps -= deltaps;} box          %prec SUP       { integral($1, 0, $4); }
                     64:        | int                                   { integral($1, 0, 0); }
                     65:        | box FROM {ps -= deltaps;} box tbox    %prec FROM      { fromto($1, $4, $5); }
                     66:        | box TO {ps -= deltaps;} box           %prec TO        { fromto($1, 0, $4); }
                     67:        | left eqn right                        { paren($1, $2, $3); }
                     68:        | left eqn                              { paren($1, $2, 0); }
                     69:        | box diacrit                   { diacrit($1, $2); }
                     70:        | fwd box       %prec UP        { move(FWD, $1, $2); }
                     71:        | up box        %prec UP        { move(UP, $1, $2); }
                     72:        | back box      %prec UP        { move(BACK, $1, $2); }
                     73:        | down box      %prec UP        { move(DOWN, $1, $2); }
                     74:        | column                        { pile($1); ct = $1; }
                     75:        | MATRIX {$$=ct;} '{' collist '}'       { matrix($2); ct = $2; }
                     76:        ;
                     77: 
                     78: int    : INT           { setintegral(); }
                     79:        ;
                     80: 
                     81: fwd    : FWD text      { $$ = atoi((char *) $1); } ;
                     82: up     : UP text       { $$ = atoi((char *) $1); } ;
                     83: back   : BACK text     { $$ = atoi((char *) $1); } ;
                     84: down   : DOWN text     { $$ = atoi((char *) $1); } ;
                     85: 
                     86: diacrit        : HAT           { $$ = HAT; }
                     87:        | VEC           { $$ = VEC; }
                     88:        | DYAD          { $$ = DYAD; }
                     89:        | BAR           { $$ = BAR; }
                     90:        | LOWBAR        { $$ = LOWBAR; }
                     91:        | HIGHBAR       { $$ = HIGHBAR; }
                     92:        | UNDER         { $$ = UNDER; } /* underbar */
                     93:        | DOT           { $$ = DOT; }
                     94:        | TILDE         { $$ = TILDE; }
                     95:        | UTILDE        { $$ = UTILDE; }
                     96:        | DOTDOT        { $$ = DOTDOT; } /* umlaut = double dot */
                     97:        ;
                     98: 
                     99: left   : LEFT text     { $$ = ((char *)$2)[0]; }
                    100:        | LEFT '{'      { $$ = '{'; }
                    101:        ;
                    102: 
                    103: right  : RIGHT text    { $$ = ((char *)$2)[0]; }
                    104:        | RIGHT '}'     { $$ = '}'; }
                    105:        ;
                    106: 
                    107: collist        : column
                    108:        | collist column
                    109:        ;
                    110: 
                    111: column : col '{' list '}'                              { column($1, DEFGAP); }
                    112:        | col text {$$=atoi((char*)$2);} '{' list '}'   { column($1, $3); }
                    113:        ;
                    114: 
                    115: col    : LCOL          { $$ = startcol(LCOL); }
                    116:        | CCOL          { $$ = startcol(CCOL); }
                    117:        | RCOL          { $$ = startcol(RCOL); }
                    118:        | COL           { $$ = startcol(COL); }
                    119:        ;
                    120: 
                    121: list   : eqn                   { lp[ct++] = $1; }
                    122:        | list ABOVE eqn        { lp[ct++] = $3; }
                    123:        ;
                    124: 
                    125: size   : SIZE text     { $$ = ps; setsize((char *) $2); }
                    126:        ;
                    127: 
                    128: font   : ROMAN         { setfont("R"); }
                    129:        | ITALIC        { setfont("I"); }
                    130:        | BOLD          { setfont("B"); }
                    131:        | FONT text     { setfont((char *)$2); }
                    132:        ;
                    133: 
                    134: text   : CONTIG
                    135:        | QTEXT
                    136:        ;
                    137: 
                    138: %%

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.