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