1 #include "shapesexceptions.h"
5 #include "functiontypes.h"
7 using namespace Shapes
;
11 const std::string
Exceptions::additionalLinesPrefix
= "| ";
17 void prefixEachLine( const std::string
& prefix
, std::istream
& src
, std::ostream
& dst
);
18 void prefixEachLine( const std::string
& prefix
, const RefCountPtr
< const char > & src
, std::ostream
& dst
);
22 Exceptions::NotImplemented::NotImplemented( const char * _functionality
)
23 : functionality( _functionality
)
26 Exceptions::NotImplemented::~NotImplemented( )
30 Exceptions::NotImplemented::display( std::ostream
& os
) const
32 os
<< "Under construction: " << functionality
<< " is not implemented." << std::endl
;
35 const char * Exceptions::Exception::locsep
= ": ";
37 Exceptions::Exception::Exception( )
40 Exceptions::Exception::~Exception( )
43 Exceptions::MiscellaneousRequirement::MiscellaneousRequirement( RefCountPtr
< const char > msg
)
44 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
47 Exceptions::MiscellaneousRequirement::MiscellaneousRequirement( const char * msg
)
48 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
51 Exceptions::MiscellaneousRequirement::~MiscellaneousRequirement( )
55 Exceptions::MiscellaneousRequirement::display( ostream
& os
) const
57 os
<< "Failed to meet requirement: " << msg_
<< std::endl
;
61 Exceptions::HandlerError::HandlerError( RefCountPtr
< const char > _msg
)
62 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg( _msg
)
65 Exceptions::HandlerError::HandlerError( const char * _msg
)
66 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg( strrefdup( _msg
) )
69 Exceptions::HandlerError::~HandlerError( )
73 Exceptions::HandlerError::display( ostream
& os
) const
75 os
<< "Error handler message: " << msg
<< std::endl
;
79 Exceptions::ScannerError::ScannerError( const Ast::SourceLocation
& loc
, RefCountPtr
< const char > _msg
)
80 : Exceptions::StaticInconsistency( loc
), msg( _msg
)
83 Exceptions::ScannerError::~ScannerError( )
87 Exceptions::ScannerError::display( ostream
& os
) const
89 os
<< "Scanner error: " << msg
<< std::endl
;
93 Exceptions::ParserError::ParserError( const Ast::SourceLocation
& loc
, RefCountPtr
< const char > _msg
)
94 : Exceptions::StaticInconsistency( loc
), msg( _msg
)
97 Exceptions::ParserError::~ParserError( )
101 Exceptions::ParserError::display( ostream
& os
) const
103 os
<< "Parser error: " << msg
<< std::endl
;
107 Exceptions::MemberAlsoAbstract::MemberAlsoAbstract( const Ast::SourceLocation
& _memberLoc
, const char * _id
, const Ast::SourceLocation
& _abstractLoc
)
108 : Exceptions::StaticInconsistency( _memberLoc
), memberLoc( _memberLoc
), id( _id
), abstractLoc( _abstractLoc
)
111 Exceptions::MemberAlsoAbstract::~MemberAlsoAbstract( )
115 Exceptions::MemberAlsoAbstract::display( ostream
& os
) const
117 os
<< "The member " << id
<< " is also declared abstract, at " << abstractLoc
<< "." << std::endl
;
121 Exceptions::MemberAlreadyDeclared::MemberAlreadyDeclared( const Ast::SourceLocation
& _memberLoc
, const char * _id
, const Ast::SourceLocation
& _oldLoc
)
122 : Exceptions::StaticInconsistency( _memberLoc
), memberLoc( _memberLoc
), id( _id
), oldLoc( _oldLoc
)
125 Exceptions::MemberAlreadyDeclared::~MemberAlreadyDeclared( )
129 Exceptions::MemberAlreadyDeclared::display( ostream
& os
) const
131 os
<< "The member " << id
<< " has already been declared, at " << oldLoc
<< "." << std::endl
;
135 Exceptions::PublicGetSetInNonfinalClass::PublicGetSetInNonfinalClass( const Ast::SourceLocation
& _memberLoc
, const char * _id
)
136 : Exceptions::StaticInconsistency( _memberLoc
), memberLoc( _memberLoc
), id( _id
)
139 Exceptions::PublicGetSetInNonfinalClass::~PublicGetSetInNonfinalClass( )
143 Exceptions::PublicGetSetInNonfinalClass::display( ostream
& os
) const
145 os
<< "Only members of final classes may have the public get or set specifier. Member in question: " << id
<< "." << std::endl
;
149 Exceptions::TransformingMemberInNonfinalClass::TransformingMemberInNonfinalClass( const Ast::SourceLocation
& _memberLoc
, const char * _id
)
150 : Exceptions::StaticInconsistency( _memberLoc
), memberLoc( _memberLoc
), id( _id
)
153 Exceptions::TransformingMemberInNonfinalClass::~TransformingMemberInNonfinalClass( )
157 Exceptions::TransformingMemberInNonfinalClass::display( ostream
& os
) const
159 os
<< "Only members of final classes may have the <transforming> specifier. Member in question: " << id
<< "." << std::endl
;
163 Exceptions::RepeatedFormal::RepeatedFormal( const Ast::SourceLocation
& _loc
, const char * _id
)
164 : Exceptions::StaticInconsistency( _loc
), loc( _loc
), id( _id
)
167 Exceptions::RepeatedFormal::~RepeatedFormal( )
171 Exceptions::RepeatedFormal::display( ostream
& os
) const
173 os
<< "Repeated formal: " << id
<< std::endl
;
177 Exceptions::PassingStateOut::PassingStateOut( const Ast::SourceLocation
& loc
, const char * id
)
178 : Exceptions::StaticInconsistency( loc
), loc_( loc
), id_( id
)
181 Exceptions::PassingStateOut::~PassingStateOut( )
185 Exceptions::PassingStateOut::display( std::ostream
& os
) const
187 os
<< "States may not be returned." << std::endl
;
191 Exceptions::IntroducingExisting::IntroducingExisting( const Ast::SourceLocation
& _loc
, const char * _id
)
192 : Exceptions::StaticInconsistency( _loc
), loc( _loc
), id( _id
)
195 Exceptions::IntroducingExisting::~IntroducingExisting( )
199 Exceptions::IntroducingExisting::display( std::ostream
& os
) const
201 os
<< "The variable " << id
<< " is already introduced in this scope." << std::endl
;
205 Exceptions::ExpectedImperative::ExpectedImperative( const Ast::SourceLocation
& _loc
)
206 : Exceptions::StaticInconsistency( _loc
), loc( _loc
)
209 Exceptions::ExpectedImperative::~ExpectedImperative( )
213 Exceptions::ExpectedImperative::display( std::ostream
& os
) const
215 os
<< "It makes no sense to put a pure expression before the end of a code bracket." << std::endl
;
219 Exceptions::IllegalImperative::IllegalImperative( const Ast::SourceLocation
& _loc
)
220 : Exceptions::StaticInconsistency( _loc
), loc( _loc
)
223 Exceptions::IllegalImperative::~IllegalImperative( )
227 Exceptions::IllegalImperative::display( std::ostream
& os
) const
229 os
<< "Imperative expressions are not allowed here." << std::endl
;
233 Exceptions::FreezingUndefined::FreezingUndefined( const Ast::SourceLocation
& _loc
, const char * _id
)
234 : Exceptions::StaticInconsistency( _loc
), loc( _loc
), id( _id
)
237 Exceptions::FreezingUndefined::~FreezingUndefined( )
241 Exceptions::FreezingUndefined::display( std::ostream
& os
) const
243 os
<< "Internal error: The variable " << id
<< " is freezed before it was defined. Either this should be caught by during the parse, or it is due to an error in the setup of the initial environment." << std::endl
;
247 Exceptions::FileReadOpenError::FileReadOpenError( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _filename
, const std::string
* sourceDir
, const std::list
< std::string
> * searchPath
, Type _type
)
248 : loc( _loc
), filename( _filename
), type( _type
), sourceDir_( sourceDir
), searchPath_( searchPath
)
251 Exceptions::FileReadOpenError::~FileReadOpenError( )
255 Exceptions::FileReadOpenError::display( std::ostream
& os
) const
260 os
<< loc
<< locsep
<< "Could not open file: " << filename
;
263 os
<< loc
<< locsep
<< "Could not stat() file: " << filename
;
266 os
<< loc
<< locsep
<< "Internal error when displaying FileReadOpenError on file: " << filename
;
268 if( searchPath_
!= 0 )
270 os
<< " searching \"" ;
271 typedef typeof *searchPath_ ListType
;
272 for( ListType::const_iterator i
= searchPath_
->begin( ); i
!= searchPath_
->end( ); ++i
)
274 if( i
!= searchPath_
->begin( ) )
278 if( sourceDir_
!= 0 && (*i
)[0] != '/' )
290 Exceptions::FileWriteOpenError::FileWriteOpenError( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _filename
, const char * purpose
)
291 : loc( _loc
), filename( _filename
), purpose_( purpose
)
294 Exceptions::FileWriteOpenError::~FileWriteOpenError( )
298 Exceptions::FileWriteOpenError::display( std::ostream
& os
) const
300 os
<< loc
<< locsep
<< "Could not open " ;
305 os
<< " file for write: " << filename
;
310 Exceptions::TeXSetupTooLate::TeXSetupTooLate( const Ast::SourceLocation
& _loc
)
314 Exceptions::TeXSetupTooLate::~TeXSetupTooLate( )
318 Exceptions::TeXSetupTooLate::display( std::ostream
& os
) const
320 os
<< loc
<< locsep
<< "It is too late to make modifications to the TeX context." << std::endl
;
324 Exceptions::EmptyFinalPicture::EmptyFinalPicture( )
327 Exceptions::EmptyFinalPicture::~EmptyFinalPicture( )
331 Exceptions::EmptyFinalPicture::display( std::ostream
& os
) const
333 os
<< "Nothing was ever put in the global #" << Lang::CATALOG_ID
<< " or drawn to the global #" << Lang::CANVAS_ID
<< "." << std::endl
;
337 Exceptions::TeXSetupHasChanged::TeXSetupHasChanged( )
338 : Shapes::Exceptions::InternalError( "The TeX context check failed while loading fresh labels." )
341 Exceptions::TeXSetupHasChanged::~TeXSetupHasChanged( )
345 Exceptions::TypeMismatch::TypeMismatch( const Ast::SourceLocation
& loc
, RefCountPtr
< const char > _valueType
, RefCountPtr
< const char > _expectedType
)
346 : Exceptions::RuntimeError( loc
), hint_( 0 ), valueType( _valueType
), expectedType( _expectedType
)
349 Exceptions::TypeMismatch::TypeMismatch( const Ast::SourceLocation
& loc
, const char * hint
, RefCountPtr
< const char > _valueType
, RefCountPtr
< const char > _expectedType
)
350 : Exceptions::RuntimeError( loc
), hint_( hint
), valueType( _valueType
), expectedType( _expectedType
)
353 Exceptions::TypeMismatch::~TypeMismatch( )
357 Exceptions::TypeMismatch::display( std::ostream
& os
) const
361 os
<< hint_
<< ": " ;
363 os
<< "Expected " << expectedType
<< ", got a " << valueType
<< std::endl
;
366 Exceptions::PDFVersionError::PDFVersionError( SimplePDF::PDF_Version::Version version
, SimplePDF::PDF_Version::Version required
, const RefCountPtr
< const char > & msg
)
367 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), version_( version
), required_( required
), msgMem_( msg
), msg_( msgMem_
.getPtr( ) )
370 Exceptions::PDFVersionError::PDFVersionError( SimplePDF::PDF_Version::Version version
, SimplePDF::PDF_Version::Version required
, const char * msg
)
371 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), version_( version
), required_( required
), msgMem_( NullPtr
< const char >( ) ), msg_( msg
)
374 Exceptions::PDFVersionError::~PDFVersionError( )
378 Exceptions::PDFVersionError::display( std::ostream
& os
) const
380 os
<< SimplePDF::PDF_Version::toString( required_
) << " error: " << msg_
<< std::endl
;
384 Exceptions::RedefiningLexical::RedefiningLexical( const char * _id
)
385 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), id( _id
)
388 Exceptions::RedefiningLexical::~RedefiningLexical( )
392 Exceptions::RedefiningLexical::display( std::ostream
& os
) const
394 os
<< "Redefining " << id
<< std::endl
;
398 Exceptions::RedefiningDynamic::RedefiningDynamic( const char * _id
)
399 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), id( _id
)
402 Exceptions::RedefiningDynamic::~RedefiningDynamic( )
406 Exceptions::RedefiningDynamic::display( std::ostream
& os
) const
408 os
<< "Redefining " << "@" << id
<< std::endl
;
412 Exceptions::ConditionTypeMismatch::ConditionTypeMismatch( RefCountPtr
< const char > _valueType
)
413 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
)
416 Exceptions::ConditionTypeMismatch::~ConditionTypeMismatch( )
420 Exceptions::ConditionTypeMismatch::display( std::ostream
& os
) const
422 os
<< "A variable condition check must result in a " << Lang::Boolean::staticTypeName( ) << ", got a " << valueType
<< std::endl
;
426 Exceptions::VariableTypeMismatch::VariableTypeMismatch( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
, RefCountPtr
< const char > _valueType
, RefCountPtr
< const char > _expectedType
)
427 : Exceptions::RuntimeError( _loc
), id( _id
), valueType( _valueType
), expectedType( _expectedType
)
430 Exceptions::VariableTypeMismatch::~VariableTypeMismatch( )
434 Exceptions::VariableTypeMismatch::display( std::ostream
& os
) const
436 os
<< "The variable " << id
<< " was expected to refer to a " << expectedType
<< ", found a " << valueType
<< std::endl
;
440 Exceptions::NonObjectMemberAssignment::NonObjectMemberAssignment( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _valueType
)
441 : Exceptions::RuntimeError( _loc
), valueType( _valueType
)
444 Exceptions::NonObjectMemberAssignment::~NonObjectMemberAssignment( )
448 Exceptions::NonObjectMemberAssignment::display( std::ostream
& os
) const
450 os
<< "Only object oriented values have fields that can be assigned. This value is of type " << valueType
<< "." << std::endl
;
454 Exceptions::ElementaryWithout::ElementaryWithout( Kind kind
, Ref ref
, RefCountPtr
< const char > _valueType
)
455 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), kind_( kind
), ref_( ref
), valueType( _valueType
)
458 Exceptions::ElementaryWithout::~ElementaryWithout( )
462 Exceptions::ElementaryWithout::display( std::ostream
& os
) const
474 os
<< " is of the elementary type " << valueType
<< ", which has no " ;
484 os
<< "." << std::endl
;
488 Exceptions::IllegalFinalReference::IllegalFinalReference( RefCountPtr
< const char > _valueType
, const char * _fieldID
)
489 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
), fieldID( _fieldID
)
492 Exceptions::IllegalFinalReference::~IllegalFinalReference( )
496 Exceptions::IllegalFinalReference::display( std::ostream
& os
) const
498 os
<< "Attempt to access field of non-final class " << valueType
<< " without home class. Use <HomeClass>#" << fieldID
<< " instead." << std::endl
;
502 Exceptions::NonExistentMember::NonExistentMember( RefCountPtr
< const char > _valueType
, const char * _fieldID
)
503 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
), fieldID( _fieldID
)
506 Exceptions::NonExistentMember::~NonExistentMember( )
510 Exceptions::NonExistentMember::display( std::ostream
& os
) const
512 os
<< "Class " << valueType
<< " has no (non-private) field called " << fieldID
<< "." << std::endl
;
516 Exceptions::NonExistentMutator::NonExistentMutator( RefCountPtr
< const char > _valueType
, const char * _mutatorID
)
517 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
), mutatorID( _mutatorID
)
520 Exceptions::NonExistentMutator::~NonExistentMutator( )
524 Exceptions::NonExistentMutator::display( std::ostream
& os
) const
526 os
<< "State type " << valueType
<< " has no mutator called " << mutatorID
<< "." << std::endl
;
530 Exceptions::NonExistentPosition::NonExistentPosition( size_t pos
, size_t maxPos
)
531 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), pos_( pos
), maxPos_( maxPos
)
534 Exceptions::NonExistentPosition::~NonExistentPosition( )
538 Exceptions::NonExistentPosition::display( std::ostream
& os
) const
540 os
<< "Referencing field at position " << pos_
<< " is an error since the user struct has only " << maxPos_
<< " ordered fields." << std::endl
;
544 Exceptions::ProtectedMemberPublicScope::ProtectedMemberPublicScope( RefCountPtr
< const char > _valueType
, const char * _fieldID
)
545 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
), fieldID( _fieldID
)
548 Exceptions::ProtectedMemberPublicScope::~ProtectedMemberPublicScope( )
552 Exceptions::ProtectedMemberPublicScope::display( std::ostream
& os
) const
554 os
<< "Trying to access protected member " << fieldID
<< " of class " << valueType
<< " via public instance." << std::endl
;
558 Exceptions::MemberNotAssignable::MemberNotAssignable( RefCountPtr
< const char > _valueType
, const char * _fieldID
, RefCountPtr
< const char > _scope
)
559 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), valueType( _valueType
), fieldID( _fieldID
), scope( _scope
)
562 Exceptions::MemberNotAssignable::~MemberNotAssignable( )
566 Exceptions::MemberNotAssignable::display( std::ostream
& os
) const
568 os
<< "In " << scope
<< " scope of " << valueType
<< " : The member " << fieldID
<< " is not assignable." << std::endl
;
572 Exceptions::NotApplicable::NotApplicable( )
575 Exceptions::NotApplicable::~NotApplicable( )
579 Exceptions::NotApplicable::display( std::ostream
& os
) const
581 os
<< "An operator was not applicable. It is an internal error that no better error message is given." << std::endl
;
585 Exceptions::UnaryPrefixNotApplicable::UnaryPrefixNotApplicable( const Ast::SourceLocation
& _loc
, const Ast::Expression
* _expr
, RefCountPtr
< const char > _valueType
)
586 : Exceptions::RuntimeError( _loc
), expr( _expr
), valueType( _valueType
), operatorSymbol( "< ? >" )
589 Exceptions::UnaryPrefixNotApplicable::~UnaryPrefixNotApplicable( )
593 Exceptions::UnaryPrefixNotApplicable::setOperatorSymbol( const char * _operatorSymbol
)
595 operatorSymbol
= _operatorSymbol
;
599 Exceptions::UnaryPrefixNotApplicable::display( std::ostream
& os
) const
603 os
<< "(" << valueType
<< ") Operator not defined for operand at " << expr
->loc( ) << std::endl
;
607 os
<< "Operator " << operatorSymbol
<< " is not defined for the operand of type " << valueType
<< "." << std::endl
;
612 Exceptions::UnaryPostfixNotApplicable::UnaryPostfixNotApplicable( const Ast::SourceLocation
& _loc
, const Ast::Expression
* _expr
, RefCountPtr
< const char > _valueType
)
613 : Exceptions::RuntimeError( _loc
), expr( _expr
), valueType( _valueType
), operatorSymbol( "< ? >" )
616 Exceptions::UnaryPostfixNotApplicable::~UnaryPostfixNotApplicable( )
620 Exceptions::UnaryPostfixNotApplicable::setOperatorSymbol( const char * _operatorSymbol
)
622 operatorSymbol
= _operatorSymbol
;
626 Exceptions::UnaryPostfixNotApplicable::display( std::ostream
& os
) const
630 os
<< "(" << valueType
<< ") Operator not defined for operand at " << expr
->loc( ) << std::endl
;
634 os
<< "Operator " << operatorSymbol
<< " is not defined for the operand of type " << valueType
<< "." << std::endl
;
639 Exceptions::BinaryInfixNotApplicable::BinaryInfixNotApplicable( const Ast::SourceLocation
& _loc
, const Ast::Expression
* _expr1
, RefCountPtr
< const char > _valueType1
, const Ast::Expression
* _expr2
, RefCountPtr
< const char > _valueType2
)
640 : Exceptions::RuntimeError( _loc
), expr1( _expr1
), valueType1( _valueType1
), expr2( _expr2
), valueType2( _valueType2
), operatorSymbol( "< ? >" )
643 Exceptions::BinaryInfixNotApplicable::~BinaryInfixNotApplicable( )
647 Exceptions::BinaryInfixNotApplicable::setOperatorSymbol( const char * _operatorSymbol
)
649 operatorSymbol
= _operatorSymbol
;
653 Exceptions::BinaryInfixNotApplicable::display( std::ostream
& os
) const
655 if( expr1
!= 0 && expr2
!= 0 )
657 os
<< "(" << valueType1
<< "," << valueType2
<< ") Operator not defined for operands at " << expr1
->loc( ) << ", " << expr2
->loc( ) << std::endl
;
661 os
<< "Operator " << operatorSymbol
<< " is not defined for the operand combination (" << valueType1
<< "," << valueType2
<< ")" << std::endl
;
666 Exceptions::ProhibitedTypeChange::ProhibitedTypeChange( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
, RefCountPtr
< const char > _oldType
, RefCountPtr
< const char > _newType
)
667 : Exceptions::RuntimeError( _loc
), id( _id
), oldType( _oldType
), newType( _newType
)
670 Exceptions::ProhibitedTypeChange::~ProhibitedTypeChange( )
674 Exceptions::ProhibitedTypeChange::display( std::ostream
& os
) const
676 os
<< "The type of " << id
<< " is locked to " << oldType
<< ", but the new value is of type " << newType
<< "." << std::endl
;
680 Exceptions::LookupUnknown::LookupUnknown( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
, Type type
)
681 : Exceptions::StaticInconsistency( _loc
), id( _id
), type_( type
)
684 Exceptions::LookupUnknown::~LookupUnknown( )
688 Exceptions::LookupUnknown::display( std::ostream
& os
) const
693 os
<< "The variable " << id
<< " is unbound." << std::endl
;
696 os
<< "There is no state called " << id
<< " around." << std::endl
;
698 case DYNAMIC_VARIABLE
:
699 os
<< "There is no dynamic variable called " << id
<< " around." << std::endl
;
702 os
<< "There is no dynamic state called " << id
<< " around." << std::endl
;
705 os
<< "There is no type called " << id
<< " around." << std::endl
;
713 Exceptions::StateBeyondFunctionBoundary::StateBeyondFunctionBoundary( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
)
714 : Exceptions::StaticInconsistency( _loc
), id( _id
)
717 Exceptions::StateBeyondFunctionBoundary::~StateBeyondFunctionBoundary( )
721 Exceptions::StateBeyondFunctionBoundary::display( std::ostream
& os
) const
723 os
<< "The state " << id
<< " resides outside a function boundary." << std::endl
;
727 Exceptions::IntroducingExistingUnit::IntroducingExistingUnit( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
)
728 : Exceptions::StaticInconsistency( _loc
), id( _id
)
731 Exceptions::IntroducingExistingUnit::~IntroducingExistingUnit( )
735 Exceptions::IntroducingExistingUnit::display( std::ostream
& os
) const
737 os
<< "Inconsistent definition of the existing unit " << id
<< "." << std::endl
;
741 Exceptions::LookupUnknownUnit::LookupUnknownUnit( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > _id
)
742 : Exceptions::StaticInconsistency( _loc
), id( _id
)
745 Exceptions::LookupUnknownUnit::~LookupUnknownUnit( )
749 Exceptions::LookupUnknownUnit::display( std::ostream
& os
) const
751 os
<< "The unit " << id
<< " is unbound" << std::endl
;
755 Exceptions::OutOfRange::OutOfRange( RefCountPtr
< const char > msg
)
756 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
759 Exceptions::OutOfRange::OutOfRange( const char * msg
)
760 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
763 Exceptions::OutOfRange::OutOfRange( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > msg
)
764 : Exceptions::RuntimeError( _loc
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
767 Exceptions::OutOfRange::OutOfRange( const Ast::SourceLocation
& _loc
, const char * msg
)
768 : Exceptions::RuntimeError( _loc
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
771 Exceptions::OutOfRange::~OutOfRange( )
775 Exceptions::OutOfRange::display( std::ostream
& os
) const
777 os
<< "Out-of-range error: " << msg_
<< std::endl
;
781 Exceptions::NonVoidStatement::NonVoidStatement( const Ast::SourceLocation
& _loc
, RefCountPtr
< const Lang::Value
> _val
)
782 : Exceptions::RuntimeError( _loc
), val( _val
)
785 Exceptions::NonVoidStatement::~NonVoidStatement( )
789 Exceptions::NonVoidStatement::display( std::ostream
& os
) const
791 os
<< "No implicit ignore of non-void value (of type " << val
->getTypeName( ) << ")" << std::endl
;
794 // Exceptions::RuntimeError::RuntimeError( )
795 // : loc_( "< unlocated runtime error >" )
798 Exceptions::RuntimeError::~RuntimeError( )
801 Exceptions::RuntimeError::RuntimeError( const Ast::SourceLocation
& loc
)
805 Exceptions::RuntimeError::RuntimeError( Ast::Expression
* expr
)
806 : loc_( expr
->loc( ) )
809 const Ast::SourceLocation
&
810 Exceptions::RuntimeError::getLoc( ) const
816 Exceptions::UserError::UserError( RefCountPtr
< const char > _msg
)
817 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg( _msg
)
820 Exceptions::UserError::~UserError( )
824 Exceptions::UserError::display( ostream
& os
) const
826 os
<< "User error: " << msg
<< std::endl
;
830 Exceptions::InternalError::InternalError( const Ast::SourceLocation
& loc
, RefCountPtr
< const char > msg
)
831 : Exceptions::RuntimeError( loc
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
834 Exceptions::InternalError::InternalError( const Ast::SourceLocation
& loc
, const char * msg
)
835 : Exceptions::RuntimeError( loc
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
838 Exceptions::InternalError::InternalError( RefCountPtr
< const char > msg
)
839 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
842 Exceptions::InternalError::InternalError( const char * msg
)
843 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
846 Exceptions::InternalError::InternalError( const std::ostringstream
& msg
)
847 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( strdup( msg
.str( ).c_str( ) ) ), msgMem_( msg_
)
850 Exceptions::InternalError::~InternalError( )
854 Exceptions::InternalError::display( ostream
& os
) const
856 os
<< "Internal error: " << msg_
<< std::endl
;
860 Exceptions::ExternalError::ExternalError( RefCountPtr
< const char > msg
)
861 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
864 Exceptions::ExternalError::ExternalError( const char * msg
)
865 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
868 Exceptions::ExternalError::~ExternalError( )
872 Exceptions::ExternalError::display( ostream
& os
) const
874 os
<< "External error: " << msg_
<< std::endl
;
877 Exceptions::ExternalError
*
878 Exceptions::ExternalError::clone( ) const
880 return new Exceptions::ExternalError( msgMem_
);
883 Exceptions::UserArityMismatch::UserArityMismatch( const Ast::SourceLocation _formalsLoc
, size_t _functionArity
, size_t _callArity
, Type type
)
884 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), formalsLoc( _formalsLoc
), functionArity( _functionArity
), callArity( _callArity
), type_( type
)
887 Exceptions::UserArityMismatch::~UserArityMismatch( )
891 Exceptions::UserArityMismatch::display( std::ostream
& os
) const
893 os
<< "Function with formals at " << formalsLoc
<< " expects " << functionArity
;
897 os
<< " value arguments" ;
900 os
<< " state arguments" ;
905 os
<< ", not " << callArity
<< std::endl
;
908 Exceptions::SinkRequired::SinkRequired( const Ast::SourceLocation loc
, size_t formalsArity
, size_t callArity
)
909 : Exceptions::RuntimeError( loc
), formalsArity_( formalsArity
), callArity_( callArity
)
912 Exceptions::SinkRequired::~SinkRequired( )
916 Exceptions::SinkRequired::display( std::ostream
& os
) const
918 os
<< "Formals at " << loc_
<< " contains no sink, so passing " << callArity_
<< " ordered arguments is " << callArity_
- formalsArity_
<< " too many." << std::endl
;
922 Exceptions::NamedFormalMismatch::NamedFormalMismatch( const Ast::SourceLocation _formalsLoc
, RefCountPtr
< const char > _name
, Exceptions::NamedFormalMismatch::Type type
)
923 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), formalsLoc( _formalsLoc
), name( _name
), type_( type
)
926 Exceptions::NamedFormalMismatch::~NamedFormalMismatch( )
930 Exceptions::NamedFormalMismatch::display( std::ostream
& os
) const
932 os
<< "Function with formals at " << formalsLoc
<< " has no named ";
944 os
<< " called " << name
<< "." << std::endl
;
948 Exceptions::NamedFormalAlreadySpecified::NamedFormalAlreadySpecified( const Ast::SourceLocation _formalsLoc
, RefCountPtr
< const char > _name
, size_t _pos
, Exceptions::NamedFormalAlreadySpecified::Type type
)
949 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), formalsLoc( _formalsLoc
), name( _name
), pos( _pos
), type_( type
)
952 Exceptions::NamedFormalAlreadySpecified::~NamedFormalAlreadySpecified( )
956 Exceptions::NamedFormalAlreadySpecified::display( std::ostream
& os
) const
958 os
<< "The formal " ;
970 os
<< " named " << name
<< ", defined at " << formalsLoc
<< " is already defined by order, at position " << pos
<< "." << std::endl
;
973 Exceptions::MissingArguments::MissingArguments( const Ast::SourceLocation _formalsLoc
, std::map
< size_t, RefCountPtr
< const char > > * _missingVariables
, std::map
< size_t, RefCountPtr
< const char > > * _missingStates
)
974 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), formalsLoc( _formalsLoc
), missingVariables( _missingVariables
), missingStates( _missingStates
)
977 Exceptions::MissingArguments::~MissingArguments( )
979 if( missingVariables
!= 0 )
981 delete missingVariables
;
983 if( missingStates
!= 0 )
985 delete missingStates
;
990 Exceptions::MissingArguments::display( std::ostream
& os
) const
992 os
<< "Among the formals at " << formalsLoc
;
993 if( missingVariables
!= 0 )
995 os
<< ", the following variables are missing:" ;
996 typedef typeof *missingVariables MapType
;
997 for( MapType::const_iterator i
= missingVariables
->begin( ); i
!= missingVariables
->end( ); ++i
)
999 if( i
!= missingVariables
->begin( ) )
1003 os
<< " (" << i
->first
<< ")" << i
->second
.getPtr( ) ;
1006 if( missingStates
!= 0 )
1009 if( missingVariables
!= 0 )
1013 os
<< "the following states are missing:" ;
1014 typedef typeof *missingStates MapType
;
1015 for( MapType::const_iterator i
= missingStates
->begin( ); i
!= missingStates
->end( ); ++i
)
1017 if( i
!= missingStates
->begin( ) )
1021 os
<< " (" << i
->first
<< ")" << i
->second
.getPtr( ) ;
1024 os
<< "." << std::endl
;
1028 Exceptions::CoreArityMismatch::CoreArityMismatch( const char * _title
, size_t _functionArity
, size_t _callArity
)
1029 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
), titleMem( NullPtr
< const char >( ) ), functionArityLow( _functionArity
), functionArityHigh( _functionArity
), callArity( _callArity
)
1032 Exceptions::CoreArityMismatch::CoreArityMismatch( const char * _title
, size_t _functionArityLow
, size_t _functionArityHigh
, size_t _callArity
)
1033 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
), titleMem( NullPtr
< const char >( ) ), functionArityLow( _functionArityLow
), functionArityHigh( _functionArityHigh
), callArity( _callArity
)
1036 Exceptions::CoreArityMismatch::CoreArityMismatch( const RefCountPtr
< const char > & _title
, size_t _functionArity
, size_t _callArity
)
1037 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
.getPtr( ) ), titleMem( _title
), functionArityLow( _functionArity
), functionArityHigh( _functionArity
), callArity( _callArity
)
1040 Exceptions::CoreArityMismatch::CoreArityMismatch( const RefCountPtr
< const char > & _title
, size_t _functionArityLow
, size_t _functionArityHigh
, size_t _callArity
)
1041 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
.getPtr( ) ), titleMem( _title
), functionArityLow( _functionArityLow
), functionArityHigh( _functionArityHigh
), callArity( _callArity
)
1044 Exceptions::CoreArityMismatch::~CoreArityMismatch( )
1048 Exceptions::CoreArityMismatch::display( std::ostream
& os
) const
1050 if( functionArityLow
== functionArityHigh
)
1052 os
<< "Core function " << title
<< " expects " << functionArityLow
<< " arguments, not " << callArity
<< std::endl
;
1056 os
<< "Core function " << title
<< " expects [" << functionArityLow
<< ", " << functionArityHigh
<< "] arguments, not " << callArity
<< std::endl
;
1061 Exceptions::CoreNoNamedFormals::CoreNoNamedFormals( const char * _title
)
1062 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
), titleMem( NullPtr
< const char >( ) )
1065 Exceptions::CoreNoNamedFormals::CoreNoNamedFormals( const RefCountPtr
< const char > & _title
)
1066 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
.getPtr( ) ), titleMem( _title
)
1069 Exceptions::CoreNoNamedFormals::~CoreNoNamedFormals( )
1073 Exceptions::CoreNoNamedFormals::display( std::ostream
& os
) const
1075 os
<< "Core function " << title
<< " does not accept named arguments." << std::endl
;
1079 Exceptions::CoreTypeMismatch::CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
1081 const Ast::SourceLocation
& argLoc
,
1082 RefCountPtr
< const char > valueType
,
1083 RefCountPtr
< const char > expectedType
)
1084 : Exceptions::RuntimeError( callLoc
),
1086 titleMem_( NullPtr
< const char >( ) ),
1088 valueType_( valueType
),
1089 expectedType_( expectedType
)
1092 Exceptions::CoreTypeMismatch::CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
1093 RefCountPtr
< const char > title
,
1094 const Ast::SourceLocation
& argLoc
,
1095 RefCountPtr
< const char > valueType
,
1096 RefCountPtr
< const char > expectedType
)
1097 : Exceptions::RuntimeError( callLoc
),
1098 title_( title
.getPtr( ) ),
1101 valueType_( valueType
),
1102 expectedType_( expectedType
)
1105 Exceptions::CoreTypeMismatch::CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
1107 Kernel::Arguments
& args
,
1109 RefCountPtr
< const char > expectedType
)
1110 : Exceptions::RuntimeError( callLoc
),
1112 titleMem_( NullPtr
< const char >( ) ),
1113 argLoc_( args
.getLoc( argNo
) ),
1114 valueType_( args
.getValue( argNo
)->getTypeName( ) ),
1115 expectedType_( expectedType
)
1118 Exceptions::CoreTypeMismatch::CoreTypeMismatch( const Ast::SourceLocation
& callLoc
,
1119 RefCountPtr
< const char > title
,
1120 Kernel::Arguments
& args
,
1122 RefCountPtr
< const char > expectedType
)
1123 : Exceptions::RuntimeError( callLoc
),
1124 title_( title
.getPtr( ) ),
1126 argLoc_( args
.getLoc( argNo
) ),
1127 valueType_( args
.getValue( argNo
)->getTypeName( ) ),
1128 expectedType_( expectedType
)
1131 Exceptions::CoreTypeMismatch::~CoreTypeMismatch( )
1135 Exceptions::CoreTypeMismatch::display( std::ostream
& os
) const
1137 os
<< "Core function " << title_
<< ", argument ";
1138 // if( argName_ != 0 )
1140 // os << "\"" << argName_ << "\" " ;
1142 os
<< "at " << argLoc_
<< ": expected a " << expectedType_
<< ", got a " << valueType_
<< std::endl
;
1146 Exceptions::CoreStateTypeMismatch::CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
1148 const Ast::SourceLocation
& argLoc
,
1149 RefCountPtr
< const char > valueType
,
1150 RefCountPtr
< const char > expectedType
)
1151 : Exceptions::RuntimeError( callLoc
),
1153 titleMem_( NullPtr
< const char >( ) ),
1155 valueType_( valueType
),
1156 expectedType_( expectedType
)
1159 Exceptions::CoreStateTypeMismatch::CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
1160 RefCountPtr
< const char > title
,
1161 const Ast::SourceLocation
& argLoc
,
1162 RefCountPtr
< const char > valueType
,
1163 RefCountPtr
< const char > expectedType
)
1164 : Exceptions::RuntimeError( callLoc
),
1165 title_( title
.getPtr( ) ),
1168 valueType_( valueType
),
1169 expectedType_( expectedType
)
1172 Exceptions::CoreStateTypeMismatch::CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
1174 Kernel::Arguments
& args
,
1176 RefCountPtr
< const char > expectedType
)
1177 : Exceptions::RuntimeError( callLoc
),
1179 titleMem_( NullPtr
< const char >( ) ),
1180 argLoc_( args
.getStateLoc( argNo
) ),
1181 valueType_( args
.getState( argNo
)->getTypeName( ) ),
1182 expectedType_( expectedType
)
1185 Exceptions::CoreStateTypeMismatch::CoreStateTypeMismatch( const Ast::SourceLocation
& callLoc
,
1186 RefCountPtr
< const char > title
,
1187 Kernel::Arguments
& args
,
1189 RefCountPtr
< const char > expectedType
)
1190 : Exceptions::RuntimeError( callLoc
),
1191 title_( title
.getPtr( ) ),
1193 argLoc_( args
.getStateLoc( argNo
) ),
1194 valueType_( args
.getState( argNo
)->getTypeName( ) ),
1195 expectedType_( expectedType
)
1198 Exceptions::CoreStateTypeMismatch::~CoreStateTypeMismatch( )
1202 Exceptions::CoreStateTypeMismatch::display( std::ostream
& os
) const
1204 os
<< "Core function " << title_
<< ", state ";
1205 // if( argName_ != 0 )
1207 // os << "\"" << argName_ << "\" " ;
1209 os
<< "at " << argLoc_
<< ": expected a " << expectedType_
<< ", got a " << valueType_
<< std::endl
;
1213 Exceptions::CoreDynamicTypeMismatch::CoreDynamicTypeMismatch( const Ast::SourceLocation
& callLoc
,
1216 RefCountPtr
< const char > valueType
,
1217 RefCountPtr
< const char > expectedType
)
1218 : Exceptions::RuntimeError( callLoc
),
1220 titleMem_( NullPtr
< const char >( ) ),
1222 idMem_( NullPtr
< const char >( ) ),
1223 valueType_( valueType
),
1224 expectedType_( expectedType
)
1227 Exceptions::CoreDynamicTypeMismatch::~CoreDynamicTypeMismatch( )
1231 Exceptions::CoreDynamicTypeMismatch::display( std::ostream
& os
) const
1233 os
<< "Core function " << title_
<< " encountered a type mismatch in the dynamic variable @" << id_
1234 << ": expected a " << expectedType_
<< ", got a " << valueType_
<< std::endl
;
1237 Exceptions::ContinuationTypeMismatch::ContinuationTypeMismatch( const Kernel::Continuation
* locationCont
,
1238 RefCountPtr
< const char > valueType
,
1239 RefCountPtr
< const char > expectedType
)
1240 : Exceptions::RuntimeError( locationCont
->traceLoc( ) ),
1241 valueType_( valueType
),
1242 expectedType_( expectedType
)
1245 Exceptions::ContinuationTypeMismatch::~ContinuationTypeMismatch( )
1249 Exceptions::ContinuationTypeMismatch::display( std::ostream
& os
) const
1251 os
<< "The continuation expected a " << expectedType_
<< ", got a " << valueType_
<< "." << std::endl
;
1255 Exceptions::EmptyApplication::EmptyApplication( )
1256 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
)
1259 Exceptions::EmptyApplication::~EmptyApplication( )
1263 Exceptions::EmptyApplication::display( std::ostream
& os
) const
1265 os
<< "Empty application." << std::endl
;
1269 Exceptions::CoreOutOfRange::CoreOutOfRange( const char * _title
, Kernel::Arguments
& args
, size_t argNo
, RefCountPtr
< const char > msg
)
1270 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
), argLoc_( args
.getLoc( argNo
) ), msg_( msg
.getPtr( ) ), msgMem_( msg
)
1273 Exceptions::CoreOutOfRange::CoreOutOfRange( const char * _title
, Kernel::Arguments
& args
, size_t argNo
, const char * msg
)
1274 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), title( _title
), argLoc_( args
.getLoc( argNo
) ), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
1277 Exceptions::CoreOutOfRange::~CoreOutOfRange( )
1281 Exceptions::CoreOutOfRange::display( std::ostream
& os
) const
1283 os
<< "Core function " << title
<< ": ";
1284 os
<< "Argument at " << argLoc_
<< " is out of range; " << msg_
<< std::endl
;
1287 Exceptions::CoreRequirement::CoreRequirement( RefCountPtr
< const char > msg
, const char * _title
, const Ast::SourceLocation
& callLoc
)
1288 : Exceptions::RuntimeError( callLoc
), title( _title
), msg_( msg
.getPtr( ) ), msgMem_( msg
)
1291 Exceptions::CoreRequirement::CoreRequirement( const char * msg
, const char * _title
, const Ast::SourceLocation
& callLoc
)
1292 : Exceptions::RuntimeError( callLoc
), title( _title
), msg_( msg
), msgMem_( NullPtr
< const char >( ) )
1295 Exceptions::CoreRequirement::~CoreRequirement( )
1299 Exceptions::CoreRequirement::display( std::ostream
& os
) const
1301 os
<< "Core function " << title
<< ": " << msg_
<< std::endl
;
1305 Exceptions::TeXLabelError::TeXLabelError( bool quoted
, const char * region
, RefCountPtr
< const char > summary
, RefCountPtr
< const char > details
, const Ast::SourceLocation
& loc
)
1306 : Exceptions::RuntimeError( loc
), strLoc_( loc
), quoted_( quoted
), region_( region
), summary_( summary
), details_( details
)
1309 Exceptions::TeXLabelError::~TeXLabelError( )
1313 Exceptions::TeXLabelError::display( ostream
& os
) const
1317 os
<< "TeX error in " << region_
;
1321 os
<< "Error in TeX " << region_
;
1323 if( ! strLoc_
.isUnknown( ) )
1325 os
<< " at " << strLoc_
;
1338 if( details_
!= NullPtr
< const char >( ) )
1340 Exceptions::prefixEachLine( additionalLinesPrefix
, details_
, os
);
1345 Exceptions::StaticTeXLabelError::StaticTeXLabelError( bool quoted
, const char * region
, RefCountPtr
< const char > summary
, RefCountPtr
< const char > details
, const Ast::SourceLocation
& loc
)
1346 : Exceptions::StaticInconsistency( loc
), quoted_( quoted
), region_( region
), summary_( summary
), details_( details
)
1349 Exceptions::StaticTeXLabelError::~StaticTeXLabelError( )
1353 Exceptions::StaticTeXLabelError::display( ostream
& os
) const
1357 os
<< "TeX error in " << region_
;
1361 os
<< "Error in TeX " << region_
;
1374 if( details_
!= NullPtr
< const char >( ) )
1376 Exceptions::prefixEachLine( additionalLinesPrefix
, details_
, os
);
1381 Exceptions::InstantiatingAbstractClass::InstantiatingAbstractClass( RefCountPtr
< const Lang::Class
> _cls
)
1382 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
)
1385 Exceptions::InstantiatingAbstractClass::~InstantiatingAbstractClass( )
1389 Exceptions::InstantiatingAbstractClass::display( ostream
& os
) const
1391 os
<< "Trying to instantiate abstract class: " << cls
->getPrettyName( ) << std::endl
;
1395 Exceptions::FailedToDeclareClassAbstract::FailedToDeclareClassAbstract( RefCountPtr
< const Lang::Class
> _cls
, const Shapes::Ast::ClassFunction
* _classExpr
)
1396 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), classExpr( _classExpr
)
1399 Exceptions::FailedToDeclareClassAbstract::~FailedToDeclareClassAbstract( )
1403 Exceptions::FailedToDeclareClassAbstract::display( ostream
& os
) const
1405 os
<< classExpr
->loc( ) << " " << "Class " << cls
->getPrettyName( ) << " has abstract methods but is not declared abstract: " ;
1406 cls
->showAbstractSet( os
);
1411 Exceptions::RepeatedImmediateParent::RepeatedImmediateParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
)
1412 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
)
1415 Exceptions::RepeatedImmediateParent::~RepeatedImmediateParent( )
1419 Exceptions::RepeatedImmediateParent::display( ostream
& os
) const
1421 os
<< "When creating the class " << cls
->getPrettyName( ) << ", the following class is a repeated immediate parent: " << parent
->getPrettyName( ) << std::endl
;
1425 Exceptions::OverridingNonParent::OverridingNonParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
)
1426 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
)
1429 Exceptions::OverridingNonParent::~OverridingNonParent( )
1433 Exceptions::OverridingNonParent::display( ostream
& os
) const
1435 os
<< "The class " << cls
->getPrettyName( ) << " cannot override methods from the class " << parent
->getPrettyName( ) << ", since the latter is not a parent of the former." << std::endl
;
1439 Exceptions::InheritingFinal::InheritingFinal( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
)
1440 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
)
1443 Exceptions::InheritingFinal::~InheritingFinal( )
1447 Exceptions::InheritingFinal::display( ostream
& os
) const
1449 os
<< "When creating the class " << cls
->getPrettyName( ) << ", trying to inherit from final class: " << parent
->getPrettyName( ) << std::endl
;
1453 Exceptions::OverridingUndeclaredMethod::OverridingUndeclaredMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
, const char * _id
)
1454 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
), id( _id
)
1457 Exceptions::OverridingUndeclaredMethod::~OverridingUndeclaredMethod( )
1461 Exceptions::OverridingUndeclaredMethod::display( ostream
& os
) const
1463 os
<< "In override declaration in class " << cls
->getPrettyName( ) << ": there is no method called " << id
<< " in class " << parent
->getPrettyName( ) << " to override." << std::endl
;
1467 Exceptions::OverridingFinalMethod::OverridingFinalMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
, const char * _id
)
1468 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
), id( _id
)
1471 Exceptions::OverridingFinalMethod::~OverridingFinalMethod( )
1475 Exceptions::OverridingFinalMethod::display( ostream
& os
) const
1477 os
<< "In override declaration in class " << cls
->getPrettyName( ) << ": The method " << id
<< " in class " << parent
->getPrettyName( ) << " is final." << std::endl
;
1481 Exceptions::IllegalRepeatedBase::IllegalRepeatedBase( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
)
1482 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
)
1485 Exceptions::IllegalRepeatedBase::~IllegalRepeatedBase( )
1489 Exceptions::IllegalRepeatedBase::display( ostream
& os
) const
1491 os
<< "When creating the class " << cls
->getPrettyName( ) << ", the following repeated base class may not be repeated: " << parent
->getPrettyName( ) << std::endl
;
1495 Exceptions::AmbiguousInheritedMethod::AmbiguousInheritedMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const char > _id
, std::set
< RefCountPtr
< const Lang::Class
> > _parents
)
1496 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), id( _id
), parents( _parents
)
1499 Exceptions::AmbiguousInheritedMethod::~AmbiguousInheritedMethod( )
1503 Exceptions::AmbiguousInheritedMethod::display( ostream
& os
) const
1505 os
<< "In class " << cls
->getPrettyName( ) << ": the method name " << id
<< " is ambiguous, as it is inherited from more than one class:" ;
1506 for( std::set
< RefCountPtr
< const Lang::Class
> >::const_iterator i
= parents
.begin( ); i
!= parents
.end( ); ++i
)
1508 os
<< " " << (*i
)->getPrettyName( ) ;
1514 Exceptions::MisplacedSuperReference::MisplacedSuperReference( const Ast::SourceLocation
& _loc
)
1515 : Exceptions::RuntimeError( _loc
)
1518 Exceptions::MisplacedSuperReference::~MisplacedSuperReference( )
1522 Exceptions::MisplacedSuperReference::display( std::ostream
& os
) const
1524 os
<< "Misplaced reference to parent instance." << std::endl
;
1528 Exceptions::SuperReferenceClassNotParent::SuperReferenceClassNotParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
)
1529 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), parent( _parent
)
1532 Exceptions::SuperReferenceClassNotParent::~SuperReferenceClassNotParent( )
1536 Exceptions::SuperReferenceClassNotParent::display( std::ostream
& os
) const
1538 os
<< "When referencing super instance, " << parent
->getPrettyName( ) << " is not a parent of " << cls
->getPrettyName( ) << "." << std::endl
;
1542 Exceptions::NoSuchMethod::NoSuchMethod( RefCountPtr
< const Lang::Class
> _cls
, const Kernel::MethodId
& _method
)
1543 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), method( _method
)
1546 Exceptions::NoSuchMethod::~NoSuchMethod( )
1550 Exceptions::NoSuchMethod::display( std::ostream
& os
) const
1552 os
<< "Class " << cls
->getPrettyName( ) << " has no method called " << method
.prettyName( ) << std::endl
;
1556 Exceptions::NoSuchLocalMethod::NoSuchLocalMethod( RefCountPtr
< const Lang::Class
> _cls
, const Kernel::MethodId
& _method
)
1557 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), cls( _cls
), method( _method
)
1560 Exceptions::NoSuchLocalMethod::~NoSuchLocalMethod( )
1564 Exceptions::NoSuchLocalMethod::display( std::ostream
& os
) const
1566 os
<< "Class " << cls
->getPrettyName( ) << " does not itself define the method " << method
.prettyName( ) << std::endl
;
1570 Exceptions::MultipleDynamicBind::MultipleDynamicBind( const char * _id
, const Ast::SourceLocation
& _loc
, const Ast::SourceLocation
& _prevLoc
)
1571 : Exceptions::RuntimeError( _loc
), id( _id
), prevLoc( _prevLoc
)
1574 Exceptions::MultipleDynamicBind::~MultipleDynamicBind( )
1578 Exceptions::MultipleDynamicBind::display( std::ostream
& os
) const
1580 os
<< "This dynamic binding of " << id
<< " is merged with the conflicting binding at " << prevLoc
<< "." << std::endl
;
1584 Exceptions::UndefinedEscapeContinuation::UndefinedEscapeContinuation( const char * _id
, const Ast::SourceLocation
& _loc
)
1585 : Exceptions::RuntimeError( _loc
), id( _id
)
1588 Exceptions::UndefinedEscapeContinuation::~UndefinedEscapeContinuation( )
1592 Exceptions::UndefinedEscapeContinuation::display( std::ostream
& os
) const
1594 os
<< "The escape continuation " << id
<< " was not defined in the dynamic context." << std::endl
;
1598 Exceptions::DeadStateAccess::DeadStateAccess( )
1599 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
)
1602 Exceptions::DeadStateAccess::~DeadStateAccess( )
1606 Exceptions::DeadStateAccess::display( std::ostream
& os
) const
1608 os
<< "Accessing dead state." << std::endl
;
1612 Exceptions::UnFreezable::UnFreezable( )
1613 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
)
1616 Exceptions::UnFreezable::~UnFreezable( )
1620 Exceptions::UnFreezable::display( std::ostream
& os
) const
1622 os
<< "The state cannot be frozen." << std::endl
;
1626 Exceptions::UnPeekable::UnPeekable( )
1627 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
)
1630 Exceptions::UnPeekable::~UnPeekable( )
1634 Exceptions::UnPeekable::display( std::ostream
& os
) const
1636 os
<< "The state cannot be peeked. Consider freezing it." << std::endl
;
1640 Exceptions::UninitializedAccess::UninitializedAccess( )
1641 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
)
1644 Exceptions::UninitializedAccess::~UninitializedAccess( )
1648 Exceptions::UninitializedAccess::display( std::ostream
& os
) const
1650 os
<< "The accessed variable or state has not been initialized yet." << std::endl
;
1654 Exceptions::DtMinError::DtMinError( double _dt
)
1655 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), dt( _dt
)
1658 Exceptions::DtMinError::~DtMinError( )
1662 Exceptions::DtMinError::display( std::ostream
& os
) const
1664 os
<< "Path segment too long in relation to arcdelta: dt = " << dt
<< " < " << Computation::the_dtMin
<< ". Either increase arcdelta, or inhibit this error." << std::endl
;
1668 Exceptions::AffineTransformKillsPlane::AffineTransformKillsPlane( double sigma2
)
1669 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), sigma2_( sigma2
)
1672 Exceptions::AffineTransformKillsPlane::~AffineTransformKillsPlane( )
1676 Exceptions::AffineTransformKillsPlane::display( std::ostream
& os
) const
1678 os
<< "When transforming a plane normal, it was found that the affine transform is too singular, with a second largest singular value of " << sigma2_
<< "." << std::endl
;
1681 Exceptions::MissingFontMetrics::MissingFontMetrics( RefCountPtr
< const char > fontname
, const std::list
< std::string
> * searchPath
)
1682 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), fontname_( fontname
), searchPath_( searchPath
)
1685 Exceptions::MissingFontMetrics::~MissingFontMetrics( )
1689 Exceptions::MissingFontMetrics::display( std::ostream
& os
) const
1691 os
<< "The font metrics for " << fontname_
<< ", named " << fontname_
<< ".afm, could not be found in {" ;
1692 typedef typeof *searchPath_ ListType
;
1693 for( ListType::const_iterator i
= searchPath_
->begin( ); i
!= searchPath_
->end( ); ++i
)
1697 os
<< " }." << std::endl
;
1701 Exceptions::FontMetricsError::FontMetricsError( const RefCountPtr
< const char > & fontname
, const RefCountPtr
< const char > & message
)
1702 : Exceptions::RuntimeError( Ast::THE_UNKNOWN_LOCATION
), fontname_( fontname
), message_( message
)
1705 Exceptions::FontMetricsError::~FontMetricsError( )
1709 Exceptions::FontMetricsError::display( std::ostream
& os
) const
1711 os
<< "There was a problem with the font metrics for " << fontname_
<< ": " << message_
<< std::endl
;
1715 Exceptions::InsertingEmptyPage::InsertingEmptyPage( const Ast::SourceLocation
& loc
)
1716 : Exceptions::RuntimeError( loc
)
1719 Exceptions::InsertingEmptyPage::~InsertingEmptyPage( )
1723 Exceptions::InsertingEmptyPage::display( std::ostream
& os
) const
1725 os
<< "Attempt to place empty page in catalog." << std::endl
;
1729 Exceptions::UndefinedCrossRef::UndefinedCrossRef( const Ast::SourceLocation
& _loc
, RefCountPtr
< const char > ref
)
1730 : Exceptions::PostCondition( _loc
), ref_( ref
)
1733 Exceptions::UndefinedCrossRef::~UndefinedCrossRef( )
1737 Exceptions::UndefinedCrossRef::display( std::ostream
& os
) const
1739 os
<< "The cross reference \"" << ref_
<< "\" is not defined." << std::endl
;
1744 Exceptions::prefixEachLine( const std::string
& prefix
, std::istream
& src
, std::ostream
& dst
)
1747 for( std::getline( src
, line
); ! src
.eof( ); std::getline( src
, line
) )
1749 dst
<< prefix
<< line
<< std::endl
;
1754 Exceptions::prefixEachLine( const std::string
& prefix
, const RefCountPtr
< const char > & src
, std::ostream
& dst
)
1756 std::istringstream
is( src
.getPtr( ) );
1757 Exceptions::prefixEachLine( prefix
, is
, dst
);