1: # include   <stdio.h>
   2: # include   "constants.h"
   3: # include   "globals.h"
   4: # include   "y.tab.h"
   5: # include   <sccs.h>
   6: 
   7: SCCSID(@(#)yyerror.c	8.1	12/31/84)
   8: 
   9: extern  int Exit_val;       /* value to exit with, incremented if error found */
  10: 
  11: 
  12: /*
  13: **  YYERROR -- Yacc error reporting routine.
  14: **	Yyerror reports on syntax errors encountered by
  15: **	the yacc parser, and increments the Exit_val variable.
  16: **
  17: **	Parameters:
  18: **		s -- a string explaining the error
  19: **
  20: **	Returns:
  21: **		none
  22: */
  23: 
  24: 
  25: yyerror(s)
  26: char    *s;
  27: {
  28: 
  29:     printf("\"%s\", line %d: ", Input_file_name, yyline);
  30:     if (yychar == 0)
  31:         printf("EOF = ");
  32:     if (yylval.u_dn)
  33:         printf("\"%s\" ", yylval.u_dn->d_elm);
  34:     printf("%s\n", s);
  35:     Exit_val++;
  36: }
  37: /*
  38: **  YYSEMERR -- scanner error reporter
  39: **		Also increments the Exit_val variable.
  40: **	Parameters:
  41: **		s -- string explaining the error
  42: **		i -- if !0 a string which caused the error
  43: **
  44: **	Returns:
  45: **		none
  46: **
  47: **	Called By:
  48: **		lexical analysis routines -- if called from somewhere else,
  49: **			the line number is likely to be wrong.
  50: */
  51: 
  52: 
  53: yysemerr(s, i)
  54: char        *s;
  55: char        *i;
  56: {
  57:     char    *str;
  58: 
  59:     printf("\"%s\", line %d: ", Input_file_name, yyline);
  60:     if (i)
  61:         printf("\"%s\": ", i);
  62:     printf("%s\n", s);
  63:     Exit_val++;
  64: }
  65: /*
  66: **  YYSERROR -- Semantic error reportin routine
  67: **	reports on an error on an entry in the symbol space,
  68: **	using the line number built into the entry. Exit_val gets
  69: **	incremented.
  70: **
  71: **	Parameters:
  72: **		s -- a string explaining the error
  73: **		d -- a symbol space node
  74: **
  75: **	Returns:
  76: **		none
  77: **
  78: **	Called By:
  79: **		semantic productions
  80: */
  81: 
  82: 
  83: yyserror(s, d)
  84: char            *s;
  85: struct disp_node    *d;
  86: {
  87:     printf("\"%s\", line %d: ", Input_file_name, d->d_line);
  88:     printf("\"%s\": %s\n", d->d_elm, s);
  89:     Exit_val++;
  90: }
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 965
Valid CSS Valid XHTML 1.0 Strict