Impress: Implement getPartName.
[LibreOffice.git] / idlc / source / errorhandler.cxx
blob6a99b669e72fcac66996b6d1083af2cfeb2e07ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <idlc/errorhandler.hxx>
21 #include <idlc/astinterface.hxx>
23 using namespace ::rtl;
25 static const sal_Char* errorCodeToMessage(ErrorCode eCode)
27 switch (eCode)
29 case EIDL_NONE:
30 return "all is fine ";
31 case EIDL_SYNTAX_ERROR:
32 return "";
33 case EIDL_REDEF:
34 return "illegal redefinition ";
35 case EIDL_REDEF_SCOPE:
36 return "illegal redefinition in scope ";
37 case EIDL_DEF_USE:
38 return "redefinition after use, ";
39 case EIDL_COERCION_FAILURE:
40 return "coercion failure ";
41 case EIDL_SCOPE_CONFLICT:
42 return "definition scope is different than fwd declare scope, ";
43 case EIDL_ILLEGAL_ADD:
44 return "illegal add operation, ";
45 case EIDL_ILLEGAL_USE:
46 return "illegal type used in expression, ";
47 case EIDL_ILLEGAL_RAISES:
48 return "non-exception type in raises(..) clause, ";
49 case EIDL_CANT_INHERIT:
50 return "cannot inherit ";
51 case EIDL_LOOKUP_ERROR:
52 return "error in lookup of symbol: ";
53 case EIDL_INHERIT_FWD_ERROR:
54 return "";
55 case EIDL_CONSTANT_EXPECTED:
56 return "constant expected: ";
57 case EIDL_NAME_CASE_ERROR:
58 return "identifier used with two differing spellings: ";
59 case EIDL_EVAL_ERROR:
60 return "expression evaluation error: ";
61 case EIDL_AMBIGUOUS:
62 return "ambiguous definition: ";
63 case EIDL_DECL_NOT_DEFINED:
64 return "forward declared but never defined: ";
65 case EIDL_FWD_DECL_LOOKUP:
66 return "";
67 case EIDL_RECURSIVE_TYPE:
68 return "illegal recursive use of type: ";
69 case EIDL_NOT_A_TYPE:
70 return "specified symbol is not a type: ";
71 case EIDL_TYPE_NOT_VALID:
72 return "specified type is not valid in this context: ";
73 case EIDL_INTERFACEMEMBER_LOOKUP:
74 return "error in lookup of symbol, expected interface is not defined and no forward exists: ";
75 case EIDL_SERVICEMEMBER_LOOKUP:
76 return "error in lookup of symbol, expected service is not defined: ";
77 case EIDL_TYPE_IDENT_CONFLICT:
78 return "type and parameter/member name are equal: ";
79 case EIDL_WRONGATTRIBUTEFLAG:
80 return "the used flag is not valid in this context: ";
81 case EIDL_DEFINED_ATTRIBUTEFLAG:
82 return "flag is already set: ";
83 case EIDL_WRONGATTRIBUTEKEYWORD:
84 return "keyword not allowed: ";
85 case EIDL_MISSINGATTRIBUTEKEYWORD:
86 return "missing keyword: ";
87 case EIDL_BAD_ATTRIBUTE_FLAGS:
88 return
89 "the 'attribute' flag is mandatory, and only the 'bound' and"
90 " 'readonly' optional flags are accepted: ";
91 case EIDL_OPTIONALEXPECTED:
92 return "only the 'optional' flag is accepted: ";
93 case EIDL_MIXED_INHERITANCE:
94 return "interface inheritance declarations cannot appear in both an"
95 " interface's header and its body";
96 case EIDL_DOUBLE_INHERITANCE:
97 return
98 "interface is (directly or indirectly) inherited more than once: ";
99 case EIDL_DOUBLE_MEMBER:
100 return
101 "member is (directly or indirectly) declared more than once: ";
102 case EIDL_CONSTRUCTOR_PARAMETER_NOT_IN:
103 return
104 "a service constructor parameter may not be an out or inout"
105 " parameter";
106 case EIDL_CONSTRUCTOR_REST_PARAMETER_NOT_FIRST:
107 return
108 "no parameters may precede a rest parameter in a service"
109 " constructor";
110 case EIDL_REST_PARAMETER_NOT_LAST:
111 return "no parameters may follow a rest parameter";
112 case EIDL_REST_PARAMETER_NOT_ANY:
113 return "a rest parameter must be of type any";
114 case EIDL_METHOD_HAS_REST_PARAMETER:
115 return "a rest parameter may not be used on an interface method";
116 case EIDL_READONLY_ATTRIBUTE_SET_EXCEPTIONS:
117 return "a readonly attribute may not have a setter raises clause";
118 case EIDL_UNSIGNED_TYPE_ARGUMENT:
119 return "an unsigned type cannot be used as a type argument";
120 case EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS:
121 return
122 "the number of given type arguments does not match the expected"
123 " number of type parameters";
124 case EIDL_INSTANTIATED_STRUCT_TYPE_TYPEDEF:
125 return
126 "an instantiated polymorphic struct type cannot be used in a"
127 " typedef";
128 case EIDL_IDENTICAL_TYPE_PARAMETERS:
129 return "two type parameters have the same name";
130 case EIDL_STRUCT_TYPE_TEMPLATE_WITH_BASE:
131 return "a polymorphic struct type template may not have a base type";
132 case EIDL_PUBLISHED_FORWARD:
133 return
134 "a published forward declaration of an interface type cannot be"
135 " followed by an unpublished declaration of that type";
136 case EIDL_PUBLISHED_USES_UNPUBLISHED:
137 return
138 "an unpublished entity cannot be used in the declaration of a"
139 " published entity: ";
140 case EIDL_SIMILAR_CONSTRUCTORS:
141 return "two constructors have identical lists of parameter types";
143 return "unknown error";
146 static const sal_Char* warningCodeToMessage(WarningCode wCode)
148 switch (wCode)
150 case WIDL_EXPID_CONFLICT:
151 return "exception id conflict: ";
152 case WIDL_REQID_CONFLICT:
153 return "request id conflict: ";
154 case WIDL_INHERIT_IDCONFLICT:
155 return "request id conflict in inheritance tree: ";
156 case WIDL_TYPE_IDENT_CONFLICT:
157 return "type and parameter|member name are equal: ";
158 case WIDL_WRONG_NAMING_CONV:
159 return "type or identifier doesn't fulfill the UNO naming convention: ";
161 return "unknown warning";
164 static const sal_Char* parseStateToMessage(ParseState state)
166 switch (state)
168 case PS_NoState:
169 return "Statement can not be parsed";
170 case PS_TypeDeclSeen:
171 return "Malformed type declaration";
172 case PS_ConstantDeclSeen:
173 return "Malformed const declaration";
174 case PS_ExceptionDeclSeen:
175 return "Malformed exception declaration";
176 case PS_InterfaceDeclSeen:
177 return "Malformed interface declaration";
178 case PS_ServiceDeclSeen:
179 return "Malformed service declaration";
180 case PS_ModuleDeclSeen:
181 return "Malformed module declaration";
182 case PS_AttributeDeclSeen:
183 return "Malformed attribute declaration";
184 case PS_PropertyDeclSeen:
185 return "Malformed property declaration";
186 case PS_OperationDeclSeen:
187 return "Malformed operation declaration";
188 case PS_InterfaceInheritanceDeclSeen:
189 return "Malformed interface inheritance declaration";
190 case PS_ConstantsDeclSeen:
191 return "Malformed constants declaration";
192 case PS_ServiceSeen:
193 return "Missing service identifier following SERVICE keyword";
194 case PS_ServiceIDSeen:
195 return "Missing '{' or illegal syntax following service identifier";
196 case PS_ServiceSqSeen:
197 return "Illegal syntax following service '{' opener";
198 case PS_ServiceBodySeen:
199 return "Illegal syntax following service '}' closer";
200 case PS_ServiceMemberSeen:
201 return "Illegal syntax following service member declaration";
202 case PS_ServiceIFHeadSeen:
203 return "Illegal syntax following header of an interface member";
204 case PS_ServiceSHeadSeen:
205 return "Illegal syntax following header of an service member";
206 case PS_ModuleSeen:
207 return "Missing module identifier following MODULE keyword";
208 case PS_ModuleIDSeen:
209 return "Missing '{' or illegal syntax following module identifier";
210 case PS_ModuleSqSeen:
211 return "Illegal syntax following module '{' opener";
212 case PS_ModuleQsSeen:
213 return "Illegal syntax following module '}' closer";
214 case PS_ModuleBodySeen:
215 return "Illegal syntax following module export(s)";
216 case PS_ConstantsSeen:
217 return "Missing constants identifier following CONSTANTS keyword";
218 case PS_ConstantsIDSeen:
219 return "Missing '{' or illegal syntax following constants identifier";
220 case PS_ConstantsSqSeen:
221 return "Illegal syntax following module '{' opener";
222 case PS_ConstantsQsSeen:
223 return "Illegal syntax following module '}' closer";
224 case PS_ConstantsBodySeen:
225 return "Illegal syntax following constants export(s)";
226 case PS_InterfaceSeen:
227 return "Missing interface identifier following INTERFACE keyword";
228 case PS_InterfaceIDSeen:
229 return "Illegal syntax following interface identifier";
230 case PS_InterfaceHeadSeen:
231 return "Illegal syntax following interface head";
232 case PS_InheritSpecSeen:
233 return "Missing '{' or illegal syntax following inheritance spec";
234 case PS_ForwardDeclSeen:
235 return "Missing ';' following forward interface declaration";
236 case PS_InterfaceSqSeen:
237 return "Illegal syntax following interface '{' opener";
238 case PS_InterfaceQsSeen:
239 return "Illegal syntax following interface '}' closer";
240 case PS_InterfaceBodySeen:
241 return "Illegal syntax following interface export(s)";
242 case PS_InheritColonSeen:
243 return "Illegal syntax following ':' starting inheritance list";
244 case PS_SNListCommaSeen:
245 return "Found illegal scoped name in scoped name list";
246 case PS_ScopedNameSeen:
247 return "Missing ',' following scoped name in scoped name list";
248 case PS_SN_IDSeen:
249 return "Illegal component in scoped name";
250 case PS_ScopeDelimSeen:
251 return "Illegal component in scoped name following '::'";
252 case PS_ConstSeen:
253 return "Missing type or illegal syntax following CONST keyword";
254 case PS_ConstTypeSeen:
255 return "Missing identifier or illegal syntax following const type";
256 case PS_ConstIDSeen:
257 return "Missing '=' or illegal syntax after const identifier";
258 case PS_ConstAssignSeen:
259 return "Missing value expr or illegal syntax following '='";
260 case PS_ConstExprSeen:
261 return "Missing ';' or illegal syntax following value expr in const";
262 case PS_TypedefSeen:
263 return "Missing type or illegal syntax following TYPEDEF keyword";
264 case PS_TypeSpecSeen:
265 return "Missing declarators or illegal syntax following type spec";
266 case PS_DeclaratorsSeen:
267 return "Illegal syntax following declarators in TYPEDEF declaration";
268 case PS_StructSeen:
269 return "Missing struct identifier following STRUCT keyword";
270 case PS_StructHeaderSeen:
271 return "Missing '{' or illegal syntax following struct inheritance spec";
272 case PS_StructIDSeen:
273 return "Missing '{' or illegal syntax following struct identifier";
274 case PS_StructSqSeen:
275 return "Illegal syntax following struct '{' opener";
276 case PS_StructQsSeen:
277 return "Illegal syntax following struct '}' closer";
278 case PS_StructBodySeen:
279 return "Illegal syntax following struct member(s)";
280 case PS_MemberTypeSeen:
281 return "Illegal syntax or missing identifier following member type";
282 case PS_MemberDeclsSeen:
283 return "Illegal syntax following member declarator(s)";
284 case PS_MemberDeclsCompleted:
285 return "Missing ',' between member decls of same type(?)";
286 case PS_EnumSeen:
287 return "Illegal syntax or missing identifier following ENUM keyword";
288 case PS_EnumIDSeen:
289 return "Illegal syntax or missing '{' following enum identifier";
290 case PS_EnumSqSeen:
291 return "Illegal syntax following enum '{' opener";
292 case PS_EnumQsSeen:
293 return "Illegal syntax following enum '}' closer";
294 case PS_EnumBodySeen:
295 return "Illegal syntax following enum enumerator(s)";
296 case PS_EnumCommaSeen:
297 return "Illegal syntax or missing identifier following ',' in enum";
298 case PS_SequenceSeen:
299 return "Illegal syntax or missing '<' following SEQUENCE keyword";
300 case PS_SequenceSqSeen:
301 return "Illegal syntax or missing type following '<' in sequence";
302 case PS_SequenceQsSeen:
303 return "Illegal syntax following '>' in sequence";
304 case PS_SequenceTypeSeen:
305 return "Illegal syntax following sequence type declaration";
306 case PS_FlagHeaderSeen:
307 return "Illegal syntax after flags";
308 case PS_AttrSeen:
309 return "Illegal syntax after ATTRIBUTE keyword";
310 case PS_AttrTypeSeen:
311 return "Illegal syntax after type in attribute declaration";
312 case PS_AttrCompleted:
313 return "Illegal syntax after attribute declaration";
314 case PS_ReadOnlySeen:
315 return "Illegal syntax after READONLY keyword";
316 case PS_OptionalSeen:
317 return "Illegal syntax after OPTIONAL keyword";
318 case PS_MayBeVoidSeen:
319 return "Illegal syntax after MAYBEVOID keyword";
320 case PS_BoundSeen:
321 return "Illegal syntax after BOUND keyword";
322 case PS_ConstrainedSeen:
323 return "Illegal syntax after CONSTRAINED keyword";
324 case PS_TransientSeen:
325 return "Illegal syntax after TRANSIENT keyword";
326 case PS_MayBeAmbigiousSeen:
327 return "Illegal syntax after MAYBEAMBIGIOUS keyword";
328 case PS_MayBeDefaultSeen:
329 return "Illegal syntax after MAYBEDEFAULT keyword";
330 case PS_RemoveableSeen:
331 return "Illegal syntax after REMOVABLE keyword";
332 case PS_PropertySeen:
333 return "Illegal syntax after PROPERTY keyword";
334 case PS_PropertyTypeSeen:
335 return "Illegal syntax after type in property declaration";
336 case PS_PropertyCompleted:
337 return "Illegal syntax after property declaration";
338 case PS_ExceptSeen:
339 return "Illegal syntax or missing identifier after EXCEPTION keyword";
340 case PS_ExceptHeaderSeen:
341 return "Missing '{' or illegal syntax following exception inheritance spec";
342 case PS_ExceptIDSeen:
343 return "Illegal syntax or missing '{' after exception identifier";
344 case PS_ExceptSqSeen:
345 return "Illegal syntax after exception '{' opener";
346 case PS_ExceptQsSeen:
347 return "Illegal syntax after exception '}' closer";
348 case PS_ExceptBodySeen:
349 return "Illegal syntax after exception member(s)";
350 case PS_OpTypeSeen:
351 return "Illegal syntax or missing identifier after operation type";
352 case PS_OpIDSeen:
353 return "Illegal syntax or missing '(' after operation identifier";
354 case PS_OpParsCompleted:
355 return "Illegal syntax after operation parameter list";
356 case PS_OpCompleted:
357 return "Illegal syntax after operation declaration";
358 case PS_OpSqSeen:
359 return "Illegal syntax after operation parameter list '(' opener";
360 case PS_OpQsSeen:
361 return "Illegal syntax after operation parameter list ')' closer";
362 case PS_OpParCommaSeen:
363 return "Illegal syntax or missing direction in parameter declaration";
364 case PS_OpParDirSeen:
365 return "Illegal syntax or missing type in parameter declaration";
366 case PS_OpParTypeSeen:
367 return "Illegal syntax or missing declarator in parameter declaration";
368 case PS_OpParDeclSeen:
369 return "Illegal syntax following parameter declarator";
370 case PS_RaiseSeen:
371 return "Illegal syntax or missing '(' after RAISES keyword";
372 case PS_RaiseSqSeen:
373 return "Illegal syntax after RAISES '(' opener";
374 case PS_RaiseQsSeen:
375 return "Illegal syntax after RAISES ')' closer";
376 case PS_DeclsCommaSeen:
377 return "Illegal syntax after ',' in declarators list";
378 case PS_DeclsDeclSeen:
379 return "Illegal syntax after declarator in declarators list";
380 default:
381 return "no wider described syntax error";
385 static OString flagToString(sal_uInt32 flag)
387 OString flagStr;
388 if ( (flag & AF_READONLY) == AF_READONLY )
389 flagStr += "'readonly'";
390 if ( (flag & AF_OPTIONAL) == AF_OPTIONAL )
391 flagStr += "'optional'";
392 if ( (flag & AF_MAYBEVOID) == AF_MAYBEVOID )
393 flagStr += "'maybevoid'";
394 if ( (flag & AF_BOUND) == AF_BOUND )
395 flagStr += "'bound'";
396 if ( (flag & AF_CONSTRAINED) == AF_CONSTRAINED )
397 flagStr += "'constrained'";
398 if ( (flag & AF_TRANSIENT) == AF_TRANSIENT )
399 flagStr += "'transient'";
400 if ( (flag & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS )
401 flagStr += "'maybeambiguous'";
402 if ( (flag & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT )
403 flagStr += "'maybedefault'";
404 if ( (flag & AF_REMOVABLE) == AF_REMOVABLE )
405 flagStr += "'removable'";
406 if ( (flag & AF_ATTRIBUTE) == AF_ATTRIBUTE )
407 flagStr += "'attribute'";
408 if ( (flag & AF_PROPERTY) == AF_PROPERTY )
409 flagStr += "'property'";
410 if ( flagStr.isEmpty() )
411 flagStr += "'unknown'";
413 return flagStr;
416 static void errorHeader(ErrorCode eCode, sal_Int32 lineNumber, sal_uInt32 start, sal_uInt32 end)
418 OString file;
419 if ( idlc()->getFileName() == idlc()->getRealFileName() )
420 file = idlc()->getMainFileName();
421 else
422 file = idlc()->getFileName();
424 fprintf(stderr, "%s:%lu [%lu:%lu] : %s", file.getStr(),
425 sal::static_int_cast< unsigned long >(lineNumber),
426 sal::static_int_cast< unsigned long >(start),
427 sal::static_int_cast< unsigned long >(end),
428 errorCodeToMessage(eCode));
431 static void errorHeader(ErrorCode eCode, sal_uInt32 lineNumber)
433 errorHeader(eCode, lineNumber,
434 idlc()->getOffsetStart(), idlc()->getOffsetEnd());
437 static void errorHeader(ErrorCode eCode)
439 errorHeader(eCode, idlc()->getLineNumber(),
440 idlc()->getOffsetStart(), idlc()->getOffsetEnd());
443 static void warningHeader(WarningCode wCode)
445 OString file;
446 if ( idlc()->getFileName() == idlc()->getRealFileName() )
447 file = idlc()->getMainFileName();
448 else
449 file = idlc()->getFileName();
451 fprintf(stderr, "%s(%lu) : WARNING, %s", file.getStr(),
452 sal::static_int_cast< unsigned long >(idlc()->getLineNumber()),
453 warningCodeToMessage(wCode));
456 void ErrorHandler::error0(ErrorCode e)
458 errorHeader(e);
459 fprintf(stderr, "\n");
460 idlc()->incErrorCount();
463 void ErrorHandler::error1(ErrorCode e, AstDeclaration const * d)
465 errorHeader(e);
466 fprintf(stderr, "'%s'\n", d->getScopedName().getStr());
467 idlc()->incErrorCount();
470 void ErrorHandler::error2(
471 ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2)
473 errorHeader(e);
474 fprintf(stderr, "'%s', '%s'\n", d1->getScopedName().getStr(),
475 d2->getScopedName().getStr());
476 idlc()->incErrorCount();
479 void ErrorHandler::error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3)
481 errorHeader(e);
482 fprintf(stderr, "'%s', '%s', '%s'\n", d1->getScopedName().getStr(),
483 d2->getScopedName().getStr(), d3->getScopedName().getStr());
484 idlc()->incErrorCount();
487 void ErrorHandler::warning0(WarningCode w, const sal_Char* warningmsg)
489 if ( idlc()->getOptions()->isValid("-w") || idlc()->getOptions()->isValid("-we") ) {
490 warningHeader(w);
491 fprintf(stderr, "%s\n", warningmsg);
494 if ( idlc()->getOptions()->isValid("-we") )
495 idlc()->incErrorCount();
496 else
497 idlc()->incWarningCount();
500 void ErrorHandler::syntaxError(ParseState ps, sal_Int32 lineNumber, const sal_Char* errmsg)
502 errorHeader(EIDL_SYNTAX_ERROR, lineNumber);
503 fprintf(stderr, "%s: %s\n", parseStateToMessage(ps), errmsg);
504 idlc()->incErrorCount();
507 void ErrorHandler::coercionError(AstExpression *pExpr, ExprType et)
509 errorHeader(EIDL_COERCION_FAILURE);
510 fprintf(stderr, "'%s' to '%s'\n", pExpr->toString().getStr(),
511 exprTypeToString(et));
512 idlc()->incErrorCount();
515 void ErrorHandler::lookupError(const OString& n)
517 errorHeader(EIDL_LOOKUP_ERROR);
518 fprintf(stderr, "'%s'\n", n.getStr());
519 idlc()->incErrorCount();
522 void ErrorHandler::lookupError(ErrorCode e, const OString& n, AstDeclaration* pScope)
524 errorHeader(e);
525 fprintf(stderr, "'%s' in '%s'\n", n.getStr(), pScope->getFullName().getStr());
526 idlc()->incErrorCount();
529 void ErrorHandler::flagError(ErrorCode e, sal_uInt32 flag)
531 errorHeader(e);
532 fprintf(stderr, "'%s'\n", flagToString(flag).getStr());
533 idlc()->incErrorCount();
536 void ErrorHandler::noTypeError(AstDeclaration const * pDecl)
538 errorHeader(EIDL_NOT_A_TYPE);
539 fprintf(stderr, "'%s'\n", pDecl->getScopedName().getStr());
540 idlc()->incErrorCount();
543 namespace {
545 char const * nodeTypeName(NodeType nodeType) {
546 switch (nodeType) {
547 case NT_interface:
548 return "interface";
550 case NT_exception:
551 return "exception";
553 case NT_struct:
554 return "struct";
556 default:
557 return "";
563 void ErrorHandler::inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl)
565 if ( nodeType == NT_interface &&
566 (pDecl->getNodeType() == NT_interface) &&
567 !((AstInterface*)pDecl)->isDefined() )
569 errorHeader(EIDL_INHERIT_FWD_ERROR);
570 fprintf(stderr, "interface '%s' cannot inherit from forward declared interface '%s'\n",
571 name->getStr(), pDecl->getScopedName().getStr());
572 } else
574 errorHeader(EIDL_CANT_INHERIT);
575 fprintf(stderr, "%s '%s' from '%s'\n",
576 nodeTypeName(nodeType), name->getStr(),
577 pDecl->getScopedName().getStr());
579 idlc()->incErrorCount();
582 void ErrorHandler::forwardLookupError(AstDeclaration* pForward,
583 const OString& name)
585 errorHeader(EIDL_FWD_DECL_LOOKUP);
586 fprintf(stderr, "trying to look up '%s' in undefined forward declared interface '%s'\n",
587 pForward->getScopedName().getStr(), name.getStr());
588 idlc()->incErrorCount();
591 void ErrorHandler::constantExpected(AstDeclaration* pDecl,
592 const OString& name)
594 errorHeader(EIDL_CONSTANT_EXPECTED);
595 fprintf(stderr, "'%s' is bound to '%s'\n", name.getStr(), pDecl->getScopedName().getStr());
596 idlc()->incErrorCount();
599 void ErrorHandler::evalError(AstExpression* pExpr)
601 errorHeader(EIDL_EVAL_ERROR);
602 fprintf(stderr, "'%s'\n", pExpr->toString().getStr());
603 idlc()->incErrorCount();
606 bool ErrorHandler::checkPublished(AstDeclaration const * decl, bool bOptional) {
607 if (idlc()->isPublished() && !decl->isPublished() && !bOptional) {
608 error1(EIDL_PUBLISHED_USES_UNPUBLISHED, decl);
609 return false;
610 } else {
611 return true;
615 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */