7
gSOAP XML Web services tools
8
Copyright (C) 2004, Robert van Engelen, Genivia, Inc. All Rights Reserved.
10
--------------------------------------------------------------------------------
13
The contents of this file are subject to the gSOAP Public License Version 1.3
14
(the "License"); you may not use this file except in compliance with the
15
License. You may obtain a copy of the License at
16
http://www.cs.fsu.edu/~engelen/soaplicense.html
17
Software distributed under the License is distributed on an "AS IS" basis,
18
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19
for the specific language governing rights and limitations under the License.
21
The Initial Developer of the Original Code is Robert A. van Engelen.
22
Copyright (C) 2000-2004 Robert A. van Engelen, Genivia inc. All Rights Reserved.
23
--------------------------------------------------------------------------------
26
This program is free software; you can redistribute it and/or modify it under
27
the terms of the GNU General Public License as published by the Free Software
28
Foundation; either version 2 of the License, or (at your option) any later
31
This program is distributed in the hope that it will be useful, but WITHOUT ANY
32
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
33
PARTICULAR PURPOSE. See the GNU General Public License for more details.
35
You should have received a copy of the GNU General Public License along with
36
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
37
Place, Suite 330, Boston, MA 02111-1307 USA
39
Author contact information:
40
engelen@genivia.com / engelen@acm.org
41
--------------------------------------------------------------------------------
45
#include "soapcpp2_yacc.h"
49
extern char yytext[]; /* lexeme found by the lexical analyzer */
51
static int lexerrno = 0;
52
static int synerrno = 0;
53
static int semerrno = 0;
54
static int semwarno = 0;
56
char errbuf[1024]; /* to hold error messages */
59
yyerror - called by parser from an error production with nonterminal `error'
62
{ fprintf(stderr, "%s(%d): %s\n", filename, yylineno, s);
66
lexerror - called by lexical analyzer upon failure to recognize a token
68
lexerror(const char *s)
69
{ fprintf(stderr, "%s(%d): %s: %s\n", filename, yylineno, s, yytext);
70
if (lexerrno++ >= MAXERR)
71
execerror("too many syntactic errors, bailing out");
75
synerror - called by a semantic action in the yacc grammar
77
synerror(const char *s)
78
{ fprintf(stderr, "%s(%d): Syntax error: %s\n", filename, yylineno-1, s);
79
if (synerrno++ >= MAXERR)
80
execerror("too many syntactic errors, bailing out");
84
semerror - report semantic error from static checking
86
semerror(const char *s)
87
{ fprintf(stderr, "\n%s(%d): **ERROR**: %s\n\n", filename, yylineno, s);
88
if (semerrno++ >= MAXERR)
89
execerror("too many semantic errors, bailing out");
93
semwarn - report semantic warning from static checking
95
semwarn(const char *s)
96
{ fprintf(stderr, "\n**WARNING**: %s (detected at line %d in %s)\n\n", s, yylineno, filename);
101
compliancewarn - report compliance warning
103
compliancewarn(const char *s)
104
{ fprintf(stderr, "Compliance warning: %s\n", s);
108
typerror - report type error (a semantic error)
110
typerror(const char *s)
111
{ fprintf(stderr, "%s(%d): Type error: %s\n", filename, yylineno, s);
112
if (semerrno++ >= MAXERR)
113
execerror("too many semantic errors, bailing out");
117
execerror - print error message and terminate execution
119
execerror(const char *s)
120
{ fprintf(stderr, "Critical error: %s\n", s);
125
progerror - called when check(expr) failed, i.e. upon programming error
127
progerror(const char *s, const char *f, int l)
128
{ fprintf(stderr, "Program failure: %s in file %s line %d\n", s, f, l);
133
errstat - show error statistics
136
{ if (!lexerrno && !synerrno && !semerrno)
137
{ fprintf(stderr, "\nCompilation successful ");
139
fprintf(stderr, "(%d warning%s)\n\n", semwarno, semwarno>1?"s":"");
141
fprintf(stderr, "\n\n");
144
fprintf(stderr, "\nThere were errors:\n");
146
fprintf(stderr, "%d lexical error%s\n", lexerrno, lexerrno>1?"s":"");
148
fprintf(stderr, "%d syntax error%s\n", synerrno, synerrno>1?"s":"");
150
fprintf(stderr, "%d semantic error%s\n", semerrno, semerrno>1?"s":"");
152
fprintf(stderr, "%d warning%s\n", semwarno, semwarno>1?"s":"");
153
fprintf(stderr, "\n");