xref: /aoo41x/main/idlc/source/errorhandler.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_idlc.hxx"
30*cdf0e10cSrcweir #include <idlc/errorhandler.hxx>
31*cdf0e10cSrcweir #include <idlc/astinterface.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir using namespace ::rtl;
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir static const sal_Char* errorCodeToMessage(ErrorCode eCode)
36*cdf0e10cSrcweir {
37*cdf0e10cSrcweir 	switch (eCode)
38*cdf0e10cSrcweir 	{
39*cdf0e10cSrcweir 	case EIDL_NONE:
40*cdf0e10cSrcweir 		return "all is fine ";
41*cdf0e10cSrcweir 	case EIDL_SYNTAX_ERROR:
42*cdf0e10cSrcweir 		return "";
43*cdf0e10cSrcweir 	case EIDL_REDEF:
44*cdf0e10cSrcweir 		return "illegal redefinition ";
45*cdf0e10cSrcweir 	case EIDL_REDEF_SCOPE:
46*cdf0e10cSrcweir 		return "illegal redefinition in scope ";
47*cdf0e10cSrcweir 	case EIDL_DEF_USE:
48*cdf0e10cSrcweir 		return "redefinition after use, ";
49*cdf0e10cSrcweir 	case EIDL_MULTIPLE_BRANCH:
50*cdf0e10cSrcweir 		return "union with duplicate branch label ";
51*cdf0e10cSrcweir 	case EIDL_COERCION_FAILURE:
52*cdf0e10cSrcweir 		return "coercion failure ";
53*cdf0e10cSrcweir 	case EIDL_SCOPE_CONFLICT:
54*cdf0e10cSrcweir 		return "definition scope is different than fwd declare scope, ";
55*cdf0e10cSrcweir 	case EIDL_ONEWAY_CONFLICT:
56*cdf0e10cSrcweir 		return "oneway operation with OUT|INOUT parameters or raises exceptions, ";
57*cdf0e10cSrcweir 	case EIDL_DISC_TYPE:
58*cdf0e10cSrcweir 		return "union with illegal discriminator type, ";
59*cdf0e10cSrcweir 	case EIDL_LABEL_TYPE:
60*cdf0e10cSrcweir 		return "label type incompatible with union discriminator type, ";
61*cdf0e10cSrcweir 	case EIDL_ILLEGAL_ADD:
62*cdf0e10cSrcweir 		return "illegal add operation, ";
63*cdf0e10cSrcweir 	case EIDL_ILLEGAL_USE:
64*cdf0e10cSrcweir 		return "illegal type used in expression, ";
65*cdf0e10cSrcweir 	case EIDL_ILLEGAL_RAISES:
66*cdf0e10cSrcweir 		return "non-exception type in raises(..) clause, ";
67*cdf0e10cSrcweir 	case EIDL_CANT_INHERIT:
68*cdf0e10cSrcweir 		return "cannot inherit ";
69*cdf0e10cSrcweir 	case EIDL_LOOKUP_ERROR:
70*cdf0e10cSrcweir 		return "error in lookup of symbol: ";
71*cdf0e10cSrcweir 	case EIDL_INHERIT_FWD_ERROR:
72*cdf0e10cSrcweir 		return "";
73*cdf0e10cSrcweir 	case EIDL_CONSTANT_EXPECTED:
74*cdf0e10cSrcweir 		return "constant expected: ";
75*cdf0e10cSrcweir 	case EIDL_NAME_CASE_ERROR:
76*cdf0e10cSrcweir 		return "identifier used with two differing spellings: ";
77*cdf0e10cSrcweir 	case EIDL_ENUM_VAL_EXPECTED:
78*cdf0e10cSrcweir 		return "enumerator expected: ";
79*cdf0e10cSrcweir 	case EIDL_ENUM_VAL_NOT_FOUND:
80*cdf0e10cSrcweir 		return "enumerator by this name not defined: ";
81*cdf0e10cSrcweir 	case EIDL_EVAL_ERROR:
82*cdf0e10cSrcweir 		return "expression evaluation error: ";
83*cdf0e10cSrcweir 	case EIDL_AMBIGUOUS:
84*cdf0e10cSrcweir 		return "ambiguous definition: ";
85*cdf0e10cSrcweir 	case EIDL_DECL_NOT_DEFINED:
86*cdf0e10cSrcweir 		return "forward declared but never defined: ";
87*cdf0e10cSrcweir 	case EIDL_FWD_DECL_LOOKUP:
88*cdf0e10cSrcweir 		return "";
89*cdf0e10cSrcweir 	case EIDL_RECURSIVE_TYPE:
90*cdf0e10cSrcweir 		return "illegal recursive use of type: ";
91*cdf0e10cSrcweir 	case EIDL_NONVOID_ONEWAY:
92*cdf0e10cSrcweir 		return "non-void return type in oneway operation: ";
93*cdf0e10cSrcweir 	case EIDL_NOT_A_TYPE:
94*cdf0e10cSrcweir 		return "specified symbol is not a type: ";
95*cdf0e10cSrcweir 	case EIDL_TYPE_NOT_VALID:
96*cdf0e10cSrcweir 		return "specified type is not valid in this context: ";
97*cdf0e10cSrcweir 	case EIDL_INTERFACEMEMBER_LOOKUP:
98*cdf0e10cSrcweir 		return "error in lookup of symbol, expected interface is not defined and no forward exists: ";
99*cdf0e10cSrcweir 	case EIDL_SERVICEMEMBER_LOOKUP:
100*cdf0e10cSrcweir 		return "error in lookup of symbol, expected service is not defined: ";
101*cdf0e10cSrcweir 	case EIDL_TYPE_IDENT_CONFLICT:
102*cdf0e10cSrcweir 		return "type and parameter/member name are equal: ";
103*cdf0e10cSrcweir 	case EIDL_ONEWAY_RAISE_CONFLICT:
104*cdf0e10cSrcweir 		return "oneway operation cannot raises exceptions: ";
105*cdf0e10cSrcweir 	case EIDL_WRONGATTRIBUTEFLAG:
106*cdf0e10cSrcweir 		return "the used flag is not valid in this context: ";
107*cdf0e10cSrcweir 	case EIDL_DEFINED_ATTRIBUTEFLAG:
108*cdf0e10cSrcweir 		return "flag is already set: ";
109*cdf0e10cSrcweir 	case EIDL_WRONGATTRIBUTEKEYWORD:
110*cdf0e10cSrcweir 		return "keyword not allowed: ";
111*cdf0e10cSrcweir 	case EIDL_MISSINGATTRIBUTEKEYWORD:
112*cdf0e10cSrcweir 		return "missing keyword: ";
113*cdf0e10cSrcweir 	case EIDL_BAD_ATTRIBUTE_FLAGS:
114*cdf0e10cSrcweir 		return
115*cdf0e10cSrcweir             "the 'attribute' flag is mandatory, and only the 'bound' and"
116*cdf0e10cSrcweir             " 'readonly' optional flags are accepted: ";
117*cdf0e10cSrcweir 	case EIDL_OPTIONALEXPECTED:
118*cdf0e10cSrcweir 		return "only the 'optional' flag is accepted: ";
119*cdf0e10cSrcweir     case EIDL_MIXED_INHERITANCE:
120*cdf0e10cSrcweir         return "interface inheritance declarations cannot appear in both an"
121*cdf0e10cSrcweir             " interface's header and its body";
122*cdf0e10cSrcweir     case EIDL_DOUBLE_INHERITANCE:
123*cdf0e10cSrcweir         return
124*cdf0e10cSrcweir             "interface is (directly or indirectly) inherited more than once: ";
125*cdf0e10cSrcweir     case EIDL_DOUBLE_MEMBER:
126*cdf0e10cSrcweir         return
127*cdf0e10cSrcweir             "member is (directly or indirectly) declared more than once: ";
128*cdf0e10cSrcweir     case EIDL_CONSTRUCTOR_PARAMETER_NOT_IN:
129*cdf0e10cSrcweir         return
130*cdf0e10cSrcweir             "a service constructor parameter may not be an out or inout"
131*cdf0e10cSrcweir             " parameter";
132*cdf0e10cSrcweir     case EIDL_CONSTRUCTOR_REST_PARAMETER_NOT_FIRST:
133*cdf0e10cSrcweir         return
134*cdf0e10cSrcweir             "no parameters may precede a rest parameter in a service"
135*cdf0e10cSrcweir             " constructor";
136*cdf0e10cSrcweir     case EIDL_REST_PARAMETER_NOT_LAST:
137*cdf0e10cSrcweir         return "no parameters may follow a rest parameter";
138*cdf0e10cSrcweir     case EIDL_REST_PARAMETER_NOT_ANY:
139*cdf0e10cSrcweir         return "a rest parameter must be of type any";
140*cdf0e10cSrcweir     case EIDL_METHOD_HAS_REST_PARAMETER:
141*cdf0e10cSrcweir         return "a rest parameter may not be used on an interface method";
142*cdf0e10cSrcweir     case EIDL_READONLY_ATTRIBUTE_SET_EXCEPTIONS:
143*cdf0e10cSrcweir         return "a readonly attribute may not have a setter raises clause";
144*cdf0e10cSrcweir     case EIDL_UNSIGNED_TYPE_ARGUMENT:
145*cdf0e10cSrcweir         return "an unsigned type cannot be used as a type argument";
146*cdf0e10cSrcweir     case EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS:
147*cdf0e10cSrcweir         return
148*cdf0e10cSrcweir             "the number of given type arguments does not match the expected"
149*cdf0e10cSrcweir             " number of type parameters";
150*cdf0e10cSrcweir     case EIDL_INSTANTIATED_STRUCT_TYPE_TYPEDEF:
151*cdf0e10cSrcweir         return
152*cdf0e10cSrcweir             "an instantiated polymorphic struct type cannot be used in a"
153*cdf0e10cSrcweir             " typedef";
154*cdf0e10cSrcweir     case EIDL_IDENTICAL_TYPE_PARAMETERS:
155*cdf0e10cSrcweir         return "two type parameters have the same name";
156*cdf0e10cSrcweir     case EIDL_STRUCT_TYPE_TEMPLATE_WITH_BASE:
157*cdf0e10cSrcweir         return "a polymorphic struct type template may not have a base type";
158*cdf0e10cSrcweir     case EIDL_PUBLISHED_FORWARD:
159*cdf0e10cSrcweir         return
160*cdf0e10cSrcweir             "a published forward declaration of an interface type cannot be"
161*cdf0e10cSrcweir             " followed by an unpublished declaration of that type";
162*cdf0e10cSrcweir     case EIDL_PUBLISHED_USES_UNPUBLISHED:
163*cdf0e10cSrcweir         return
164*cdf0e10cSrcweir             "an unpublished entity cannot be used in the declaration of a"
165*cdf0e10cSrcweir             " published entity: ";
166*cdf0e10cSrcweir     case EIDL_SIMILAR_CONSTRUCTORS:
167*cdf0e10cSrcweir         return "two constructors have identical lists of parameter types";
168*cdf0e10cSrcweir 	}
169*cdf0e10cSrcweir 	return "unknown errror";
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir static const sal_Char* warningCodeToMessage(WarningCode wCode)
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir 	switch (wCode)
175*cdf0e10cSrcweir 	{
176*cdf0e10cSrcweir 	case WIDL_EXPID_CONFLICT:
177*cdf0e10cSrcweir 		return "exception id conflict: ";
178*cdf0e10cSrcweir 	case WIDL_REQID_CONFLICT:
179*cdf0e10cSrcweir 		return "request id conflict: ";
180*cdf0e10cSrcweir 	case WIDL_INHERIT_IDCONFLICT:
181*cdf0e10cSrcweir 		return "request id conflict in inheritance tree: ";
182*cdf0e10cSrcweir 	case WIDL_TYPE_IDENT_CONFLICT:
183*cdf0e10cSrcweir 		return "type and parameter|member name are equal: ";
184*cdf0e10cSrcweir 	case WIDL_WRONG_NAMING_CONV:
185*cdf0e10cSrcweir 		return "type or identifier doesn't fulfill the UNO naming convention: ";
186*cdf0e10cSrcweir 	}
187*cdf0e10cSrcweir 	return "unkown warning";
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir static const sal_Char* parseStateToMessage(ParseState state)
191*cdf0e10cSrcweir {
192*cdf0e10cSrcweir 	switch (state)
193*cdf0e10cSrcweir 	{
194*cdf0e10cSrcweir 	case PS_NoState:
195*cdf0e10cSrcweir 		return "Statement can not be parsed";
196*cdf0e10cSrcweir 	case PS_TypeDeclSeen:
197*cdf0e10cSrcweir 		return "Malformed type declaration";
198*cdf0e10cSrcweir 	case PS_ConstantDeclSeen:
199*cdf0e10cSrcweir 		return "Malformed const declaration";
200*cdf0e10cSrcweir 	case PS_ExceptionDeclSeen:
201*cdf0e10cSrcweir 		return "Malformed exception declaration";
202*cdf0e10cSrcweir 	case PS_InterfaceDeclSeen:
203*cdf0e10cSrcweir 		return "Malformed interface declaration";
204*cdf0e10cSrcweir 	case PS_ServiceDeclSeen:
205*cdf0e10cSrcweir 		return "Malformed servicve declaration";
206*cdf0e10cSrcweir 	case PS_ModuleDeclSeen:
207*cdf0e10cSrcweir 		return "Malformed module declaration";
208*cdf0e10cSrcweir 	case PS_AttributeDeclSeen:
209*cdf0e10cSrcweir 		return "Malformed attribute declaration";
210*cdf0e10cSrcweir 	case PS_PropertyDeclSeen:
211*cdf0e10cSrcweir 		return "Malformed property declaration";
212*cdf0e10cSrcweir 	case PS_OperationDeclSeen:
213*cdf0e10cSrcweir 		return "Malformed operation declaration";
214*cdf0e10cSrcweir 	case PS_InterfaceInheritanceDeclSeen:
215*cdf0e10cSrcweir 		return "Malformed interface inheritance declaration";
216*cdf0e10cSrcweir 	case PS_ConstantsDeclSeen:
217*cdf0e10cSrcweir 		return "Malformed constants declaration";
218*cdf0e10cSrcweir 	case PS_ServiceSeen:
219*cdf0e10cSrcweir 		return "Missing service identifier following SERVICE keyword";
220*cdf0e10cSrcweir 	case PS_ServiceIDSeen:
221*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following service identifier";
222*cdf0e10cSrcweir 	case PS_ServiceSqSeen:
223*cdf0e10cSrcweir 		return "Illegal syntax following service '{' opener";
224*cdf0e10cSrcweir 	case PS_ServiceBodySeen:
225*cdf0e10cSrcweir 		return "Illegal syntax following service '}' closer";
226*cdf0e10cSrcweir 	case PS_ServiceMemberSeen:
227*cdf0e10cSrcweir 		return "Illegal syntax following service member declaration";
228*cdf0e10cSrcweir 	case PS_ServiceIFHeadSeen:
229*cdf0e10cSrcweir 		return "Illegal syntax following header of an interface member";
230*cdf0e10cSrcweir 	case PS_ServiceSHeadSeen:
231*cdf0e10cSrcweir 		return "Illegal syntax following header of an service member";
232*cdf0e10cSrcweir 	case PS_ModuleSeen:
233*cdf0e10cSrcweir 		return "Missing module identifier following MODULE keyword";
234*cdf0e10cSrcweir 	case PS_ModuleIDSeen:
235*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following module identifier";
236*cdf0e10cSrcweir 	case PS_ModuleSqSeen:
237*cdf0e10cSrcweir 		return "Illegal syntax following module '{' opener";
238*cdf0e10cSrcweir 	case PS_ModuleQsSeen:
239*cdf0e10cSrcweir 		return "Illegal syntax following module '}' closer";
240*cdf0e10cSrcweir 	case PS_ModuleBodySeen:
241*cdf0e10cSrcweir 		return "Illegal syntax following module export(s)";
242*cdf0e10cSrcweir 	case PS_ConstantsSeen:
243*cdf0e10cSrcweir 		return "Missing constants identifier following CONSTANTS keyword";
244*cdf0e10cSrcweir 	case PS_ConstantsIDSeen:
245*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following constants identifier";
246*cdf0e10cSrcweir 	case PS_ConstantsSqSeen:
247*cdf0e10cSrcweir 		return "Illegal syntax following module '{' opener";
248*cdf0e10cSrcweir 	case PS_ConstantsQsSeen:
249*cdf0e10cSrcweir 		return "Illegal syntax following module '}' closer";
250*cdf0e10cSrcweir 	case PS_ConstantsBodySeen:
251*cdf0e10cSrcweir 		return "Illegal syntax following constants export(s)";
252*cdf0e10cSrcweir 	case PS_InterfaceSeen:
253*cdf0e10cSrcweir 		return "Missing interface identifier following INTERFACE keyword";
254*cdf0e10cSrcweir 	case PS_InterfaceIDSeen:
255*cdf0e10cSrcweir 		return "Illegal syntax following interface identifier";
256*cdf0e10cSrcweir 	case PS_InterfaceHeadSeen:
257*cdf0e10cSrcweir 		return "Illegal syntax following interface head";
258*cdf0e10cSrcweir 	case PS_InheritSpecSeen:
259*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following inheritance spec";
260*cdf0e10cSrcweir 	case PS_ForwardDeclSeen:
261*cdf0e10cSrcweir 		return "Missing ';' following forward interface declaration";
262*cdf0e10cSrcweir 	case PS_InterfaceSqSeen:
263*cdf0e10cSrcweir 		return "Illegal syntax following interface '{' opener";
264*cdf0e10cSrcweir 	case PS_InterfaceQsSeen:
265*cdf0e10cSrcweir 		return "Illegal syntax following interface '}' closer";
266*cdf0e10cSrcweir 	case PS_InterfaceBodySeen:
267*cdf0e10cSrcweir 		return "Illegal syntax following interface export(s)";
268*cdf0e10cSrcweir 	case PS_InheritColonSeen:
269*cdf0e10cSrcweir 		return "Illegal syntax following ':' starting inheritance list";
270*cdf0e10cSrcweir 	case PS_SNListCommaSeen:
271*cdf0e10cSrcweir 		return "Found illegal scoped name in scoped name list";
272*cdf0e10cSrcweir 	case PS_ScopedNameSeen:
273*cdf0e10cSrcweir 		return "Missing ',' following scoped name in scoped name list";
274*cdf0e10cSrcweir 	case PS_SN_IDSeen:
275*cdf0e10cSrcweir 		return "Illegal component in scoped name";
276*cdf0e10cSrcweir 	case PS_ScopeDelimSeen:
277*cdf0e10cSrcweir 		return "Illegal component in scoped name following '::'";
278*cdf0e10cSrcweir 	case PS_ConstSeen:
279*cdf0e10cSrcweir 		return "Missing type or illegal syntax following CONST keyword";
280*cdf0e10cSrcweir 	case PS_ConstTypeSeen:
281*cdf0e10cSrcweir 		return "Missing identifier or illegal syntax following const type";
282*cdf0e10cSrcweir 	case PS_ConstIDSeen:
283*cdf0e10cSrcweir 		return "Missing '=' or illegal syntax after const identifier";
284*cdf0e10cSrcweir 	case PS_ConstAssignSeen:
285*cdf0e10cSrcweir 		return "Missing value expr or illegal syntax following '='";
286*cdf0e10cSrcweir 	case PS_ConstExprSeen:
287*cdf0e10cSrcweir 		return "Missing ';' or illegal syntax following value expr in const";
288*cdf0e10cSrcweir 	case PS_TypedefSeen:
289*cdf0e10cSrcweir 		return "Missing type or illegal syntax following TYPEDEF keyword";
290*cdf0e10cSrcweir 	case PS_TypeSpecSeen:
291*cdf0e10cSrcweir 		return "Missing declarators or illegal syntax following type spec";
292*cdf0e10cSrcweir 	case PS_DeclaratorsSeen:
293*cdf0e10cSrcweir 		return "Illegal syntax following declarators in TYPEDEF declaration";
294*cdf0e10cSrcweir 	case PS_StructSeen:
295*cdf0e10cSrcweir 		return "Missing struct identifier following STRUCT keyword";
296*cdf0e10cSrcweir 	case PS_StructHeaderSeen:
297*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following struct inheritance spec";
298*cdf0e10cSrcweir 	case PS_StructIDSeen:
299*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following struct identifier";
300*cdf0e10cSrcweir 	case PS_StructSqSeen:
301*cdf0e10cSrcweir 		return "Illegal syntax following struct '{' opener";
302*cdf0e10cSrcweir 	case PS_StructQsSeen:
303*cdf0e10cSrcweir 		return "Illegal syntax following struct '}' closer";
304*cdf0e10cSrcweir 	case PS_StructBodySeen:
305*cdf0e10cSrcweir 		return "Illegal syntax following struct member(s)";
306*cdf0e10cSrcweir 	case PS_MemberTypeSeen:
307*cdf0e10cSrcweir 		return "Illegal syntax or missing identifier following member type";
308*cdf0e10cSrcweir 	case PS_MemberDeclsSeen:
309*cdf0e10cSrcweir 		return "Illegal syntax following member declarator(s)";
310*cdf0e10cSrcweir 	case PS_MemberDeclsCompleted:
311*cdf0e10cSrcweir 		return "Missing ',' between member decls of same type(?)";
312*cdf0e10cSrcweir 	case PS_UnionSeen:
313*cdf0e10cSrcweir 		return "Missing identifier following UNION keyword";
314*cdf0e10cSrcweir 	case PS_UnionIDSeen:
315*cdf0e10cSrcweir 		return "Illegal syntax following union identifier";
316*cdf0e10cSrcweir 	case PS_SwitchSeen:
317*cdf0e10cSrcweir 		return "Illegal syntax following SWITCH keyword";
318*cdf0e10cSrcweir 	case PS_SwitchOpenParSeen:
319*cdf0e10cSrcweir 		return "Illegal syntax following '(' in switch in union";
320*cdf0e10cSrcweir 	case PS_SwitchTypeSeen:
321*cdf0e10cSrcweir 		return "Illegal syntax following type decl in switch in union";
322*cdf0e10cSrcweir 	case PS_SwitchCloseParSeen:
323*cdf0e10cSrcweir 		return "Missing union '{' opener";
324*cdf0e10cSrcweir 	case PS_UnionSqSeen:
325*cdf0e10cSrcweir 		return "Illegal syntax following union '{' opener";
326*cdf0e10cSrcweir 	case PS_UnionQsSeen:
327*cdf0e10cSrcweir 		return "Illegal syntax following union '}' closer";
328*cdf0e10cSrcweir 	case PS_DefaultSeen:
329*cdf0e10cSrcweir 		return "Illegal syntax or missing ':' following DEFAULT keyword";
330*cdf0e10cSrcweir 	case PS_UnionLabelSeen:
331*cdf0e10cSrcweir 		return "Illegal syntax following branch label in union";
332*cdf0e10cSrcweir 	case PS_LabelColonSeen:
333*cdf0e10cSrcweir 		return "Illegal syntax following ':' in branch label in union";
334*cdf0e10cSrcweir 	case PS_LabelExprSeen:
335*cdf0e10cSrcweir 		return "Illegal syntax following label expression in union";
336*cdf0e10cSrcweir 	case PS_UnionElemSeen:
337*cdf0e10cSrcweir 	case PS_UnionElemCompleted:
338*cdf0e10cSrcweir 		return "Illegal syntax following union element";
339*cdf0e10cSrcweir 	case PS_CaseSeen:
340*cdf0e10cSrcweir 		return "Illegal syntax following CASE keyword in union";
341*cdf0e10cSrcweir 	case PS_UnionElemTypeSeen:
342*cdf0e10cSrcweir 		return "Illegal syntax following type decl in union element";
343*cdf0e10cSrcweir 	case PS_UnionElemDeclSeen:
344*cdf0e10cSrcweir 		return "Illegal syntax following declarator in union element";
345*cdf0e10cSrcweir 	case PS_UnionBodySeen:
346*cdf0e10cSrcweir 		return "Illegal syntax following union body statement(s)";
347*cdf0e10cSrcweir 	case PS_EnumSeen:
348*cdf0e10cSrcweir 		return "Illegal syntax or missing identifier following ENUM keyword";
349*cdf0e10cSrcweir 	case PS_EnumIDSeen:
350*cdf0e10cSrcweir 		return "Illegal syntax or missing '{' following enum identifier";
351*cdf0e10cSrcweir 	case PS_EnumSqSeen:
352*cdf0e10cSrcweir 		return "Illegal syntax following enum '{' opener";
353*cdf0e10cSrcweir 	case PS_EnumQsSeen:
354*cdf0e10cSrcweir 		return "Illegal syntax following enum '}' closer";
355*cdf0e10cSrcweir 	case PS_EnumBodySeen:
356*cdf0e10cSrcweir 		return "Illegal syntax following enum enumerator(s)";
357*cdf0e10cSrcweir 	case PS_EnumCommaSeen:
358*cdf0e10cSrcweir 		return "Illegal syntax or missing identifier following ',' in enum";
359*cdf0e10cSrcweir 	case PS_SequenceSeen:
360*cdf0e10cSrcweir 		return "Illegal syntax or missing '<' following SEQUENCE keyword";
361*cdf0e10cSrcweir 	case PS_SequenceSqSeen:
362*cdf0e10cSrcweir 		return "Illegal syntax or missing type following '<' in sequence";
363*cdf0e10cSrcweir 	case PS_SequenceQsSeen:
364*cdf0e10cSrcweir 		return "Illegal syntax following '>' in sequence";
365*cdf0e10cSrcweir 	case PS_SequenceTypeSeen:
366*cdf0e10cSrcweir 		return "Illegal syntax following sequence type declaration";
367*cdf0e10cSrcweir 	case PS_ArrayIDSeen:
368*cdf0e10cSrcweir 		return "Illegal syntax or missing dimensions after array identifier";
369*cdf0e10cSrcweir 	case PS_ArrayCompleted:
370*cdf0e10cSrcweir 		return "Illegal syntax after array declaration";
371*cdf0e10cSrcweir 	case PS_DimSqSeen:
372*cdf0e10cSrcweir 		return "Illegal syntax or missing size expr after '[' in array declaration";
373*cdf0e10cSrcweir 	case PS_DimQsSeen:
374*cdf0e10cSrcweir 		return "Illegal syntax after ']' in array declaration";
375*cdf0e10cSrcweir 	case PS_DimExprSeen:
376*cdf0e10cSrcweir 		return "Illegal syntax or missing ']' after size expr in array declaration";
377*cdf0e10cSrcweir 	case PS_FlagHeaderSeen:
378*cdf0e10cSrcweir 		return "Illegal syntax after flags";
379*cdf0e10cSrcweir 	case PS_AttrSeen:
380*cdf0e10cSrcweir 		return "Illegal syntax after ATTRIBUTE keyword";
381*cdf0e10cSrcweir 	case PS_AttrTypeSeen:
382*cdf0e10cSrcweir 		return "Illegal syntax after type in attribute declaration";
383*cdf0e10cSrcweir 	case PS_AttrCompleted:
384*cdf0e10cSrcweir 		return "Illegal syntax after attribute declaration";
385*cdf0e10cSrcweir 	case PS_ReadOnlySeen:
386*cdf0e10cSrcweir 		return "Illegal syntax after READONLY keyword";
387*cdf0e10cSrcweir 	case PS_OptionalSeen:
388*cdf0e10cSrcweir 		return "Illegal syntax after OPTIONAL keyword";
389*cdf0e10cSrcweir 	case PS_MayBeVoidSeen:
390*cdf0e10cSrcweir 		return "Illegal syntax after MAYBEVOID keyword";
391*cdf0e10cSrcweir 	case PS_BoundSeen:
392*cdf0e10cSrcweir 		return "Illegal syntax after BOUND keyword";
393*cdf0e10cSrcweir 	case PS_ConstrainedSeen:
394*cdf0e10cSrcweir 		return "Illegal syntax after CONSTRAINED keyword";
395*cdf0e10cSrcweir 	case PS_TransientSeen:
396*cdf0e10cSrcweir 		return "Illegal syntax after TRANSIENT keyword";
397*cdf0e10cSrcweir 	case PS_MayBeAmbigiousSeen:
398*cdf0e10cSrcweir 		return "Illegal syntax after MAYBEAMBIGIOUS keyword";
399*cdf0e10cSrcweir 	case PS_MayBeDefaultSeen:
400*cdf0e10cSrcweir 		return "Illegal syntax after MAYBEDEFAULT keyword";
401*cdf0e10cSrcweir 	case PS_RemoveableSeen:
402*cdf0e10cSrcweir 		return "Illegal syntax after REMOVEABLE keyword";
403*cdf0e10cSrcweir 	case PS_PropertySeen:
404*cdf0e10cSrcweir 		return "Illegal syntax after PROPERTY keyword";
405*cdf0e10cSrcweir 	case PS_PropertyTypeSeen:
406*cdf0e10cSrcweir 		return "Illegal syntax after type in property declaration";
407*cdf0e10cSrcweir 	case PS_PropertyCompleted:
408*cdf0e10cSrcweir 		return "Illegal syntax after property declaration";
409*cdf0e10cSrcweir 	case PS_ExceptSeen:
410*cdf0e10cSrcweir 		return "Illegal syntax or missing identifier after EXCEPTION keyword";
411*cdf0e10cSrcweir 	case PS_ExceptHeaderSeen:
412*cdf0e10cSrcweir 		return "Missing '{' or illegal syntax following exception inheritance spec";
413*cdf0e10cSrcweir 	case PS_ExceptIDSeen:
414*cdf0e10cSrcweir 		return "Illegal syntax or missing '{' after exception identifier";
415*cdf0e10cSrcweir 	case PS_ExceptSqSeen:
416*cdf0e10cSrcweir 		return "Illegal syntax after exception '{' opener";
417*cdf0e10cSrcweir 	case PS_ExceptQsSeen:
418*cdf0e10cSrcweir 		return "Illegal syntax after exception '}' closer";
419*cdf0e10cSrcweir 	case PS_ExceptBodySeen:
420*cdf0e10cSrcweir 		return "Illegal syntax after exception member(s)";
421*cdf0e10cSrcweir 	case PS_OpHeadSeen:
422*cdf0e10cSrcweir 		return "Illegasl syntax after operation header";
423*cdf0e10cSrcweir 	case PS_OpTypeSeen:
424*cdf0e10cSrcweir 		return "Illegal syntax or missing identifier after operation type";
425*cdf0e10cSrcweir 	case PS_OpIDSeen:
426*cdf0e10cSrcweir 		return "Illegal syntax or missing '(' after operation identifier";
427*cdf0e10cSrcweir 	case PS_OpParsCompleted:
428*cdf0e10cSrcweir 		return "Illegal syntax after operation parameter list";
429*cdf0e10cSrcweir 	case PS_OpCompleted:
430*cdf0e10cSrcweir 		return "Illegal syntax after operation declaration";
431*cdf0e10cSrcweir 	case PS_OpSqSeen:
432*cdf0e10cSrcweir 		return "Illegal syntax after operation parameter list '(' opener";
433*cdf0e10cSrcweir 	case PS_OpQsSeen:
434*cdf0e10cSrcweir 		return "Illegal syntax after operation parameter list ')' closer";
435*cdf0e10cSrcweir 	case PS_OpParCommaSeen:
436*cdf0e10cSrcweir 		return "Illegal syntax or missing direction in parameter declaration";
437*cdf0e10cSrcweir 	case PS_OpParDirSeen:
438*cdf0e10cSrcweir 		return "Illegal syntax or missing type in parameter declaration";
439*cdf0e10cSrcweir 	case PS_OpParTypeSeen:
440*cdf0e10cSrcweir 		return "Illegal syntax or missing declarator in parameter declaration";
441*cdf0e10cSrcweir 	case PS_OpParDeclSeen:
442*cdf0e10cSrcweir 		return "Illegal syntax following parameter declarator";
443*cdf0e10cSrcweir 	case PS_OpOnewaySeen:
444*cdf0e10cSrcweir 		return "Illegal syntax after ONEWAY keyword";
445*cdf0e10cSrcweir 	case PS_RaiseSeen:
446*cdf0e10cSrcweir 		return "Illegal syntax or missing '(' after RAISES keyword";
447*cdf0e10cSrcweir 	case PS_RaiseSqSeen:
448*cdf0e10cSrcweir 		return "Illegal syntax after RAISES '(' opener";
449*cdf0e10cSrcweir 	case PS_RaiseQsSeen:
450*cdf0e10cSrcweir 		return "Illegal syntax after RAISES ')' closer";
451*cdf0e10cSrcweir 	case PS_DeclsCommaSeen:
452*cdf0e10cSrcweir 		return "Illegal syntax after ',' in declarators list";
453*cdf0e10cSrcweir 	case PS_DeclsDeclSeen:
454*cdf0e10cSrcweir 		return "Illegal syntax after declarator in declarators list";
455*cdf0e10cSrcweir     default:
456*cdf0e10cSrcweir         return "no wider described syntax error";
457*cdf0e10cSrcweir 	}
458*cdf0e10cSrcweir }
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir static OString flagToString(sal_uInt32 flag)
461*cdf0e10cSrcweir {
462*cdf0e10cSrcweir 	OString flagStr;
463*cdf0e10cSrcweir 	if ( (flag & AF_READONLY) == AF_READONLY )
464*cdf0e10cSrcweir 		flagStr += "'readonly'";
465*cdf0e10cSrcweir 	if ( (flag & AF_OPTIONAL) == AF_OPTIONAL )
466*cdf0e10cSrcweir 		flagStr += "'optional'";
467*cdf0e10cSrcweir 	if ( (flag & AF_MAYBEVOID) == AF_MAYBEVOID )
468*cdf0e10cSrcweir 		flagStr += "'maybevoid'";
469*cdf0e10cSrcweir 	if ( (flag & AF_BOUND) == AF_BOUND )
470*cdf0e10cSrcweir 		flagStr += "'bound'";
471*cdf0e10cSrcweir 	if ( (flag & AF_CONSTRAINED) == AF_CONSTRAINED )
472*cdf0e10cSrcweir 		flagStr += "'constrained'";
473*cdf0e10cSrcweir 	if ( (flag & AF_TRANSIENT) == AF_TRANSIENT )
474*cdf0e10cSrcweir 			flagStr += "'transient'";
475*cdf0e10cSrcweir 	if ( (flag & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS )
476*cdf0e10cSrcweir 		flagStr += "'maybeambiguous'";
477*cdf0e10cSrcweir 	if ( (flag & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT )
478*cdf0e10cSrcweir 		flagStr += "'maybedefault'";
479*cdf0e10cSrcweir 	if ( (flag & AF_REMOVEABLE) == AF_REMOVEABLE )
480*cdf0e10cSrcweir 		flagStr += "'removeable'";
481*cdf0e10cSrcweir 	if ( (flag & AF_ATTRIBUTE) == AF_ATTRIBUTE )
482*cdf0e10cSrcweir 		flagStr += "'attribute'";
483*cdf0e10cSrcweir 	if ( (flag & AF_PROPERTY) == AF_PROPERTY )
484*cdf0e10cSrcweir 		flagStr += "'property'";
485*cdf0e10cSrcweir 	if ( !flagStr.getLength() )
486*cdf0e10cSrcweir 		flagStr += "'unknown'";
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 	return flagStr;
489*cdf0e10cSrcweir }
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir static void errorHeader(ErrorCode eCode, sal_Int32 lineNumber)
492*cdf0e10cSrcweir {
493*cdf0e10cSrcweir 	OString file;
494*cdf0e10cSrcweir 	if ( idlc()->getFileName() == idlc()->getRealFileName() )
495*cdf0e10cSrcweir 		file = idlc()->getMainFileName();
496*cdf0e10cSrcweir 	else
497*cdf0e10cSrcweir 		file = idlc()->getFileName();
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 	fprintf(stderr, "%s(%lu) : %s", file.getStr(),
500*cdf0e10cSrcweir             sal::static_int_cast< unsigned long >(lineNumber),
501*cdf0e10cSrcweir 		    errorCodeToMessage(eCode));
502*cdf0e10cSrcweir }
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir static void errorHeader(ErrorCode eCode)
505*cdf0e10cSrcweir {
506*cdf0e10cSrcweir 	errorHeader(eCode, idlc()->getLineNumber());
507*cdf0e10cSrcweir }
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir static void warningHeader(WarningCode wCode)
510*cdf0e10cSrcweir {
511*cdf0e10cSrcweir 	OString file;
512*cdf0e10cSrcweir 	if ( idlc()->getFileName() == idlc()->getRealFileName() )
513*cdf0e10cSrcweir 		file = idlc()->getMainFileName();
514*cdf0e10cSrcweir 	else
515*cdf0e10cSrcweir 		file = idlc()->getFileName();
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir 	fprintf(stderr, "%s(%lu) : WARNING, %s", file.getStr(),
518*cdf0e10cSrcweir             sal::static_int_cast< unsigned long >(idlc()->getLineNumber()),
519*cdf0e10cSrcweir 		    warningCodeToMessage(wCode));
520*cdf0e10cSrcweir }
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir void ErrorHandler::error0(ErrorCode e)
523*cdf0e10cSrcweir {
524*cdf0e10cSrcweir 	errorHeader(e);
525*cdf0e10cSrcweir 	fprintf(stderr, "\n");
526*cdf0e10cSrcweir 	idlc()->incErrorCount();
527*cdf0e10cSrcweir }
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir void ErrorHandler::error1(ErrorCode e, AstDeclaration const * d)
530*cdf0e10cSrcweir {
531*cdf0e10cSrcweir 	errorHeader(e);
532*cdf0e10cSrcweir 	fprintf(stderr, "'%s'\n", d->getScopedName().getStr());
533*cdf0e10cSrcweir 	idlc()->incErrorCount();
534*cdf0e10cSrcweir }
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir void ErrorHandler::error2(
537*cdf0e10cSrcweir     ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2)
538*cdf0e10cSrcweir {
539*cdf0e10cSrcweir 	errorHeader(e);
540*cdf0e10cSrcweir 	fprintf(stderr, "'%s', '%s'\n", d1->getScopedName().getStr(),
541*cdf0e10cSrcweir 			d2->getScopedName().getStr());
542*cdf0e10cSrcweir 	idlc()->incErrorCount();
543*cdf0e10cSrcweir }
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir void ErrorHandler::error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3)
546*cdf0e10cSrcweir {
547*cdf0e10cSrcweir 	errorHeader(e);
548*cdf0e10cSrcweir 	fprintf(stderr, "'%s', '%s', '%s'\n", d1->getScopedName().getStr(),
549*cdf0e10cSrcweir 			d2->getScopedName().getStr(), d3->getScopedName().getStr());
550*cdf0e10cSrcweir 	idlc()->incErrorCount();
551*cdf0e10cSrcweir }
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir void ErrorHandler::warning0(WarningCode w, const sal_Char* warningmsg)
554*cdf0e10cSrcweir {
555*cdf0e10cSrcweir     if ( idlc()->getOptions()->isValid("-w") || idlc()->getOptions()->isValid("-we") ) {
556*cdf0e10cSrcweir         warningHeader(w);
557*cdf0e10cSrcweir         fprintf(stderr, "%s\n", warningmsg);
558*cdf0e10cSrcweir     }
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir     if ( idlc()->getOptions()->isValid("-we") )
561*cdf0e10cSrcweir         idlc()->incErrorCount();
562*cdf0e10cSrcweir     else
563*cdf0e10cSrcweir         idlc()->incWarningCount();
564*cdf0e10cSrcweir }
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir void ErrorHandler::syntaxError(ParseState ps, sal_Int32 lineNumber, const sal_Char* errmsg)
567*cdf0e10cSrcweir {
568*cdf0e10cSrcweir 	errorHeader(EIDL_SYNTAX_ERROR, lineNumber);
569*cdf0e10cSrcweir 	fprintf(stderr, "%s: %s\n", parseStateToMessage(ps), errmsg);
570*cdf0e10cSrcweir 	idlc()->incErrorCount();
571*cdf0e10cSrcweir }
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir void ErrorHandler::coercionError(AstExpression *pExpr, ExprType et)
574*cdf0e10cSrcweir {
575*cdf0e10cSrcweir 	errorHeader(EIDL_COERCION_FAILURE);
576*cdf0e10cSrcweir 	fprintf(stderr, "'%s' to '%s'\n", pExpr->toString().getStr(),
577*cdf0e10cSrcweir 			exprTypeToString(et));
578*cdf0e10cSrcweir 	idlc()->incErrorCount();
579*cdf0e10cSrcweir }
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir void ErrorHandler::lookupError(const ::rtl::OString& n)
582*cdf0e10cSrcweir {
583*cdf0e10cSrcweir 	errorHeader(EIDL_LOOKUP_ERROR);
584*cdf0e10cSrcweir 	fprintf(stderr, "'%s'\n", n.getStr());
585*cdf0e10cSrcweir 	idlc()->incErrorCount();
586*cdf0e10cSrcweir }
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir void ErrorHandler::lookupError(ErrorCode e, const ::rtl::OString& n, AstDeclaration* pScope)
589*cdf0e10cSrcweir {
590*cdf0e10cSrcweir 	errorHeader(e);
591*cdf0e10cSrcweir 	fprintf(stderr, "'%s' in '%s'\n", n.getStr(), pScope->getFullName().getStr());
592*cdf0e10cSrcweir 	idlc()->incErrorCount();
593*cdf0e10cSrcweir }
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir void ErrorHandler::flagError(ErrorCode e, sal_uInt32 flag)
596*cdf0e10cSrcweir {
597*cdf0e10cSrcweir 	errorHeader(e);
598*cdf0e10cSrcweir 	fprintf(stderr, "'%s'\n", flagToString(flag).getStr());
599*cdf0e10cSrcweir 	idlc()->incErrorCount();
600*cdf0e10cSrcweir }
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir void ErrorHandler::noTypeError(AstDeclaration const * pDecl)
603*cdf0e10cSrcweir {
604*cdf0e10cSrcweir 	errorHeader(EIDL_NOT_A_TYPE);
605*cdf0e10cSrcweir 	fprintf(stderr, "'%s'\n", pDecl->getScopedName().getStr());
606*cdf0e10cSrcweir 	idlc()->incErrorCount();
607*cdf0e10cSrcweir }
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir namespace {
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir char const * nodeTypeName(NodeType nodeType) {
612*cdf0e10cSrcweir     switch (nodeType) {
613*cdf0e10cSrcweir     case NT_interface:
614*cdf0e10cSrcweir         return "interface";
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir     case NT_exception:
617*cdf0e10cSrcweir         return "exception";
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir     case NT_struct:
620*cdf0e10cSrcweir         return "struct";
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir     default:
623*cdf0e10cSrcweir         return "";
624*cdf0e10cSrcweir     }
625*cdf0e10cSrcweir }
626*cdf0e10cSrcweir 
627*cdf0e10cSrcweir }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir void ErrorHandler::inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl)
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir 	if ( nodeType == NT_interface &&
632*cdf0e10cSrcweir          (pDecl->getNodeType() == NT_interface) &&
633*cdf0e10cSrcweir 		 !((AstInterface*)pDecl)->isDefined() )
634*cdf0e10cSrcweir 	{
635*cdf0e10cSrcweir 		errorHeader(EIDL_INHERIT_FWD_ERROR);
636*cdf0e10cSrcweir 		fprintf(stderr, "interface '%s' cannot inherit from forward declared interface '%s'\n",
637*cdf0e10cSrcweir 				name->getStr(), pDecl->getScopedName().getStr());
638*cdf0e10cSrcweir 	} else
639*cdf0e10cSrcweir 	{
640*cdf0e10cSrcweir 		errorHeader(EIDL_CANT_INHERIT);
641*cdf0e10cSrcweir 		fprintf(stderr, "%s '%s' from '%s'\n",
642*cdf0e10cSrcweir 				nodeTypeName(nodeType), name->getStr(),
643*cdf0e10cSrcweir                 pDecl->getScopedName().getStr());
644*cdf0e10cSrcweir 	}
645*cdf0e10cSrcweir 	idlc()->incErrorCount();
646*cdf0e10cSrcweir }
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir void ErrorHandler::forwardLookupError(AstDeclaration* pForward,
649*cdf0e10cSrcweir 									  const ::rtl::OString& name)
650*cdf0e10cSrcweir {
651*cdf0e10cSrcweir 	errorHeader(EIDL_FWD_DECL_LOOKUP);
652*cdf0e10cSrcweir 	fprintf(stderr, "trying to look up '%s' in undefined forward declared interface '%s'\n",
653*cdf0e10cSrcweir 			pForward->getScopedName().getStr(), name.getStr());
654*cdf0e10cSrcweir 	idlc()->incErrorCount();
655*cdf0e10cSrcweir }
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir void ErrorHandler::constantExpected(AstDeclaration* pDecl,
658*cdf0e10cSrcweir 									const ::rtl::OString& name)
659*cdf0e10cSrcweir {
660*cdf0e10cSrcweir 	errorHeader(EIDL_CONSTANT_EXPECTED);
661*cdf0e10cSrcweir 	fprintf(stderr, "'%s' is bound to '%s'\n", name.getStr(), pDecl->getScopedName().getStr());
662*cdf0e10cSrcweir 	idlc()->incErrorCount();
663*cdf0e10cSrcweir }
664*cdf0e10cSrcweir 
665*cdf0e10cSrcweir void ErrorHandler::evalError(AstExpression* pExpr)
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir 	errorHeader(EIDL_EVAL_ERROR);
668*cdf0e10cSrcweir 	fprintf(stderr, "'%s'\n", pExpr->toString().getStr());
669*cdf0e10cSrcweir 	idlc()->incErrorCount();
670*cdf0e10cSrcweir }
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir void ErrorHandler::enumValExpected(AstUnion* pUnion)
673*cdf0e10cSrcweir {
674*cdf0e10cSrcweir 	errorHeader(EIDL_ENUM_VAL_EXPECTED);
675*cdf0e10cSrcweir 	fprintf(stderr, " union %s\n", pUnion->getLocalName().getStr());
676*cdf0e10cSrcweir 	idlc()->incErrorCount();
677*cdf0e10cSrcweir }
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir void ErrorHandler::enumValLookupFailure(AstUnion* pUnion, AstEnum* pEnum, const ::rtl::OString& name)
680*cdf0e10cSrcweir {
681*cdf0e10cSrcweir 	errorHeader(EIDL_ENUM_VAL_NOT_FOUND);
682*cdf0e10cSrcweir 	fprintf(stderr, " union %s, enum %s, enumerator %s\n",
683*cdf0e10cSrcweir 			pUnion->getLocalName().getStr(),
684*cdf0e10cSrcweir 			pEnum->getLocalName().getStr(), name.getStr());
685*cdf0e10cSrcweir 	idlc()->incErrorCount();
686*cdf0e10cSrcweir }
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir bool ErrorHandler::checkPublished(AstDeclaration const * decl, bool bOptional) {
689*cdf0e10cSrcweir     if (idlc()->isPublished() && !decl->isPublished() && !bOptional) {
690*cdf0e10cSrcweir         error1(EIDL_PUBLISHED_USES_UNPUBLISHED, decl);
691*cdf0e10cSrcweir         return false;
692*cdf0e10cSrcweir     } else {
693*cdf0e10cSrcweir         return true;
694*cdf0e10cSrcweir     }
695*cdf0e10cSrcweir }
696