# 2.11BSD#431 - /usr/src/ucb/pascal/pi/yyerror.c

##### Functions

    brerror           X
    yerror            X

       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: }

#### Defined functions

brerror defined in line 97; used 4 times

- in /usr/src/ucb/pascal/pi/pas.y line 155, 420, 579, 586

yerror defined in line 35; used 36 times

- in line 84, 110
- in /usr/src/ucb/pascal/pi/hash.c line 151, 189
- in /usr/src/ucb/pascal/pi/pas.y line 513
- in /usr/src/ucb/pascal/pi/string.c line 79
- in /usr/src/ucb/pascal/pi/tree.c line 122, 128
- in /usr/src/ucb/pascal/pi/yylex.c line 130, 150, 169, 190, 199, 210, 223, 244, 266, 272
- in /usr/src/ucb/pascal/pi/yypanic.c line 52, 75, 87, 140, 146
- in /usr/src/ucb/pascal/pi/yyparse.c line 72, 210
- in /usr/src/ucb/pascal/pi/yyrecover.c line 210, 384-386(2), 407, 421, 441, 454, 474-479(2), 514, 521

Last modified: 1981-07-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 502 |