1: #
   2: # include   <stdio.h>
   3: 
   4: # include   "constants.h"
   5: # include   "globals.h"
   6: 
   7: 
   8: /*
   9: **  YYERROR -- Error reporting routines
  10: **
  11: **	Defines:
  12: **		yyerror()
  13: **		yyserror()
  14: **		yysemerr()
  15: **
  16: **	History:
  17: **		6/1/78 -- (marc) written
  18: */
  19: 
  20: 
  21: /*
  22: **  YYERROR -- Yacc error reporting routine.
  23: **	Yyerror reports on syntax errors encountered by
  24: **	the yacc parser.
  25: **
  26: **	Parameters:
  27: **		s -- a string explaining the error
  28: **
  29: **	Returns:
  30: **		none
  31: **
  32: **	Called By:
  33: **		yyparse()
  34: **
  35: **	History:
  36: **		6/1/78 -- (marc) written
  37: */
  38: 
  39: 
  40: yyerror(s)
  41: char    *s;
  42: {
  43:     extern char *yysterm [];
  44: 
  45:     file_spec();
  46:     if (yychar == 0)
  47:         printf("EOF = ");
  48:     else
  49:         printf("%s = ", yysterm [yychar - 0400]);
  50: 
  51:     if (yylval)
  52:         printf("'%s' : ", ((struct disp_node *)yylval)->d_elm);
  53: 
  54:     printf("line %d, %s\n",
  55:     yyline, s);
  56: }
  57: 
  58: /*
  59: **  YYSEMERR -- scanner error reporter
  60: **
  61: **	Parameters:
  62: **		s -- string explaining the error
  63: **		i -- if !0 a string which caused the error
  64: **
  65: **	Returns:
  66: **		none
  67: **
  68: **	Called By:
  69: **		lexical analysis routines -- if called from somewhere else,
  70: **			the line number is likely to be wrong.
  71: **
  72: **	History:
  73: **		6/1/78 -- (marc) written
  74: */
  75: 
  76: 
  77: yysemerr(s, i)
  78: char        *s;
  79: char        *i;
  80: {
  81:     char    *str;
  82:     extern char *yysterm[];
  83: 
  84:     file_spec();
  85:     if (i)
  86:         printf("'%s' : ", i);
  87:     printf("line %d, %s\n",
  88:     yyline, s);
  89: }
  90: 
  91: /*
  92: **  YYSERROR -- Semantic error reportin routine
  93: **	reports on an error on an entry in the symbol space,
  94: **	using the line number built into the entry.
  95: **
  96: **	Parameters:
  97: **		s -- a string explaining the error
  98: **		d -- a symbol space node
  99: **
 100: **	Returns:
 101: **		none
 102: **
 103: **	Called By:
 104: **		semantic productions
 105: **
 106: **	History:
 107: **		6/1/78 -- (marc) written
 108: */
 109: 
 110: 
 111: yyserror(s, d)
 112: char            *s;
 113: struct disp_node    *d;
 114: {
 115:     file_spec();
 116:     printf("'%s' : line %d, %s\n",
 117:     d->d_elm, d->d_line, s);
 118: }
 119: 
 120: /*
 121: **  FILE_SPEC -- If in an included file, specify the name of that file.
 122: **
 123: **	History:
 124: **		6/10/78 -- (marc) written
 125: **
 126: */
 127: 
 128: 
 129: file_spec()
 130: {
 131:     if (Inc_files)
 132:         printf("** %s : ", Input_file_name);
 133: }
Last modified: 1995-02-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2598
Valid CSS Valid XHTML 1.0 Strict