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