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

Defined functions

brerror defined in line 108; never used
yerror defined in line 42; used 3 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-06-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1097
Valid CSS Valid XHTML 1.0 Strict