1: #
   2: /*
   3:  * pi - Pascal interpreter code translator
   4:  *
   5:  * Charles Haley, Bill Joy UCB
   6:  * Version 1.2 January 1979
   7:  *
   8:  *
   9:  * pxp - Pascal execution profiler
  10:  *
  11:  * Bill Joy UCB
  12:  * Version 1.2 January 1979
  13:  */
  14: 
  15: #include "0.h"
  16: #include "yy.h"
  17: 
  18: /*
  19:  * Yerror prints an error
  20:  * message and then returns
  21:  * NIL for the tree if needed.
  22:  * The error is flagged on the
  23:  * current line which is printed
  24:  * if the listing is turned off.
  25: #ifdef PXP
  26:  *
  27:  * As is obvious from the fooling around
  28:  * with fout below, the Pascal system should
  29:  * be changed to use the new library "lS".
  30: #endif
  31:  */
  32: yerror(s, a1, a2, a3, a4, a5)
  33:     char *s;
  34: {
  35: #ifdef PI
  36:     char buf[256];
  37: #endif
  38:     register int i, j;
  39:     static yySerrs;
  40: #ifdef PXP
  41:     int ofout;
  42: #endif
  43: 
  44:     if (errpfx == 'w' && opt('w') != 0)
  45:         return;
  46: #ifdef PXP
  47:     flush();
  48:     ofout = fout[0];
  49:     fout[0] = errout;
  50: #endif
  51:     yyResume = 0;
  52: #ifdef PI
  53:     geterr(s, buf);
  54:     s = buf;
  55: #endif
  56:     yysync();
  57:     putchar(errpfx);
  58:     putchar(' ');
  59:     for (i = 3; i < yyecol; i++)
  60:         putchar('-');
  61:     printf("^--- ");
  62: /*
  63: 	if (yyecol > 60)
  64: 		printf("\n\t");
  65: */
  66:     printf(s, a1, a2, a3, a4, a5);
  67:     putchar('\n');
  68:     if (errpfx == 'E')
  69: #ifdef PI
  70:         eflg++, cgenflg++;
  71: #endif
  72: #ifdef PXP
  73:         eflg++;
  74: #endif
  75:     errpfx = 'E';
  76:     yySerrs++;
  77:     if (yySerrs >= MAXSYNERR) {
  78:         yySerrs = 0;
  79:         yerror("Too many syntax errors - QUIT");
  80:         pexit(ERRS);
  81:     }
  82: #ifdef PXP
  83:     flush();
  84:     fout[0] = ofout;
  85:     return (0);
  86: #endif
  87: }
  88: 
  89: /*
  90:  * A bracketing error message
  91:  */
  92: brerror(where, what)
  93:     int where;
  94:     char *what;
  95: {
  96: 
  97:     if (where == 0) {
  98:         line = yyeline;
  99:         setpfx(' ');
 100:         error("End matched %s on line %d", what, where);
 101:         return;
 102:     }
 103:     if (where < 0)
 104:         where = -where;
 105:     yerror("Inserted keyword end matching %s on line %d", what, where);
 106: }
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 752
Valid CSS Valid XHTML 1.0 Strict