2 * Translator from Modelica 2.x to flat Modelica
\r
4 * Copyright (C) 2005 - 2007 Imagine S.A.
\r
5 * For more information or commercial use please contact us at www.amesim.com
\r
7 * This program is free software; you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation; either version 2
\r
10 * of the License, or (at your option) any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program; if not, write to the Free Software
\r
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
23 (* Compilation error dictionary
\r
28 type error_description =
\r
30 err_msg: string list;
\r
31 err_info: (string * string) list;
\r
37 path: Instantiation.path;
\r
38 location: Parser.location;
\r
39 instance_nature: Instantiation.instance_nature
\r
42 exception GenericError of error_description
\r
44 (* list of compilation errors*)
\r
46 ("_UnknownIdentifier", "0001");
\r
47 ("_EnumTypeDefWithDuplicLit", "0002");
\r
48 ("_EncapsulatedCannotBeAppliedTo", "0003");
\r
49 ("_InvalidTypeDef", "0004");
\r
50 ("_UnspecifiedEnumLits", "0005");
\r
51 ("_NotYetImplemented", "0006");
\r
52 ("_UnsupportedFeature", "0007"); (*to be documented*)
\r
53 ("_TypeConflictsInAssign", "0008"); (*to be documented*)
\r
54 ("_OperBetweenScalarAndArray", "0009");
\r
55 ("_ArrayDimMustAgreeToPerform", "0010");
\r
56 ("_FuncCallWithDuplicateArg", "0011");
\r
57 ("_TooManyArgsInFuncCall", "0012");
\r
58 ("_MixedPositAndNamedFuncArgPass", "0013");
\r
59 ("_TypeInconsistWithComparOper", "0014");
\r
60 ("_EquTermsNotOfTheSameType", "0015");
\r
61 ("_NonInputFuncArgElem", "0016");
\r
62 ("_OperAppliedToNonNumericExpr", "0017");
\r
63 ("_ArrayDimsNonCompatibleWithMult", "0018");
\r
64 ("_PowerOperOnNonSquareArray", "0019");
\r
65 ("_NonBooleanIfCondExpr", "0020");
\r
66 ("_TypeConflictsInIfAlternExprs", "0021");
\r
67 ("_OperAppliedToNonBoolExpr", "0022");
\r
68 ("_TypeInconsistentWithDivOper", "0023");
\r
69 ("_ElemExpected", "0024");
\r
70 ("_FinalElemModifNotAllowed", "0025");
\r
71 ("_TypeConflictsInVectorExpr", "0026");
\r
72 ("_EachAppliedToNonArrayElem", "0027");
\r
73 ("_InvalidExprInElemModif", "0028");
\r
74 ("_ClassElemFoundInExpr", "0029");
\r
75 ("_ArrayDimMismatchInEqu", "0030");
\r
76 ("_InvalidKeyWordEndInExpr", "0031");
\r
77 ("_InvalidTypeInRangeExpr", "0032");
\r
78 ("_InvalidExtensionDef", "0033");
\r
79 ("_InvalidUseOfEnumKeyword", "0034");
\r
80 ("_UseOfTypePrefixInShortClassDef", "0035");
\r
81 ("_UseOfSubsInShortClassDef", "0036");
\r
82 ("_NonEmptyFuncCallUsedAsAnEqu", "0037");
\r
83 ("_DuplicatedModifOfElem", "0038");
\r
84 ("_InvalidClassElemModif", "0039");
\r
85 ("_CannotAccessProtectElem", "0040");
\r
86 ("_CannotAccessOuterElem", "0041");
\r
87 ("_CannotSubscriptANonArrayTypeElem", "0042");
\r
88 ("_NonIntegerArraySubscript", "0043");
\r
89 ("_RangeStepValueCannotBeNull", "0044");
\r
90 ("_CannotInheritFrom", "0045");
\r
91 ("_AlreadyDeclaredInParentClass", "0046");
\r
92 ("_InheritFromDiffClassKindsNotAllowed", "0047");
\r
93 ("_InheritFromFunctionNotAllowed", "0048");
\r
94 ("_InvalidAnnOfInvFunc", "0049");
\r
95 ("_CannotUseCausPrefixInGenClass", "0050");
\r
96 ("_InvalidTypeOfArgInConnectStat", "0051");
\r
97 ("_CannotConnectFlowAndNonFlowComp", "0052");
\r
98 ("_InvalidTypeOfWhenCond", "0053");
\r
99 ("_InstanceUsedInConnection", "0054");
\r
100 ("_WhenClausesCannotBeNested", "0055");
\r
101 ("_InvalidWhenEquation", "0056");
\r
102 ("_WhenConditionMustBeDiscrete", "0057");
\r
103 ("_ArgTypeMismatch", "0058");
\r
104 ("_VariabilityConflicts", "0059"); (*to be documented*)
\r
105 ("_CannotUseNamedArgWithBuiltInOper", "0060");
\r
106 ("_OperArgMustBeAVar", "0061");
\r
107 ("_ArgVariabilityMismatch", "0062");
\r
108 ("_EquNotAllowedInTheDefOf", "0063");
\r
109 ("_OperCannotBeUsedWithinFuncDef", "0064");
\r
110 ("_ArgDimMismatchInVectCall", "0065");
\r
111 ("_ArgDimMismatch", "0066");
\r
112 ("_TooFewArgsInFuncCall", "0067");
\r
113 ("_LHSOfDiscreteEquMustBeAVar", "0068");
\r
114 ("_InvalidVarOfRangeExpr", "0069");
\r
115 ("_InvalidExternalFuncName", "0070"); (*to be documented*)
\r
116 ("_InvalidArgOfExternalCall", "0071"); (*to be documented*)
\r
117 ("_DuplicateDeclarationOfElement", "0072"); (* to be documented *)
\r
118 ("_InvalidArgOfOper", "0096"); (*to be documented*)
\r
119 ("_InvalidInteger", "0097") (*to be documented*)
\r
122 (* list of instantiation errors*)
\r
124 ("_NotYetImplemented", "1000");
\r
125 ("_ZeroRaisedToTheZeroPower", "1001");
\r
126 ("_MissingDeclEquForFixedId", "1002");
\r
127 ("_RealExponentOfNegativeNumber", "1003");
\r
128 ("_ZeroRaisedToNegativePower", "1004");
\r
129 ("_CannotAccessToPredefTypeAttrib", "1005"); (*to be documented*)
\r
130 ("_InvalidCondEquation", "1006"); (*to be documented*)
\r
131 ("_IndexOutOfBound", "1007"); (*to be documented*)
\r
132 ("_DivisionByZero", "1008") (*to be documented*)
\r
135 (* list of generic errors*)
\r
137 ("_NotYetImplemented", "2000")
\r
140 (* list of syntactic errors*)
\r
142 ("_Unclosed", "3000");
\r
143 ("_InvalidMatrixConstruct", "3001");
\r
144 ("_InvalidArrayConstruct", "3002");
\r
145 ("_SyntaxError", "3003");
\r
146 ("_IllegalCharacter", "3004")
\r
149 let getCode exn msg =
\r
152 | NameResolve.CompilError _ -> List.assoc msg ccodes
\r
153 | Instantiation.InstantError _ -> List.assoc msg icodes
\r
154 | GenericError _ -> List.assoc msg gcodes
\r
155 | Parser.SyntacticError _ -> List.assoc msg scodes
\r