|
|
1.1 ! root 1: /* Copyright (c) 1979 Regents of the University of California */ ! 2: ! 3: static char sccsid[] = "@(#)yyerror.c 1.1 8/27/80"; ! 4: ! 5: #include "whoami.h" ! 6: #include "0.h" ! 7: #include "yy.h" ! 8: ! 9: /* ! 10: * Yerror prints an error ! 11: * message and then returns ! 12: * NIL for the tree if needed. ! 13: * The error is flagged on the ! 14: * current line which is printed ! 15: * if the listing is turned off. ! 16: #ifdef PXP ! 17: * ! 18: * As is obvious from the fooling around ! 19: * with fout below, the Pascal system should ! 20: * be changed to use the new library "lS". ! 21: #endif ! 22: */ ! 23: yerror(s, a1, a2, a3, a4, a5) ! 24: char *s; ! 25: { ! 26: #ifdef PI ! 27: char buf[256]; ! 28: #endif ! 29: register int i, j; ! 30: static yySerrs; ! 31: #ifdef PXP ! 32: int ofout; ! 33: #endif ! 34: ! 35: if (errpfx == 'w' && opt('w') != 0) { ! 36: errpfx = 'E'; ! 37: return; ! 38: } ! 39: #ifdef PXP ! 40: flush(); ! 41: ofout = fout[0]; ! 42: fout[0] = errout; ! 43: #endif ! 44: yyResume = 0; ! 45: #ifdef PI ! 46: geterr(s, buf); ! 47: s = buf; ! 48: #endif ! 49: yysync(); ! 50: pchr(errpfx); ! 51: pchr(' '); ! 52: for (i = 3; i < yyecol; i++) ! 53: pchr('-'); ! 54: printf("^--- "); ! 55: /* ! 56: if (yyecol > 60) ! 57: printf("\n\t"); ! 58: */ ! 59: printf(s, a1, a2, a3, a4, a5); ! 60: pchr('\n'); ! 61: if (errpfx == 'E') ! 62: #ifdef PI ! 63: eflg++, codeoff(); ! 64: #endif ! 65: #ifdef PXP ! 66: eflg++; ! 67: #endif ! 68: errpfx = 'E'; ! 69: yySerrs++; ! 70: if (yySerrs >= MAXSYNERR) { ! 71: yySerrs = 0; ! 72: yerror("Too many syntax errors - QUIT"); ! 73: pexit(ERRS); ! 74: } ! 75: #ifdef PXP ! 76: flush(); ! 77: fout[0] = ofout; ! 78: return (0); ! 79: #endif ! 80: } ! 81: ! 82: /* ! 83: * A bracketing error message ! 84: */ ! 85: brerror(where, what) ! 86: int where; ! 87: char *what; ! 88: { ! 89: ! 90: if (where == 0) { ! 91: line = yyeline; ! 92: setpfx(' '); ! 93: error("End matched %s on line %d", what, where); ! 94: return; ! 95: } ! 96: if (where < 0) ! 97: where = -where; ! 98: yerror("Inserted keyword end matching %s on line %d", what, where); ! 99: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.