Changeset 3c46939 in OpenModelica


Ignore:
Timestamp:
2020-10-21T14:46:11+02:00 (3 years ago)
Author:
Adrian Pop <adrian.pop@…>
Children:
8dbe6e6
Parents:
feadc57b
git-author:
Adrian Pop <adrian.pop@…> (10/09/20 15:08:54)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 14:46:11)
Message:

remove unqualified import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/FrontEnd/AbsynUtil.mo

    r6b807b93 r3c46939  
    3232encapsulated package AbsynUtil
    3333
    34 protected import Absyn.*;
     34protected import Absyn;
    3535protected import Dump;
    3636protected import Error;
     
    3939protected import Util;
    4040
    41 public constant ClassDef dummyParts = PARTS({},{},{},{},NONE());
    42 public constant Info dummyInfo = SOURCEINFO("",false,0,0,0,0,0.0);
    43 public constant Program dummyProgram = PROGRAM({},TOP());
     41public constant Absyn.ClassDef dummyParts = Absyn.PARTS({},{},{},{},NONE());
     42public constant Absyn.Info dummyInfo = SOURCEINFO("",false,0,0,0,0,0.0);
     43public constant Absyn.Program dummyProgram = Absyn.PROGRAM({},Absyn.TOP());
    4444
    4545replaceable type TypeA subtypeof Any;
     
    5252  "Traverses all subequations of an equation.
    5353   Takes a function and an extra argument passed through the traversal"
    54   input Equation inEquation;
     54  input Absyn.Equation inEquation;
    5555  input FuncTplToTpl inFunc;
    5656  input TypeA inTypeA;
    57   output tuple<Equation, TypeA> outTpl;
     57  output tuple<Absyn.Equation, TypeA> outTpl;
    5858
    5959  partial function FuncTplToTpl
    60     input tuple<Equation, TypeA> inTpl;
    61     output tuple<Equation, TypeA> outTpl;
     60    input tuple<Absyn.Equation, TypeA> inTpl;
     61    output tuple<Absyn.Equation, TypeA> outTpl;
    6262  end FuncTplToTpl;
    6363
     
    6666    local
    6767      TypeA arg,arg_1,arg_2,arg_3,arg_4;
    68       Equation eq,eq_1;
     68      Absyn.Equation eq,eq_1;
    6969      FuncTplToTpl rel;
    70       Exp e,e_1;
    71       list<EquationItem> eqilst,eqilst1,eqilst2,eqilst_1,eqilst1_1,eqilst2_1;
    72       list<tuple<Exp, list<EquationItem>>> eeqitlst,eeqitlst_1;
    73       ForIterators fis,fis_1;
    74       EquationItem ei,ei_1;
    75     case(eq as EQ_IF(e,eqilst1,eeqitlst,eqilst2),rel,arg)
     70      Absyn.Exp e,e_1;
     71      list<Absyn.EquationItem> eqilst,eqilst1,eqilst2,eqilst_1,eqilst1_1,eqilst2_1;
     72      list<tuple<Absyn.Exp, list<Absyn.EquationItem>>> eeqitlst,eeqitlst_1;
     73      Absyn.ForIterators fis,fis_1;
     74      Absyn.EquationItem ei,ei_1;
     75    case(eq as Absyn.EQ_IF(e,eqilst1,eeqitlst,eqilst2),rel,arg)
    7676      equation
    7777        ((eqilst1_1,arg_1)) = traverseEquationItemList(eqilst1,rel,arg);
    7878        ((eeqitlst_1,arg_2)) = traverseExpEqItemTupleList(eeqitlst,rel,arg_1);
    7979        ((eqilst2_1,arg_3)) = traverseEquationItemList(eqilst2,rel,arg_2);
    80         ((EQ_IF(),arg_4)) = rel((eq,arg_3));
    81       then
    82         ((EQ_IF(e,eqilst1_1,eeqitlst_1,eqilst2_1),arg_4));
    83     case(eq as EQ_FOR(_,eqilst),rel,arg)
     80        ((Absyn.EQ_IF(),arg_4)) = rel((eq,arg_3));
     81      then
     82        ((Absyn.EQ_IF(e,eqilst1_1,eeqitlst_1,eqilst2_1),arg_4));
     83    case(eq as Absyn.EQ_FOR(_,eqilst),rel,arg)
    8484      equation
    8585        ((eqilst_1,arg_1)) = traverseEquationItemList(eqilst,rel,arg);
    86         ((EQ_FOR(fis_1,_),arg_2)) = rel((eq,arg_1));
    87       then
    88         ((EQ_FOR(fis_1,eqilst_1),arg_2));
    89     case(eq as EQ_WHEN_E(_,eqilst,eeqitlst),rel,arg)
     86        ((Absyn.EQ_FOR(fis_1,_),arg_2)) = rel((eq,arg_1));
     87      then
     88        ((Absyn.EQ_FOR(fis_1,eqilst_1),arg_2));
     89    case(eq as Absyn.EQ_WHEN_E(_,eqilst,eeqitlst),rel,arg)
    9090      equation
    9191        ((eqilst_1,arg_1)) = traverseEquationItemList(eqilst,rel,arg);
    9292        ((eeqitlst_1,arg_2)) = traverseExpEqItemTupleList(eeqitlst,rel,arg_1);
    93         ((EQ_WHEN_E(e_1,_,_),arg_3)) = rel((eq,arg_2));
    94       then
    95         ((EQ_WHEN_E(e_1,eqilst_1,eeqitlst_1),arg_3));
    96     case(eq as EQ_FAILURE(ei),rel,arg)
     93        ((Absyn.EQ_WHEN_E(e_1,_,_),arg_3)) = rel((eq,arg_2));
     94      then
     95        ((Absyn.EQ_WHEN_E(e_1,eqilst_1,eeqitlst_1),arg_3));
     96    case(eq as Absyn.EQ_FAILURE(ei),rel,arg)
    9797      equation
    9898        ((ei_1,arg_1)) = traverseEquationItem(ei,rel,arg);
    99         ((EQ_FAILURE(),arg_2)) = rel((eq,arg_1));
    100       then
    101         ((EQ_FAILURE(ei_1),arg_2));
     99        ((Absyn.EQ_FAILURE(),arg_2)) = rel((eq,arg_1));
     100      then
     101        ((Absyn.EQ_FAILURE(ei_1),arg_2));
    102102    case(eq,rel,arg)
    103103      equation
     
    111111protected function traverseEquationItem
    112112"Traverses the equation inside an equationitem"
    113   input EquationItem inEquationItem;
     113  input Absyn.EquationItem inEquationItem;
    114114  input FuncTplToTpl inFunc;
    115115  input TypeA inTypeA;
    116   output tuple<EquationItem, TypeA> outTpl;
     116  output tuple<Absyn.EquationItem, TypeA> outTpl;
    117117  partial function FuncTplToTpl
    118     input tuple<Equation, TypeA> inTpl;
    119     output tuple<Equation, TypeA> outTpl;
     118    input tuple<Absyn.Equation, TypeA> inTpl;
     119    output tuple<Absyn.Equation, TypeA> outTpl;
    120120  end FuncTplToTpl;
    121121algorithm
    122122  outTpl := matchcontinue (inEquationItem,inFunc,inTypeA)
    123123    local
    124       EquationItem ei;
     124      Absyn.EquationItem ei;
    125125      FuncTplToTpl rel;
    126126      TypeA arg,arg_1;
    127       Equation eq,eq_1;
    128       Option<Comment> oc;
    129       Info info;
    130     case(EQUATIONITEM(eq,oc,info),rel,arg)
     127      Absyn.Equation eq,eq_1;
     128      Option<Absyn.Comment> oc;
     129      Absyn.Info info;
     130    case(Absyn.EQUATIONITEM(eq,oc,info),rel,arg)
    131131      equation
    132132        ((eq_1,arg_1)) = traverseEquation(eq,rel,arg);
    133133      then
    134         ((EQUATIONITEM(eq_1,oc,info),arg_1));
     134        ((Absyn.EQUATIONITEM(eq_1,oc,info),arg_1));
    135135    case(ei,_,arg) then ((ei,arg));
    136136  end matchcontinue;
     
    140140public function traverseEquationItemList
    141141"calls traverseEquationItem on every element of the given list"
    142   input list<EquationItem> inEquationItemList;
     142  input list<Absyn.EquationItem> inEquationItemList;
    143143  input FuncTplToTpl inFunc;
    144144  input TypeA inTypeA;
    145   output tuple<list<EquationItem>, TypeA> outTpl;
     145  output tuple<list<Absyn.EquationItem>, TypeA> outTpl;
    146146  partial function FuncTplToTpl
    147     input tuple<Equation, TypeA> inTpl;
    148     output tuple<Equation, TypeA> outTpl;
     147    input tuple<Absyn.Equation, TypeA> inTpl;
     148    output tuple<Absyn.Equation, TypeA> outTpl;
    149149  end FuncTplToTpl;
    150150protected
     
    153153  outTpl := (list(match el
    154154      local
    155         EquationItem ei,ei_1;
     155        Absyn.EquationItem ei,ei_1;
    156156      case (ei) equation
    157157        ((ei_1,arg2)) = traverseEquationItem(ei,inFunc,arg2);
     
    162162// stefan
    163163public function traverseExpEqItemTupleList
    164 "traverses a list of Exp * EquationItem list tuples
     164"traverses a list of Absyn.Exp * Absyn.EquationItem list tuples
    165165  mostly used for else-if blocks"
    166   input list<tuple<Exp, list<EquationItem>>> inList;
     166  input list<tuple<Absyn.Exp, list<Absyn.EquationItem>>> inList;
    167167  input FuncTplToTpl inFunc;
    168168  input TypeA inTypeA;
    169   output tuple<list<tuple<Exp, list<EquationItem>>>, TypeA> outTpl;
     169  output tuple<list<tuple<Absyn.Exp, list<Absyn.EquationItem>>>, TypeA> outTpl;
    170170  partial function FuncTplToTpl
    171     input tuple<Equation, TypeA> inTpl;
    172     output tuple<Equation, TypeA> outTpl;
     171    input tuple<Absyn.Equation, TypeA> inTpl;
     172    output tuple<Absyn.Equation, TypeA> outTpl;
    173173  end FuncTplToTpl;
    174174protected
     
    177177  outTpl := (list(match el
    178178      local
    179         Exp e;
    180         list<EquationItem> eilst,eilst_1;
     179        Absyn.Exp e;
     180        list<Absyn.EquationItem> eilst,eilst_1;
    181181      case (e,eilst) equation
    182182        ((eilst_1,arg2)) = traverseEquationItemList(eilst,inFunc,arg2);
     
    189189"Traverses all subalgorithms of an algorithm
    190190  Takes a function and an extra argument passed through the traversal"
    191   input Algorithm inAlgorithm;
     191  input Absyn.Algorithm inAlgorithm;
    192192  input FuncTplToTpl inFunc;
    193193  input TypeA inTypeA;
    194   output tuple<Algorithm, TypeA> outTpl;
     194  output tuple<Absyn.Algorithm, TypeA> outTpl;
    195195  partial function FuncTplToTpl
    196     input tuple<Algorithm, TypeA> inTpl;
    197     output tuple<Algorithm, TypeA> outTpl;
     196    input tuple<Absyn.Algorithm, TypeA> inTpl;
     197    output tuple<Absyn.Algorithm, TypeA> outTpl;
    198198  end FuncTplToTpl;
    199199algorithm
     
    201201    local
    202202      TypeA arg,arg_1,arg1_1,arg2_1,arg3_1;
    203       Algorithm alg,alg_1,alg1_1,alg2_1,alg3_1;
    204       list<AlgorithmItem> ailst,ailst1,ailst2,ailst_1,ailst1_1,ailst2_1;
    205       list<tuple<Exp, list<AlgorithmItem>>> eaitlst,eaitlst_1;
     203      Absyn.Algorithm alg,alg_1,alg1_1,alg2_1,alg3_1;
     204      list<Absyn.AlgorithmItem> ailst,ailst1,ailst2,ailst_1,ailst1_1,ailst2_1;
     205      list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> eaitlst,eaitlst_1;
    206206      FuncTplToTpl rel;
    207       AlgorithmItem ai,ai_1;
    208       Exp e,e_1;
    209       ForIterators fis,fis_1;
    210     case(alg as ALG_IF(_,ailst1,eaitlst,ailst2),rel,arg)
     207      Absyn.AlgorithmItem ai,ai_1;
     208      Absyn.Exp e,e_1;
     209      Absyn.ForIterators fis,fis_1;
     210    case(alg as Absyn.ALG_IF(_,ailst1,eaitlst,ailst2),rel,arg)
    211211      equation
    212212        ((ailst1_1,arg1_1)) = traverseAlgorithmItemList(ailst1,rel,arg);
    213213        ((eaitlst_1,arg2_1)) = traverseExpAlgItemTupleList(eaitlst,rel,arg1_1);
    214214        ((ailst2_1,arg3_1)) = traverseAlgorithmItemList(ailst2,rel,arg2_1);
    215         ((ALG_IF(e_1,_,_,_),arg_1)) = rel((alg,arg3_1));
    216       then
    217         ((ALG_IF(e_1,ailst1_1,eaitlst_1,ailst2_1),arg_1));
    218     case(alg as ALG_FOR(_,ailst),rel,arg)
     215        ((Absyn.ALG_IF(e_1,_,_,_),arg_1)) = rel((alg,arg3_1));
     216      then
     217        ((Absyn.ALG_IF(e_1,ailst1_1,eaitlst_1,ailst2_1),arg_1));
     218    case(alg as Absyn.ALG_FOR(_,ailst),rel,arg)
    219219      equation
    220220        ((ailst_1,arg1_1)) = traverseAlgorithmItemList(ailst,rel,arg);
    221         ((ALG_FOR(fis_1,_),arg_1)) = rel((alg,arg1_1));
    222       then
    223         ((ALG_FOR(fis_1,ailst_1),arg_1));
    224     case(alg as ALG_PARFOR(_,ailst),rel,arg)
     221        ((Absyn.ALG_FOR(fis_1,_),arg_1)) = rel((alg,arg1_1));
     222      then
     223        ((Absyn.ALG_FOR(fis_1,ailst_1),arg_1));
     224    case(alg as Absyn.ALG_PARFOR(_,ailst),rel,arg)
    225225      equation
    226226        ((ailst_1,arg1_1)) = traverseAlgorithmItemList(ailst,rel,arg);
    227         ((ALG_PARFOR(fis_1,_),arg_1)) = rel((alg,arg1_1));
    228       then
    229         ((ALG_PARFOR(fis_1,ailst_1),arg_1));
    230     case(alg as ALG_WHILE(_,ailst),rel,arg)
     227        ((Absyn.ALG_PARFOR(fis_1,_),arg_1)) = rel((alg,arg1_1));
     228      then
     229        ((Absyn.ALG_PARFOR(fis_1,ailst_1),arg_1));
     230    case(alg as Absyn.ALG_WHILE(_,ailst),rel,arg)
    231231      equation
    232232        ((ailst_1,arg1_1)) = traverseAlgorithmItemList(ailst,rel,arg);
    233         ((ALG_WHILE(e_1,_),arg_1)) = rel((alg,arg1_1));
    234       then
    235         ((ALG_WHILE(e_1,ailst_1),arg_1));
    236     case(alg as ALG_WHEN_A(_,ailst,eaitlst),rel,arg)
     233        ((Absyn.ALG_WHILE(e_1,_),arg_1)) = rel((alg,arg1_1));
     234      then
     235        ((Absyn.ALG_WHILE(e_1,ailst_1),arg_1));
     236    case(alg as Absyn.ALG_WHEN_A(_,ailst,eaitlst),rel,arg)
    237237      equation
    238238        ((ailst_1,arg1_1)) = traverseAlgorithmItemList(ailst,rel,arg);
    239239        ((eaitlst_1,arg2_1)) = traverseExpAlgItemTupleList(eaitlst,rel,arg1_1);
    240         ((ALG_WHEN_A(e_1,_,_),arg_1)) = rel((alg,arg2_1));
    241       then
    242         ((ALG_WHEN_A(e_1,ailst_1,eaitlst_1),arg_1));
     240        ((Absyn.ALG_WHEN_A(e_1,_,_),arg_1)) = rel((alg,arg2_1));
     241      then
     242        ((Absyn.ALG_WHEN_A(e_1,ailst_1,eaitlst_1),arg_1));
    243243    case(alg,rel,arg)
    244244      equation
     
    251251// stefan
    252252public function traverseAlgorithmItem
    253 "traverses the Algorithm contained in an AlgorithmItem, if any
     253"traverses the Absyn.Algorithm contained in an Absyn.AlgorithmItem, if any
    254254  see traverseAlgorithm"
    255   input AlgorithmItem inAlgorithmItem;
     255  input Absyn.AlgorithmItem inAlgorithmItem;
    256256  input FuncTplToTpl inFunc;
    257257  input TypeA inTypeA;
    258   output tuple<AlgorithmItem, TypeA> outTpl;
     258  output tuple<Absyn.AlgorithmItem, TypeA> outTpl;
    259259  partial function FuncTplToTpl
    260     input tuple<Algorithm, TypeA> inTpl;
    261     output tuple<Algorithm, TypeA> outTpl;
     260    input tuple<Absyn.Algorithm, TypeA> inTpl;
     261    output tuple<Absyn.Algorithm, TypeA> outTpl;
    262262  end FuncTplToTpl;
    263263algorithm
     
    266266      FuncTplToTpl rel;
    267267      TypeA arg,arg_1;
    268       Algorithm alg,alg_1;
    269       Option<Comment> oc;
    270       AlgorithmItem ai;
    271       Info info;
    272     case(ALGORITHMITEM(alg,oc,info),rel,arg)
     268      Absyn.Algorithm alg,alg_1;
     269      Option<Absyn.Comment> oc;
     270      Absyn.AlgorithmItem ai;
     271      Absyn.Info info;
     272    case(Absyn.ALGORITHMITEM(alg,oc,info),rel,arg)
    273273      equation
    274274        ((alg_1,arg_1)) = traverseAlgorithm(alg,rel,arg);
    275275      then
    276         ((ALGORITHMITEM(alg_1,oc,info),arg_1));
     276        ((Absyn.ALGORITHMITEM(alg_1,oc,info),arg_1));
    277277    case(ai,_,arg) then ((ai,arg));
    278278  end matchcontinue;
     
    282282public function traverseAlgorithmItemList
    283283"calls traverseAlgorithmItem on each item in a list of AlgorithmItems"
    284   input list<AlgorithmItem> inAlgorithmItemList;
     284  input list<Absyn.AlgorithmItem> inAlgorithmItemList;
    285285  input FuncTplToTpl inFunc;
    286286  input TypeA inTypeA;
    287   output tuple<list<AlgorithmItem>, TypeA> outTpl;
     287  output tuple<list<Absyn.AlgorithmItem>, TypeA> outTpl;
    288288  partial function FuncTplToTpl
    289     input tuple<Algorithm, TypeA> inTpl;
    290     output tuple<Algorithm, TypeA> outTpl;
     289    input tuple<Absyn.Algorithm, TypeA> inTpl;
     290    output tuple<Absyn.Algorithm, TypeA> outTpl;
    291291  end FuncTplToTpl;
    292292algorithm
     
    295295      FuncTplToTpl rel;
    296296      TypeA arg,arg_1,arg_2;
    297       AlgorithmItem ai,ai_1;
    298       list<AlgorithmItem> cdr,cdr_1;
     297      Absyn.AlgorithmItem ai,ai_1;
     298      list<Absyn.AlgorithmItem> cdr,cdr_1;
    299299    case({},_,arg) then (({},arg));
    300300    case(ai :: cdr,rel,arg)
     
    309309// stefan
    310310public function traverseExpAlgItemTupleList
    311 "traverses a list of Exp * AlgorithmItem list tuples
     311"traverses a list of Absyn.Exp * Absyn.AlgorithmItem list tuples
    312312  mostly used for else-if blocks"
    313   input list<tuple<Exp, list<AlgorithmItem>>> inList;
     313  input list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> inList;
    314314  input FuncTplToTpl inFunc;
    315315  input TypeA inTypeA;
    316   output tuple<list<tuple<Exp, list<AlgorithmItem>>>, TypeA> outTpl;
     316  output tuple<list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>>, TypeA> outTpl;
    317317  partial function FuncTplToTpl
    318     input tuple<Algorithm, TypeA> inTpl;
    319     output tuple<Algorithm, TypeA> outTpl;
     318    input tuple<Absyn.Algorithm, TypeA> inTpl;
     319    output tuple<Absyn.Algorithm, TypeA> outTpl;
    320320  end FuncTplToTpl;
    321321algorithm
     
    324324      FuncTplToTpl rel;
    325325      TypeA arg,arg_1,arg_2;
    326       list<tuple<Exp, list<AlgorithmItem>>> cdr,cdr_1;
    327       Exp e;
    328       list<AlgorithmItem> ailst,ailst_1;
     326      list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> cdr,cdr_1;
     327      Absyn.Exp e;
     328      list<Absyn.AlgorithmItem> ailst,ailst_1;
    329329    case({},_,arg) then (({},arg));
    330330    case((e,ailst) :: cdr,rel,arg)
     
    338338
    339339public function traverseExp
    340 " Traverses all subexpressions of an Exp expression.
     340" Traverses all subexpressions of an Absyn.Exp expression.
    341341  Takes a function and an extra argument passed through the traversal.
    342342  NOTE:This function was copied from Expression.traverseExpression."
    343   input Exp inExp;
     343  input Absyn.Exp inExp;
    344344  input FuncType inFunc;
    345345  input Type_a inArg;
    346   output Exp outExp;
     346  output Absyn.Exp outExp;
    347347  output Type_a outArg;
    348348  partial function FuncType
    349     input Exp inExp;
     349    input Absyn.Exp inExp;
    350350    input Type_a inArg;
    351     output Exp outExp;
     351    output Absyn.Exp outExp;
    352352    output Type_a outArg;
    353353  end FuncType;
     
    357357
    358358public function traverseExpTopDown
    359 " Traverses all subexpressions of an Exp expression.
     359" Traverses all subexpressions of an Absyn.Exp expression.
    360360  Takes a function and an extra argument passed through the traversal."
    361   input Exp inExp;
     361  input Absyn.Exp inExp;
    362362  input FuncType inFunc;
    363363  input Type_a inArg;
    364   output Exp outExp;
     364  output Absyn.Exp outExp;
    365365  output Type_a outArg;
    366366  partial function FuncType
    367     input Exp inExp;
     367    input Absyn.Exp inExp;
    368368    input Type_a inArg;
    369     output Exp outExp;
     369    output Absyn.Exp outExp;
    370370    output Type_a outArg;
    371371  end FuncType;
     
    376376public function traverseExpList
    377377"calls traverseExp on each element in the given list"
    378   input list<Exp> inExpList;
     378  input list<Absyn.Exp> inExpList;
    379379  input FuncTplToTpl inFunc;
    380380  input Type_a inArg;
    381   output list<Exp> outExpList;
     381  output list<Absyn.Exp> outExpList;
    382382  output Type_a outArg;
    383383  partial function FuncTplToTpl
    384     input Exp inExp;
     384    input Absyn.Exp inExp;
    385385    input Type_a inArg;
    386     output Exp outExp;
     386    output Absyn.Exp outExp;
    387387    output Type_a outArg;
    388388  end FuncTplToTpl;
     
    394394  "Traverses a list of expressions, calling traverseExpBidir on each
    395395  expression."
    396   input list<Exp> inExpl;
     396  input list<Absyn.Exp> inExpl;
    397397  input FuncType enterFunc;
    398398  input FuncType exitFunc;
    399399  input Argument inArg;
    400   output list<Exp> outExpl;
     400  output list<Absyn.Exp> outExpl;
    401401  output Argument outArg;
    402402  partial function FuncType
    403     input Exp inExp;
     403    input Absyn.Exp inExp;
    404404    input Argument inArg;
    405     output Exp outExp;
     405    output Absyn.Exp outExp;
    406406    output Argument outArg;
    407407  end FuncType;
     
    418418  the updated argument. This means that this function is bidirectional, and can
    419419  be used to emulate both top-down and bottom-up traversal."
    420   input Exp inExp;
     420  input Absyn.Exp inExp;
    421421  input FuncType enterFunc;
    422422  input FuncType exitFunc;
    423423  input Argument inArg;
    424   output Exp e;
     424  output Absyn.Exp e;
    425425  output Argument arg;
    426426
    427427  partial function FuncType
    428     input Exp inExp;
     428    input Absyn.Exp inExp;
    429429    input Argument inArg;
    430     output Exp outExp;
     430    output Absyn.Exp outExp;
    431431    output Argument outArg;
    432432  end FuncType;
     
    442442  traverseExpBidir if the option is SOME(), or just returns the input if it's
    443443  NONE()"
    444   input Option<Exp> inExp;
     444  input Option<Absyn.Exp> inExp;
    445445  input FuncType enterFunc;
    446446  input FuncType exitFunc;
    447447  input Argument inArg;
    448   output Option<Exp> outExp;
     448  output Option<Absyn.Exp> outExp;
    449449  output Argument arg;
    450450
    451451  partial function FuncType
    452     input Exp inExp;
     452    input Absyn.Exp inExp;
    453453    input Argument inArg;
    454     output Exp outExp;
     454    output Absyn.Exp outExp;
    455455    output Argument outArg;
    456456  end FuncType;
     
    459459  (outExp, arg) := match(inExp, enterFunc, exitFunc, inArg)
    460460    local
    461       Exp e1,e2;
     461      Absyn.Exp e1,e2;
    462462      tuple<FuncType, FuncType, Argument> tup;
    463463
     
    475475  "Helper function to traverseExpBidir. Traverses the subexpressions of an
    476476  expression and calls traverseExpBidir on them."
    477   input Exp inExp;
     477  input Absyn.Exp inExp;
    478478  input FuncType enterFunc;
    479479  input FuncType exitFunc;
    480480  input Argument inArg;
    481   output Exp e;
     481  output Absyn.Exp e;
    482482  output Argument arg;
    483483
    484484  partial function FuncType
    485     input Exp inExp;
     485    input Absyn.Exp inExp;
    486486    input Argument inArg;
    487     output Exp outExp;
     487    output Absyn.Exp outExp;
    488488    output Argument outArg;
    489489  end FuncType;
     
    492492  (e, arg) := match (inExp, enterFunc, exitFunc, inArg)
    493493    local
    494       Exp e1, e1m, e2, e2m, e3, e3m;
    495       Option<Exp> oe1, oe1m;
     494      Absyn.Exp e1, e1m, e2, e2m, e3, e3m;
     495      Option<Absyn.Exp> oe1, oe1m;
    496496      tuple<FuncType, FuncType, Argument> tup;
    497       Operator op;
    498       ComponentRef cref, crefm;
    499       list<tuple<Exp, Exp>> else_ifs1,else_ifs2;
    500       list<Exp> expl1,expl2;
    501       list<list<Exp>> mat_expl;
    502       FunctionArgs fargs1,fargs2;
     497      Absyn.Operator op;
     498      Absyn.ComponentRef cref, crefm;
     499      list<tuple<Absyn.Exp, Absyn.Exp>> else_ifs1,else_ifs2;
     500      list<Absyn.Exp> expl1,expl2;
     501      list<list<Absyn.Exp>> mat_expl;
     502      Absyn.FunctionArgs fargs1,fargs2;
    503503      String error_msg;
    504       Ident id, enterName, exitName;
    505       MatchType match_ty;
    506       list<ElementItem> match_decls;
    507       list<Case> match_cases;
     504      Absyn.Ident id, enterName, exitName;
     505      Absyn.MatchType match_ty;
     506      list<Absyn.ElementItem> match_decls;
     507      list<Absyn.Case> match_cases;
    508508      Option<String> cmt;
    509509
    510     case (INTEGER(), _, _, _) then (inExp, inArg);
    511     case (REAL(), _, _, _) then (inExp, inArg);
    512     case (STRING(), _, _, _) then (inExp, inArg);
    513     case (BOOL(), _, _, _) then (inExp, inArg);
    514 
    515     case (CREF(componentRef = cref), _, _, arg)
     510    case (Absyn.INTEGER(), _, _, _) then (inExp, inArg);
     511    case (Absyn.REAL(), _, _, _) then (inExp, inArg);
     512    case (Absyn.STRING(), _, _, _) then (inExp, inArg);
     513    case (Absyn.BOOL(), _, _, _) then (inExp, inArg);
     514
     515    case (Absyn.CREF(componentRef = cref), _, _, arg)
    516516      equation
    517517        (crefm, arg) = traverseExpBidirCref(cref, enterFunc, exitFunc, arg);
    518518      then
    519         (if referenceEq(cref,crefm) then inExp else CREF(crefm), arg);
    520 
    521     case (BINARY(exp1 = e1, op = op, exp2 = e2), _, _, arg)
     519        (if referenceEq(cref,crefm) then inExp else Absyn.CREF(crefm), arg);
     520
     521    case (Absyn.BINARY(exp1 = e1, op = op, exp2 = e2), _, _, arg)
    522522      equation
    523523        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    524524        (e2m, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    525525      then
    526         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else BINARY(e1m, op, e2m), arg);
    527 
    528     case (UNARY(op = op, exp = e1), _, _, arg)
     526        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else Absyn.BINARY(e1m, op, e2m), arg);
     527
     528    case (Absyn.UNARY(op = op, exp = e1), _, _, arg)
    529529      equation
    530530        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    531531      then
    532         (if referenceEq(e1,e1m) then inExp else UNARY(op, e1m), arg);
    533 
    534     case (LBINARY(exp1 = e1, op = op, exp2 = e2), _, _, arg)
     532        (if referenceEq(e1,e1m) then inExp else Absyn.UNARY(op, e1m), arg);
     533
     534    case (Absyn.LBINARY(exp1 = e1, op = op, exp2 = e2), _, _, arg)
    535535      equation
    536536        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    537537        (e2m, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    538538      then
    539         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else LBINARY(e1m, op, e2m), arg);
    540 
    541     case (LUNARY(op = op, exp = e1), _, _, arg)
     539        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else Absyn.LBINARY(e1m, op, e2m), arg);
     540
     541    case (Absyn.LUNARY(op = op, exp = e1), _, _, arg)
    542542      equation
    543543        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    544544      then
    545         (if referenceEq(e1,e1m) then inExp else LUNARY(op, e1m), arg);
    546 
    547     case (RELATION(exp1 = e1, op = op, exp2 = e2), _, _, arg)
     545        (if referenceEq(e1,e1m) then inExp else Absyn.LUNARY(op, e1m), arg);
     546
     547    case (Absyn.RELATION(exp1 = e1, op = op, exp2 = e2), _, _, arg)
    548548      equation
    549549        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    550550        (e2m, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    551551      then
    552         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else RELATION(e1m, op, e2m), arg);
    553 
    554     case (IFEXP(ifExp = e1, trueBranch = e2, elseBranch = e3,
     552        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else Absyn.RELATION(e1m, op, e2m), arg);
     553
     554    case (Absyn.IFEXP(ifExp = e1, trueBranch = e2, elseBranch = e3,
    555555        elseIfBranch = else_ifs1), _, _, arg)
    556556      equation
     
    560560        (else_ifs2, arg) = List.map2FoldCheckReferenceEq(else_ifs1, traverseExpBidirElseIf, enterFunc, exitFunc, arg);
    561561      then
    562         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) and referenceEq(e3,e3m) and referenceEq(else_ifs1,else_ifs2) then inExp else IFEXP(e1m, e2m, e3m, else_ifs2), arg);
    563 
    564     case (CALL(function_ = cref, functionArgs = fargs1), _, _, arg)
     562        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) and referenceEq(e3,e3m) and referenceEq(else_ifs1,else_ifs2) then inExp else Absyn.IFEXP(e1m, e2m, e3m, else_ifs2), arg);
     563
     564    case (Absyn.CALL(function_ = cref, functionArgs = fargs1), _, _, arg)
    565565      equation
    566566        (fargs2, arg) = traverseExpBidirFunctionArgs(fargs1, enterFunc, exitFunc, arg);
    567567      then
    568         (if referenceEq(fargs1,fargs2) then inExp else CALL(cref, fargs2), arg);
    569 
    570     case (PARTEVALFUNCTION(function_ = cref, functionArgs = fargs1), _, _, arg)
     568        (if referenceEq(fargs1,fargs2) then inExp else Absyn.CALL(cref, fargs2), arg);
     569
     570    case (Absyn.PARTEVALFUNCTION(function_ = cref, functionArgs = fargs1), _, _, arg)
    571571      equation
    572572        (fargs2, arg) = traverseExpBidirFunctionArgs(fargs1, enterFunc, exitFunc, arg);
    573573      then
    574         (if referenceEq(fargs1,fargs2) then inExp else PARTEVALFUNCTION(cref, fargs2), arg);
    575 
    576     case (ARRAY(arrayExp = expl1), _, _, arg)
     574        (if referenceEq(fargs1,fargs2) then inExp else Absyn.PARTEVALFUNCTION(cref, fargs2), arg);
     575
     576    case (Absyn.ARRAY(arrayExp = expl1), _, _, arg)
    577577      equation
    578578        (expl2, arg) = traverseExpListBidir(expl1, enterFunc, exitFunc, arg);
    579579      then
    580         (if referenceEq(expl1,expl2) then inExp else ARRAY(expl2), arg);
    581 
    582     case (MATRIX(matrix = mat_expl), _, _, arg)
     580        (if referenceEq(expl1,expl2) then inExp else Absyn.ARRAY(expl2), arg);
     581
     582    case (Absyn.MATRIX(matrix = mat_expl), _, _, arg)
    583583      equation
    584584        (mat_expl, arg) = List.map2FoldCheckReferenceEq(mat_expl, traverseExpListBidir, enterFunc, exitFunc, arg);
    585585      then
    586         (MATRIX(mat_expl), arg);
    587 
    588     case (RANGE(start = e1, step = oe1, stop = e2), _, _, arg)
     586        (Absyn.MATRIX(mat_expl), arg);
     587
     588    case (Absyn.RANGE(start = e1, step = oe1, stop = e2), _, _, arg)
    589589      equation
    590590        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
     
    592592        (e2m, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    593593      then
    594         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) and referenceEq(oe1,oe1m) then inExp else RANGE(e1m, oe1m, e2m), arg);
    595 
    596     case (END(), _, _, _) then (inExp, inArg);
    597 
    598     case (TUPLE(expressions = expl1), _, _, arg)
     594        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) and referenceEq(oe1,oe1m) then inExp else Absyn.RANGE(e1m, oe1m, e2m), arg);
     595
     596    case (Absyn.END(), _, _, _) then (inExp, inArg);
     597
     598    case (Absyn.TUPLE(expressions = expl1), _, _, arg)
    599599      equation
    600600        (expl2, arg) = traverseExpListBidir(expl1, enterFunc, exitFunc, arg);
    601601      then
    602         (if referenceEq(expl1,expl2) then inExp else TUPLE(expl2), arg);
    603 
    604     case (AS(id = id, exp = e1), _, _, arg)
     602        (if referenceEq(expl1,expl2) then inExp else Absyn.TUPLE(expl2), arg);
     603
     604    case (Absyn.AS(id = id, exp = e1), _, _, arg)
    605605      equation
    606606        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    607607      then
    608         (if referenceEq(e1,e1m) then inExp else AS(id, e1m), arg);
    609 
    610     case (CONS(head = e1, rest = e2), _, _, arg)
     608        (if referenceEq(e1,e1m) then inExp else Absyn.AS(id, e1m), arg);
     609
     610    case (Absyn.CONS(head = e1, rest = e2), _, _, arg)
    611611      equation
    612612        (e1m, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    613613        (e2m, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    614614      then
    615         (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else CONS(e1m, e2m), arg);
    616 
    617     case (MATCHEXP(matchTy = match_ty, inputExp = e1, localDecls = match_decls,
     615        (if referenceEq(e1,e1m) and referenceEq(e2,e2m) then inExp else Absyn.CONS(e1m, e2m), arg);
     616
     617    case (Absyn.MATCHEXP(matchTy = match_ty, inputExp = e1, localDecls = match_decls,
    618618        cases = match_cases, comment = cmt), _, _, arg)
    619619      equation
     
    621621        (match_cases, arg) = List.map2FoldCheckReferenceEq(match_cases, traverseMatchCase, enterFunc, exitFunc, arg);
    622622      then
    623         (MATCHEXP(match_ty, e1, match_decls, match_cases, cmt), arg);
    624 
    625     case (LIST(exps = expl1), _, _, arg)
     623        (Absyn.MATCHEXP(match_ty, e1, match_decls, match_cases, cmt), arg);
     624
     625    case (Absyn.LIST(exps = expl1), _, _, arg)
    626626      equation
    627627        (expl2, arg) = traverseExpListBidir(expl1, enterFunc, exitFunc, arg);
    628628      then
    629         (if referenceEq(expl1,expl2) then inExp else LIST(expl2), arg);
    630 
    631     case (CODE(), _, _, _)
     629        (if referenceEq(expl1,expl2) then inExp else Absyn.LIST(expl2), arg);
     630
     631    case (Absyn.CODE(), _, _, _)
    632632      then (inExp, inArg);
    633633
    634     case (DOT(), _, _, arg)
     634    case (Absyn.DOT(), _, _, arg)
    635635      equation
    636636        (e1, arg) = traverseExpBidir(inExp.exp, enterFunc, exitFunc, arg);
    637637        (e2, arg) = traverseExpBidir(inExp.index, enterFunc, exitFunc, arg);
    638638      then
    639         (if referenceEq(inExp.exp,e1) and referenceEq(inExp.index,e2) then inExp else DOT(e1, e2), arg);
     639        (if referenceEq(inExp.exp,e1) and referenceEq(inExp.index,e2) then inExp else Absyn.DOT(e1, e2), arg);
    640640
    641641    else
     
    655655  "Helper function to traverseExpBidirSubExps. Traverses any expressions in a
    656656  component reference (i.e. in it's subscripts)."
    657   input ComponentRef inCref;
     657  input Absyn.ComponentRef inCref;
    658658  input FuncType enterFunc;
    659659  input FuncType exitFunc;
    660660  input Argument inArg;
    661   output ComponentRef outCref;
     661  output Absyn.ComponentRef outCref;
    662662  output Argument arg;
    663663
    664664  partial function FuncType
    665     input Exp inExp;
     665    input Absyn.Exp inExp;
    666666    input Argument inArg;
    667     output Exp outExp;
     667    output Absyn.Exp outExp;
    668668    output Argument outArg;
    669669  end FuncType;
     
    672672  (outCref, arg) := match(inCref, enterFunc, exitFunc, inArg)
    673673    local
    674       Ident name;
    675       ComponentRef cr1,cr2;
    676       list<Subscript> subs1,subs2;
     674      Absyn.Ident name;
     675      Absyn.ComponentRef cr1,cr2;
     676      list<Absyn.Subscript> subs1,subs2;
    677677      tuple<FuncType, FuncType, Argument> tup;
    678678
    679     case (CREF_FULLYQUALIFIED(componentRef = cr1), _, _, arg)
     679    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr1), _, _, arg)
    680680      equation
    681681        (cr2, arg) = traverseExpBidirCref(cr1, enterFunc, exitFunc, arg);
     
    683683        (if referenceEq(cr1,cr2) then inCref else crefMakeFullyQualified(cr2), arg);
    684684
    685     case (CREF_QUAL(name = name, subscripts = subs1, componentRef = cr1), _, _, arg)
     685    case (Absyn.CREF_QUAL(name = name, subscripts = subs1, componentRef = cr1), _, _, arg)
    686686      equation
    687687        (subs2, arg) = List.map2FoldCheckReferenceEq(subs1, traverseExpBidirSubs, enterFunc, exitFunc, arg);
    688688        (cr2, arg) = traverseExpBidirCref(cr1, enterFunc, exitFunc, arg);
    689689      then
    690         (if referenceEq(cr1,cr2) and referenceEq(subs1,subs2) then inCref else CREF_QUAL(name, subs2, cr2), arg);
    691 
    692     case (CREF_IDENT(name = name, subscripts = subs1), _, _, arg)
     690        (if referenceEq(cr1,cr2) and referenceEq(subs1,subs2) then inCref else Absyn.CREF_QUAL(name, subs2, cr2), arg);
     691
     692    case (Absyn.CREF_IDENT(name = name, subscripts = subs1), _, _, arg)
    693693      equation
    694694        (subs2, arg) = List.map2FoldCheckReferenceEq(subs1, traverseExpBidirSubs, enterFunc, exitFunc, arg);
    695695      then
    696         (if referenceEq(subs1,subs2) then inCref else CREF_IDENT(name, subs2), arg);
    697 
    698     case (ALLWILD(), _, _, _) then (inCref, inArg);
    699     case (WILD(), _, _, _) then (inCref, inArg);
     696        (if referenceEq(subs1,subs2) then inCref else Absyn.CREF_IDENT(name, subs2), arg);
     697
     698    case (Absyn.ALLWILD(), _, _, _) then (inCref, inArg);
     699    case (Absyn.WILD(), _, _, _) then (inCref, inArg);
    700700  end match;
    701701end traverseExpBidirCref;
     
    704704  "Helper function to traverseExpBidirCref. Traverses expressions in a
    705705  subscript."
    706   input Subscript inSubscript;
     706  input Absyn.Subscript inSubscript;
    707707  input FuncType enterFunc;
    708708  input FuncType exitFunc;
    709709  input Argument inArg;
    710   output Subscript outSubscript;
     710  output Absyn.Subscript outSubscript;
    711711  output Argument arg;
    712712
    713713  partial function FuncType
    714     input Exp inExp;
     714    input Absyn.Exp inExp;
    715715    input Argument inArg;
    716     output Exp outExp;
     716    output Absyn.Exp outExp;
    717717    output Argument outArg;
    718718  end FuncType;
     
    721721  (outSubscript, arg) := match(inSubscript, enterFunc, exitFunc, inArg)
    722722    local
    723       Exp e1,e2;
    724 
    725     case (SUBSCRIPT(subscript = e1), _, _, arg)
     723      Absyn.Exp e1,e2;
     724
     725    case (Absyn.SUBSCRIPT(subscript = e1), _, _, arg)
    726726      equation
    727727        (e2, arg) = traverseExpBidir(e1, enterFunc, exitFunc, inArg);
    728728      then
    729         (if referenceEq(e1,e2) then inSubscript else SUBSCRIPT(e2), arg);
    730 
    731     case (NOSUB(), _, _, _) then (inSubscript, inArg);
     729        (if referenceEq(e1,e2) then inSubscript else Absyn.SUBSCRIPT(e2), arg);
     730
     731    case (Absyn.NOSUB(), _, _, _) then (inSubscript, inArg);
    732732  end match;
    733733end traverseExpBidirSubs;
     
    736736  "Helper function to traverseExpBidirSubExps. Traverses the expressions in an
    737737  elseif branch."
    738   input tuple<Exp, Exp> inElseIf;
     738  input tuple<Absyn.Exp, Absyn.Exp> inElseIf;
    739739  input FuncType enterFunc;
    740740  input FuncType exitFunc;
    741741  input Argument inArg;
    742   output tuple<Exp, Exp> outElseIf;
     742  output tuple<Absyn.Exp, Absyn.Exp> outElseIf;
    743743  output Argument arg;
    744744
    745745  partial function FuncType
    746     input Exp inExp;
     746    input Absyn.Exp inExp;
    747747    input Argument inArg;
    748     output Exp outExp;
     748    output Absyn.Exp outExp;
    749749    output Argument outArg;
    750750  end FuncType;
    751751
    752752protected
    753   Exp e1, e2;
     753  Absyn.Exp e1, e2;
    754754  tuple<FuncType, FuncType, Argument> tup;
    755755algorithm
     
    763763  "Helper function to traverseExpBidirSubExps. Traverses the expressions in a
    764764  list of function argument."
    765   input FunctionArgs inArgs;
     765  input Absyn.FunctionArgs inArgs;
    766766  input FuncType enterFunc;
    767767  input FuncType exitFunc;
    768768  input Argument inArg;
    769   output FunctionArgs outArgs;
     769  output Absyn.FunctionArgs outArgs;
    770770  output Argument outArg;
    771771
    772772  partial function FuncType
    773     input Exp inExp;
     773    input Absyn.Exp inExp;
    774774    input Argument inArg;
    775     output Exp outExp;
     775    output Absyn.Exp outExp;
    776776    output Argument outArg;
    777777  end FuncType;
     
    780780  (outArgs, outArg) := match(inArgs, enterFunc, exitFunc, inArg)
    781781    local
    782       Exp e1,e2;
    783       list<Exp> expl1,expl2;
    784       list<NamedArg> named_args1,named_args2;
    785       ForIterators iters1,iters2;
     782      Absyn.Exp e1,e2;
     783      list<Absyn.Exp> expl1,expl2;
     784      list<Absyn.NamedArg> named_args1,named_args2;
     785      Absyn.ForIterators iters1,iters2;
    786786      Argument arg;
    787       ReductionIterType iterType;
    788 
    789     case (FUNCTIONARGS(args = expl1, argNames = named_args1), _, _, arg)
     787      Absyn.ReductionIterType iterType;
     788
     789    case (Absyn.FUNCTIONARGS(args = expl1, argNames = named_args1), _, _, arg)
    790790      equation
    791791        (expl2, arg) = traverseExpListBidir(expl1, enterFunc, exitFunc, arg);
    792792        (named_args2, arg) = List.map2FoldCheckReferenceEq(named_args1, traverseExpBidirNamedArg, enterFunc, exitFunc, arg);
    793793      then
    794         (if referenceEq(expl1,expl2) and referenceEq(named_args1,named_args2) then inArgs else FUNCTIONARGS(expl2, named_args2), arg);
    795 
    796     case (FOR_ITER_FARG(e1, iterType, iters1), _, _, arg)
     794        (if referenceEq(expl1,expl2) and referenceEq(named_args1,named_args2) then inArgs else Absyn.FUNCTIONARGS(expl2, named_args2), arg);
     795
     796    case (Absyn.FOR_ITER_FARG(e1, iterType, iters1), _, _, arg)
    797797      equation
    798798        (e2, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    799799        (iters2, arg) = List.map2FoldCheckReferenceEq(iters1, traverseExpBidirIterator, enterFunc, exitFunc, arg);
    800800      then
    801         (if referenceEq(e1,e2) and referenceEq(iters1,iters2) then inArgs else FOR_ITER_FARG(e2, iterType, iters2), arg);
     801        (if referenceEq(e1,e2) and referenceEq(iters1,iters2) then inArgs else Absyn.FOR_ITER_FARG(e2, iterType, iters2), arg);
    802802  end match;
    803803end traverseExpBidirFunctionArgs;
     
    806806  "Helper function to traverseExpBidirFunctionArgs. Traverses the expressions in
    807807  a named function argument."
    808   input NamedArg inArg;
     808  input Absyn.NamedArg inArg;
    809809  input FuncType enterFunc;
    810810  input FuncType exitFunc;
    811811  input Argument inExtra;
    812   output NamedArg outArg;
     812  output Absyn.NamedArg outArg;
    813813  output Argument outExtra;
    814814
    815815  partial function FuncType
    816     input Exp inExp;
     816    input Absyn.Exp inExp;
    817817    input Argument inArg;
    818     output Exp outExp;
     818    output Absyn.Exp outExp;
    819819    output Argument outArg;
    820820  end FuncType;
    821821
    822822protected
    823   Ident name;
    824   Exp value1,value2;
    825 algorithm
    826   NAMEDARG(name, value1) := inArg;
     823  Absyn.Ident name;
     824  Absyn.Exp value1,value2;
     825algorithm
     826  Absyn.NAMEDARG(name, value1) := inArg;
    827827  (value2, outExtra) := traverseExpBidir(value1, enterFunc, exitFunc, inExtra);
    828   outArg := if referenceEq(value1,value2) then inArg else NAMEDARG(name, value2);
     828  outArg := if referenceEq(value1,value2) then inArg else Absyn.NAMEDARG(name, value2);
    829829end traverseExpBidirNamedArg;
    830830
     
    832832  "Helper function to traverseExpBidirFunctionArgs. Traverses the expressions in
    833833  an iterator."
    834   input ForIterator inIterator;
     834  input Absyn.ForIterator inIterator;
    835835  input FuncType enterFunc;
    836836  input FuncType exitFunc;
    837837  input Argument inArg;
    838   output ForIterator outIterator;
     838  output Absyn.ForIterator outIterator;
    839839  output Argument outArg;
    840840
    841841  partial function FuncType
    842     input Exp inExp;
     842    input Absyn.Exp inExp;
    843843    input Argument inArg;
    844     output Exp outExp;
     844    output Absyn.Exp outExp;
    845845    output Argument outArg;
    846846  end FuncType;
    847847
    848848protected
    849   Ident name;
    850   Option<Exp> guardExp1,guardExp2,range1,range2;
    851 algorithm
    852   ITERATOR(name=name, guardExp=guardExp1, range=range1) := inIterator;
     849  Absyn.Ident name;
     850  Option<Absyn.Exp> guardExp1,guardExp2,range1,range2;
     851algorithm
     852  Absyn.ITERATOR(name=name, guardExp=guardExp1, range=range1) := inIterator;
    853853  (guardExp2, outArg) := traverseExpOptBidir(guardExp1, enterFunc, exitFunc, inArg);
    854854  (range2, outArg) := traverseExpOptBidir(range1, enterFunc, exitFunc, outArg);
    855   outIterator := if referenceEq(guardExp1,guardExp2) and referenceEq(range1,range2) then inIterator else ITERATOR(name, guardExp2, range2);
     855  outIterator := if referenceEq(guardExp1,guardExp2) and referenceEq(range1,range2) then inIterator else Absyn.ITERATOR(name, guardExp2, range2);
    856856end traverseExpBidirIterator;
    857857
    858858public function traverseMatchCase
    859   input Case inMatchCase;
     859  input Absyn.Case inMatchCase;
    860860  input FuncType enterFunc;
    861861  input FuncType exitFunc;
    862862  input Argument inArg;
    863   output Case outMatchCase;
     863  output Absyn.Case outMatchCase;
    864864  output Argument outArg;
    865865
    866866  partial function FuncType
    867     input Exp inExp;
     867    input Absyn.Exp inExp;
    868868    input Argument inArg;
    869     output Exp outExp;
     869    output Absyn.Exp outExp;
    870870    output Argument outArg;
    871871  end FuncType;
     
    875875    local
    876876      Argument arg;
    877       Exp pattern, result;
    878       Info info, resultInfo, pinfo;
    879       list<ElementItem> ldecls;
    880       ClassPart cp;
     877      Absyn.Exp pattern, result;
     878      Absyn.Info info, resultInfo, pinfo;
     879      list<Absyn.ElementItem> ldecls;
     880      Absyn.ClassPart cp;
    881881      Option<String> cmt;
    882       Option<Exp> patternGuard;
    883 
    884     case (CASE(pattern, patternGuard, pinfo, ldecls, cp, result, resultInfo, cmt, info), _, _, arg)
     882      Option<Absyn.Exp> patternGuard;
     883
     884    case (Absyn.CASE(pattern, patternGuard, pinfo, ldecls, cp, result, resultInfo, cmt, info), _, _, arg)
    885885      equation
    886886        (pattern, arg) = traverseExpBidir(pattern, enterFunc, exitFunc, arg);
     
    889889        (result, arg) = traverseExpBidir(result, enterFunc, exitFunc, arg);
    890890      then
    891         (CASE(pattern, patternGuard, pinfo, ldecls, cp, result, resultInfo, cmt, info), arg);
    892 
    893     case (ELSE(localDecls = ldecls, classPart = cp, result = result, resultInfo = resultInfo,
     891        (Absyn.CASE(pattern, patternGuard, pinfo, ldecls, cp, result, resultInfo, cmt, info), arg);
     892
     893    case (Absyn.ELSE(localDecls = ldecls, classPart = cp, result = result, resultInfo = resultInfo,
    894894        comment = cmt, info = info), _, _, arg)
    895895      equation
     
    897897        (result, arg) = traverseExpBidir(result, enterFunc, exitFunc, arg);
    898898      then
    899         (ELSE(ldecls, cp, result, resultInfo, cmt, info), arg);
     899        (Absyn.ELSE(ldecls, cp, result, resultInfo, cmt, info), arg);
    900900
    901901  end match;
     
    903903
    904904protected function traverseClassPartBidir
    905   input ClassPart cp;
     905  input Absyn.ClassPart cp;
    906906  input FuncType enterFunc;
    907907  input FuncType exitFunc;
    908908  input Argument inArg;
    909   output ClassPart outCp;
     909  output Absyn.ClassPart outCp;
    910910  output Argument outArg;
    911911
    912912  partial function FuncType
    913     input Exp inExp;
     913    input Absyn.Exp inExp;
    914914    input Argument inArg;
    915     output Exp outExp;
     915    output Absyn.Exp outExp;
    916916    output Argument outArg;
    917917  end FuncType;
     
    920920  (outCp, outArg) := match (cp,enterFunc,exitFunc,inArg)
    921921    local
    922       list<AlgorithmItem> algs;
    923       list<EquationItem> eqs;
     922      list<Absyn.AlgorithmItem> algs;
     923      list<Absyn.EquationItem> eqs;
    924924      Argument arg;
    925     case (ALGORITHMS(algs),_,_,arg)
     925    case (Absyn.ALGORITHMS(algs),_,_,arg)
    926926      equation
    927927        (algs, arg) = List.map2FoldCheckReferenceEq(algs, traverseAlgorithmItemBidir, enterFunc, exitFunc, arg);
    928       then (ALGORITHMS(algs),arg);
    929     case (EQUATIONS(eqs),_,_,arg)
     928      then (Absyn.ALGORITHMS(algs),arg);
     929    case (Absyn.EQUATIONS(eqs),_,_,arg)
    930930      equation
    931931        (eqs, arg) = List.map2FoldCheckReferenceEq(eqs, traverseEquationItemBidir, enterFunc, exitFunc, arg);
    932       then (EQUATIONS(eqs),arg);
     932      then (Absyn.EQUATIONS(eqs),arg);
    933933  end match;
    934934end traverseClassPartBidir;
    935935
    936936protected function traverseEquationItemListBidir
    937   input list<EquationItem> inEquationItems;
     937  input list<Absyn.EquationItem> inEquationItems;
    938938  input FuncType enterFunc;
    939939  input FuncType exitFunc;
    940940  input Argument inArg;
    941   output list<EquationItem> outEquationItems;
     941  output list<Absyn.EquationItem> outEquationItems;
    942942  output Argument outArg;
    943943
    944944  partial function FuncType
    945     input Exp inExp;
     945    input Absyn.Exp inExp;
    946946    input Argument inArg;
    947     output Exp outExp;
     947    output Absyn.Exp outExp;
    948948    output Argument outArg;
    949949  end FuncType;
     
    954954
    955955protected function traverseAlgorithmItemListBidir
    956   input list<AlgorithmItem> inAlgs;
     956  input list<Absyn.AlgorithmItem> inAlgs;
    957957  input FuncType enterFunc;
    958958  input FuncType exitFunc;
    959959  input Argument inArg;
    960   output list<AlgorithmItem> outAlgs;
     960  output list<Absyn.AlgorithmItem> outAlgs;
    961961  output Argument outArg;
    962962
    963963  partial function FuncType
    964     input Exp inExp;
     964    input Absyn.Exp inExp;
    965965    input Argument inArg;
    966     output Exp outExp;
     966    output Absyn.Exp outExp;
    967967    output Argument outArg;
    968968  end FuncType;
     
    973973
    974974protected function traverseAlgorithmItemBidir
    975   input AlgorithmItem inAlgorithmItem;
     975  input Absyn.AlgorithmItem inAlgorithmItem;
    976976  input FuncType enterFunc;
    977977  input FuncType exitFunc;
    978978  input Argument inArg;
    979   output AlgorithmItem outAlgorithmItem;
     979  output Absyn.AlgorithmItem outAlgorithmItem;
    980980  output Argument outArg;
    981981
    982982  partial function FuncType
    983     input Exp inExp;
     983    input Absyn.Exp inExp;
    984984    input Argument inArg;
    985     output Exp outExp;
     985    output Absyn.Exp outExp;
    986986    output Argument outArg;
    987987  end FuncType;
     
    991991    local
    992992      Argument arg;
    993       Algorithm alg;
    994       Option<Comment> cmt;
    995       Info info;
    996 
    997     case (ALGORITHMITEM(algorithm_ = alg, comment = cmt, info = info), _, _, arg)
     993      Absyn.Algorithm alg;
     994      Option<Absyn.Comment> cmt;
     995      Absyn.Info info;
     996
     997    case (Absyn.ALGORITHMITEM(algorithm_ = alg, comment = cmt, info = info), _, _, arg)
    998998      equation
    999999        (alg, arg) = traverseAlgorithmBidir(alg, enterFunc, exitFunc, arg);
    10001000      then
    1001         (ALGORITHMITEM(alg, cmt, info), arg);
    1002 
    1003     case (ALGORITHMITEMCOMMENT(), _, _, _) then (inAlgorithmItem,inArg);
     1001        (Absyn.ALGORITHMITEM(alg, cmt, info), arg);
     1002
     1003    case (Absyn.ALGORITHMITEMCOMMENT(), _, _, _) then (inAlgorithmItem,inArg);
    10041004  end match;
    10051005end traverseAlgorithmItemBidir;
    10061006
    10071007protected function traverseEquationItemBidir
    1008   input EquationItem inEquationItem;
     1008  input Absyn.EquationItem inEquationItem;
    10091009  input FuncType enterFunc;
    10101010  input FuncType exitFunc;
    10111011  input Argument inArg;
    1012   output EquationItem outEquationItem;
     1012  output Absyn.EquationItem outEquationItem;
    10131013  output Argument outArg;
    10141014
    10151015  partial function FuncType
    1016     input Exp inExp;
     1016    input Absyn.Exp inExp;
    10171017    input Argument inArg;
    1018     output Exp outExp;
     1018    output Absyn.Exp outExp;
    10191019    output Argument outArg;
    10201020  end FuncType;
     
    10241024    local
    10251025      Argument arg;
    1026       Equation eq;
    1027       Option<Comment> cmt;
    1028       Info info;
    1029 
    1030     case (EQUATIONITEM(equation_ = eq, comment = cmt, info = info), _, _, arg)
     1026      Absyn.Equation eq;
     1027      Option<Absyn.Comment> cmt;
     1028      Absyn.Info info;
     1029
     1030    case (Absyn.EQUATIONITEM(equation_ = eq, comment = cmt, info = info), _, _, arg)
    10311031      equation
    10321032        (eq, arg) = traverseEquationBidir(eq, enterFunc, exitFunc, arg);
    10331033      then
    1034         (EQUATIONITEM(eq, cmt, info), arg);
     1034        (Absyn.EQUATIONITEM(eq, cmt, info), arg);
    10351035
    10361036  end match;
     
    10381038
    10391039public function traverseEquationBidir
    1040   input Equation inEquation;
     1040  input Absyn.Equation inEquation;
    10411041  input FuncType enterFunc;
    10421042  input FuncType exitFunc;
    10431043  input Argument inArg;
    1044   output Equation outEquation;
     1044  output Absyn.Equation outEquation;
    10451045  output Argument outArg;
    10461046
    10471047  partial function FuncType
    1048     input Exp inExp;
     1048    input Absyn.Exp inExp;
    10491049    input Argument inArg;
    1050     output Exp outExp;
     1050    output Absyn.Exp outExp;
    10511051    output Argument outArg;
    10521052  end FuncType;
     
    10561056    local
    10571057      Argument arg;
    1058       Exp e1, e2;
    1059       list<EquationItem> eqil1, eqil2;
    1060       list<tuple<Exp, list<EquationItem>>> else_branch;
    1061       ComponentRef cref1, cref2;
    1062       ForIterators iters;
    1063       FunctionArgs func_args;
    1064       EquationItem eq;
    1065 
    1066     case (EQ_IF(ifExp = e1, equationTrueItems = eqil1,
     1058      Absyn.Exp e1, e2;
     1059      list<Absyn.EquationItem> eqil1, eqil2;
     1060      list<tuple<Absyn.Exp, list<Absyn.EquationItem>>> else_branch;
     1061      Absyn.ComponentRef cref1, cref2;
     1062      Absyn.ForIterators iters;
     1063      Absyn.FunctionArgs func_args;
     1064      Absyn.EquationItem eq;
     1065
     1066    case (Absyn.EQ_IF(ifExp = e1, equationTrueItems = eqil1,
    10671067        elseIfBranches = else_branch, equationElseItems = eqil2), _, _, arg)
    10681068      equation
     
    10721072        (eqil2,arg) = traverseEquationItemListBidir(eqil2, enterFunc, exitFunc, arg);
    10731073      then
    1074         (EQ_IF(e1, eqil1, else_branch, eqil2), arg);
    1075 
    1076     case (EQ_EQUALS(leftSide = e1, rightSide = e2), _, _, arg)
     1074        (Absyn.EQ_IF(e1, eqil1, else_branch, eqil2), arg);
     1075
     1076    case (Absyn.EQ_EQUALS(leftSide = e1, rightSide = e2), _, _, arg)
    10771077      equation
    10781078        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    10791079        (e2, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    10801080      then
    1081         (EQ_EQUALS(e1, e2), arg);
    1082     case (EQ_PDE(leftSide = e1, rightSide = e2, domain = cref1), _, _, arg)
     1081        (Absyn.EQ_EQUALS(e1, e2), arg);
     1082    case (Absyn.EQ_PDE(leftSide = e1, rightSide = e2, domain = cref1), _, _, arg)
    10831083      equation
    10841084        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
     
    10861086        cref1 = traverseExpBidirCref(cref1, enterFunc, exitFunc, arg);
    10871087      then
    1088         (EQ_PDE(e1, e2,cref1), arg);
    1089 
    1090     case (EQ_CONNECT(connector1 = cref1, connector2 = cref2), _, _, arg)
     1088        (Absyn.EQ_PDE(e1, e2,cref1), arg);
     1089
     1090    case (Absyn.EQ_CONNECT(connector1 = cref1, connector2 = cref2), _, _, arg)
    10911091      equation
    10921092        (cref1, arg) = traverseExpBidirCref(cref1, enterFunc, exitFunc, arg);
    10931093        (cref2, arg) = traverseExpBidirCref(cref2, enterFunc, exitFunc, arg);
    10941094      then
    1095         (EQ_CONNECT(cref1, cref2), arg);
    1096 
    1097     case (EQ_FOR(iterators = iters, forEquations = eqil1), _, _, arg)
     1095        (Absyn.EQ_CONNECT(cref1, cref2), arg);
     1096
     1097    case (Absyn.EQ_FOR(iterators = iters, forEquations = eqil1), _, _, arg)
    10981098      equation
    10991099        (iters, arg) = List.map2FoldCheckReferenceEq(iters, traverseExpBidirIterator, enterFunc, exitFunc, arg);
    11001100        (eqil1, arg) = traverseEquationItemListBidir(eqil1, enterFunc, exitFunc, arg);
    11011101      then
    1102         (EQ_FOR(iters, eqil1), arg);
    1103 
    1104     case (EQ_WHEN_E(whenExp = e1, whenEquations = eqil1, elseWhenEquations = else_branch), _, _, arg)
     1102        (Absyn.EQ_FOR(iters, eqil1), arg);
     1103
     1104    case (Absyn.EQ_WHEN_E(whenExp = e1, whenEquations = eqil1, elseWhenEquations = else_branch), _, _, arg)
    11051105      equation
    11061106        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
     
    11081108        (else_branch, arg) = List.map2FoldCheckReferenceEq(else_branch, traverseEquationBidirElse, enterFunc, exitFunc, arg);
    11091109      then
    1110         (EQ_WHEN_E(e1, eqil1, else_branch), arg);
    1111 
    1112     case (EQ_NORETCALL(functionName = cref1, functionArgs = func_args), _, _, arg)
     1110        (Absyn.EQ_WHEN_E(e1, eqil1, else_branch), arg);
     1111
     1112    case (Absyn.EQ_NORETCALL(functionName = cref1, functionArgs = func_args), _, _, arg)
    11131113      equation
    11141114        (cref1, arg) = traverseExpBidirCref(cref1, enterFunc, exitFunc, arg);
    11151115        (func_args, arg) = traverseExpBidirFunctionArgs(func_args, enterFunc, exitFunc, arg);
    11161116      then
    1117         (EQ_NORETCALL(cref1, func_args), arg);
    1118 
    1119     case (EQ_FAILURE(equ = eq), _, _, arg)
     1117        (Absyn.EQ_NORETCALL(cref1, func_args), arg);
     1118
     1119    case (Absyn.EQ_FAILURE(equ = eq), _, _, arg)
    11201120      equation
    11211121        (eq, arg) = traverseEquationItemBidir(eq, enterFunc, exitFunc, arg);
    11221122      then
    1123         (EQ_FAILURE(eq), arg);
     1123        (Absyn.EQ_FAILURE(eq), arg);
    11241124
    11251125  end match;
     
    11271127
    11281128protected function traverseEquationBidirElse
    1129   input tuple<Exp, list<EquationItem>> inElse;
     1129  input tuple<Absyn.Exp, list<Absyn.EquationItem>> inElse;
    11301130  input FuncType enterFunc;
    11311131  input FuncType exitFunc;
    11321132  input Argument inArg;
    1133   output tuple<Exp, list<EquationItem>> outElse;
     1133  output tuple<Absyn.Exp, list<Absyn.EquationItem>> outElse;
    11341134  output Argument arg;
    11351135
    11361136  partial function FuncType
    1137     input Exp inExp;
     1137    input Absyn.Exp inExp;
    11381138    input Argument inArg;
    1139     output Exp outExp;
     1139    output Absyn.Exp outExp;
    11401140    output Argument outArg;
    11411141  end FuncType;
    11421142
    11431143protected
    1144   Exp e;
    1145   list<EquationItem> eqil;
     1144  Absyn.Exp e;
     1145  list<Absyn.EquationItem> eqil;
    11461146algorithm
    11471147  (e, eqil) := inElse;
     
    11521152
    11531153protected function traverseAlgorithmBidirElse
    1154   input tuple<Exp, list<AlgorithmItem>> inElse;
     1154  input tuple<Absyn.Exp, list<Absyn.AlgorithmItem>> inElse;
    11551155  input FuncType enterFunc;
    11561156  input FuncType exitFunc;
    11571157  input Argument inArg;
    1158   output tuple<Exp, list<AlgorithmItem>> outElse;
     1158  output tuple<Absyn.Exp, list<Absyn.AlgorithmItem>> outElse;
    11591159  output Argument arg;
    11601160
    11611161  partial function FuncType
    1162     input Exp inExp;
     1162    input Absyn.Exp inExp;
    11631163    input Argument inArg;
    1164     output Exp outExp;
     1164    output Absyn.Exp outExp;
    11651165    output Argument outArg;
    11661166  end FuncType;
    11671167
    11681168protected
    1169   Exp e;
    1170   list<AlgorithmItem> algs;
     1169  Absyn.Exp e;
     1170  list<Absyn.AlgorithmItem> algs;
    11711171algorithm
    11721172  (e, algs) := inElse;
     
    11771177
    11781178protected function traverseAlgorithmBidir
    1179   input Algorithm inAlg;
     1179  input Absyn.Algorithm inAlg;
    11801180  input FuncType enterFunc;
    11811181  input FuncType exitFunc;
    11821182  input Argument inArg;
    1183   output Algorithm outAlg;
     1183  output Absyn.Algorithm outAlg;
    11841184  output Argument outArg;
    11851185
    11861186  partial function FuncType
    1187     input Exp inExp;
     1187    input Absyn.Exp inExp;
    11881188    input Argument inArg;
    1189     output Exp outExp;
     1189    output Absyn.Exp outExp;
    11901190    output Argument outArg;
    11911191  end FuncType;
     
    11951195    local
    11961196      Argument arg;
    1197       Exp e1, e2;
    1198       list<AlgorithmItem> algs1, algs2;
    1199       list<tuple<Exp, list<AlgorithmItem>>> else_branch;
    1200       ComponentRef cref1, cref2;
    1201       ForIterators iters;
    1202       FunctionArgs func_args;
    1203       AlgorithmItem alg;
    1204 
    1205     case (ALG_ASSIGN(e1, e2), _, _, arg)
     1197      Absyn.Exp e1, e2;
     1198      list<Absyn.AlgorithmItem> algs1, algs2;
     1199      list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> else_branch;
     1200      Absyn.ComponentRef cref1, cref2;
     1201      Absyn.ForIterators iters;
     1202      Absyn.FunctionArgs func_args;
     1203      Absyn.AlgorithmItem alg;
     1204
     1205    case (Absyn.ALG_ASSIGN(e1, e2), _, _, arg)
    12061206      equation
    12071207        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    12081208        (e2, arg) = traverseExpBidir(e2, enterFunc, exitFunc, arg);
    12091209      then
    1210         (ALG_ASSIGN(e1, e2), arg);
    1211 
    1212     case (ALG_IF(e1, algs1, else_branch, algs2), _, _, arg)
     1210        (Absyn.ALG_ASSIGN(e1, e2), arg);
     1211
     1212    case (Absyn.ALG_IF(e1, algs1, else_branch, algs2), _, _, arg)
    12131213      equation
    12141214        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
     
    12161216        (else_branch, arg) = List.map2FoldCheckReferenceEq(else_branch, traverseAlgorithmBidirElse, enterFunc, exitFunc, arg);
    12171217        (algs2, arg) = traverseAlgorithmItemListBidir(algs2, enterFunc, exitFunc, arg);
    1218       then (ALG_IF(e1, algs1, else_branch, algs2), arg);
    1219 
    1220     case (ALG_FOR(iters, algs1), _, _, arg)
     1218      then (Absyn.ALG_IF(e1, algs1, else_branch, algs2), arg);
     1219
     1220    case (Absyn.ALG_FOR(iters, algs1), _, _, arg)
    12211221      equation
    12221222        (iters, arg) = List.map2FoldCheckReferenceEq(iters, traverseExpBidirIterator, enterFunc, exitFunc, arg);
    12231223        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    1224       then (ALG_FOR(iters, algs1), arg);
    1225 
    1226     case (ALG_PARFOR(iters, algs1), _, _, arg)
     1224      then (Absyn.ALG_FOR(iters, algs1), arg);
     1225
     1226    case (Absyn.ALG_PARFOR(iters, algs1), _, _, arg)
    12271227      equation
    12281228        (iters, arg) = List.map2FoldCheckReferenceEq(iters, traverseExpBidirIterator, enterFunc, exitFunc, arg);
    12291229        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    1230       then (ALG_PARFOR(iters, algs1), arg);
    1231 
    1232     case (ALG_WHILE(e1, algs1), _, _, arg)
     1230      then (Absyn.ALG_PARFOR(iters, algs1), arg);
     1231
     1232    case (Absyn.ALG_WHILE(e1, algs1), _, _, arg)
    12331233      equation
    12341234        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    12351235        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    1236       then (ALG_WHILE(e1, algs1), arg);
    1237 
    1238     case (ALG_WHEN_A(e1, algs1, else_branch), _, _, arg)
     1236      then (Absyn.ALG_WHILE(e1, algs1), arg);
     1237
     1238    case (Absyn.ALG_WHEN_A(e1, algs1, else_branch), _, _, arg)
    12391239      equation
    12401240        (e1, arg) = traverseExpBidir(e1, enterFunc, exitFunc, arg);
    12411241        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    12421242        (else_branch, arg) = List.map2FoldCheckReferenceEq(else_branch, traverseAlgorithmBidirElse, enterFunc, exitFunc, arg);
    1243       then (ALG_WHEN_A(e1, algs1, else_branch), arg);
    1244 
    1245     case (ALG_NORETCALL(cref1, func_args), _, _, arg)
     1243      then (Absyn.ALG_WHEN_A(e1, algs1, else_branch), arg);
     1244
     1245    case (Absyn.ALG_NORETCALL(cref1, func_args), _, _, arg)
    12461246      equation
    12471247        (cref1, arg) = traverseExpBidirCref(cref1, enterFunc, exitFunc, arg);
    12481248        (func_args, arg) = traverseExpBidirFunctionArgs(func_args, enterFunc, exitFunc, arg);
    12491249      then
    1250         (ALG_NORETCALL(cref1, func_args), arg);
    1251 
    1252     case (ALG_RETURN(), _, _, arg)
     1250        (Absyn.ALG_NORETCALL(cref1, func_args), arg);
     1251
     1252    case (Absyn.ALG_RETURN(), _, _, arg)
    12531253      then (inAlg, arg);
    12541254
    1255     case (ALG_BREAK(), _, _, arg)
     1255    case (Absyn.ALG_BREAK(), _, _, arg)
    12561256      then (inAlg, arg);
    12571257
    1258     case (ALG_CONTINUE(), _, _, arg)
     1258    case (Absyn.ALG_CONTINUE(), _, _, arg)
    12591259      then (inAlg, arg);
    12601260
    1261     case (ALG_FAILURE(algs1), _, _, arg)
     1261    case (Absyn.ALG_FAILURE(algs1), _, _, arg)
    12621262      equation
    12631263        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    12641264      then
    1265         (ALG_FAILURE(algs1), arg);
    1266 
    1267     case (ALG_TRY(algs1, algs2), _, _, arg)
     1265        (Absyn.ALG_FAILURE(algs1), arg);
     1266
     1267    case (Absyn.ALG_TRY(algs1, algs2), _, _, arg)
    12681268      equation
    12691269        (algs1, arg) = traverseAlgorithmItemListBidir(algs1, enterFunc, exitFunc, arg);
    12701270        (algs2, arg) = traverseAlgorithmItemListBidir(algs2, enterFunc, exitFunc, arg);
    12711271      then
    1272         (ALG_TRY(algs1, algs2), arg);
     1272        (Absyn.ALG_TRY(algs1, algs2), arg);
    12731273
    12741274  end match;
     
    12771277public function makeIdentPathFromString
    12781278  input String s;
    1279   output Path p;
    1280 algorithm
    1281   p := IDENT(s);
     1279  output Absyn.Path p;
     1280algorithm
     1281  p := Absyn.IDENT(s);
    12821282annotation(__OpenModelica_EarlyInline = true);
    12831283end makeIdentPathFromString;
     
    12861286  input String s1;
    12871287  input String s2;
    1288   output Path p;
    1289 algorithm
    1290   p := QUALIFIED(s1,IDENT(s2));
     1288  output Absyn.Path p;
     1289algorithm
     1290  p := Absyn.QUALIFIED(s1,Absyn.IDENT(s2));
    12911291annotation(__OpenModelica_EarlyInline = true);
    12921292end makeQualifiedPathFromStrings;
    12931293
    1294 public function className "returns the class name of a Class as a Path"
    1295   input Class cl;
    1296   output Path name;
     1294public function className "returns the class name of a Absyn.Class as a Absyn.Path"
     1295  input Absyn.Class cl;
     1296  output Absyn.Path name;
    12971297protected
    12981298  String id;
    12991299algorithm
    1300   CLASS(name = id) := cl;
    1301   name := IDENT(id);
     1300  Absyn.CLASS(name = id) := cl;
     1301  name := Absyn.IDENT(id);
    13021302end className;
    13031303
    13041304public function isClassNamed
    13051305  input String inName;
    1306   input Class inClass;
     1306  input Absyn.Class inClass;
    13071307  output Boolean outIsNamed;
    13081308algorithm
    13091309  outIsNamed := match inClass
    1310     case CLASS() then inName == inClass.name;
     1310    case Absyn.CLASS() then inName == inClass.name;
    13111311    else false;
    13121312  end match;
     
    13141314
    13151315public function elementSpecName
    1316   "The ElementSpec type contains the name of the element, and this function
     1316  "The Absyn.ElementSpec type contains the name of the element, and this function
    13171317   extracts this name."
    1318   input ElementSpec inElementSpec;
    1319   output Ident outIdent;
     1318  input Absyn.ElementSpec inElementSpec;
     1319  output Absyn.Ident outIdent;
    13201320algorithm
    13211321  outIdent := match (inElementSpec)
    1322     local Ident n;
    1323 
    1324     case CLASSDEF(class_ = CLASS(name = n)) then n;
    1325     case COMPONENTS(components = {COMPONENTITEM(component = COMPONENT(name = n))}) then n;
     1322    local Absyn.Ident n;
     1323
     1324    case Absyn.CLASSDEF(class_ = Absyn.CLASS(name = n)) then n;
     1325    case Absyn.COMPONENTS(components = {Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = n))}) then n;
    13261326  end match;
    13271327end elementSpecName;
    13281328
    13291329public function isClassdef
    1330   input Element inElement;
     1330  input Absyn.Element inElement;
    13311331  output Boolean b;
    13321332algorithm
    13331333  b := match inElement
    1334     case ELEMENT(specification=CLASSDEF()) then true;
     1334    case Absyn.ELEMENT(specification=Absyn.CLASSDEF()) then true;
    13351335    else false;
    13361336  end match;
     
    13381338
    13391339public function printImportString
    1340   "This function takes a Import and prints it as a flat-string."
    1341   input Import imp;
     1340  "This function takes a Absyn.Import and prints it as a flat-string."
     1341  input Absyn.Import imp;
    13421342  output String ostring;
    13431343algorithm
    13441344  ostring := match(imp)
    13451345    local
    1346       Path path;
     1346      Absyn.Path path;
    13471347      String name;
    13481348
    1349     case(NAMED_IMPORT(name,_)) then name;
    1350     case(QUAL_IMPORT(path))
     1349    case(Absyn.NAMED_IMPORT(name,_)) then name;
     1350    case(Absyn.QUAL_IMPORT(path))
    13511351      equation
    13521352        name = pathString(path);
    13531353      then name;
    13541354
    1355     case(UNQUAL_IMPORT(path))
     1355    case(Absyn.UNQUAL_IMPORT(path))
    13561356      equation
    13571357        name = pathString(path);
     
    13611361
    13621362public function expString "returns the string of an expression if it is a string constant."
    1363   input Exp exp;
     1363  input Absyn.Exp exp;
    13641364  output String str;
    13651365algorithm
    1366   STRING(str) := exp;
     1366  Absyn.STRING(str) := exp;
    13671367end expString;
    13681368
    13691369public function expCref "returns the componentRef of an expression if matches."
    1370   input Exp exp;
    1371   output ComponentRef cr;
    1372 algorithm
    1373   CREF(cr) := exp;
     1370  input Absyn.Exp exp;
     1371  output Absyn.ComponentRef cr;
     1372algorithm
     1373  Absyn.CREF(cr) := exp;
    13741374end expCref;
    13751375
    13761376public function crefExp "returns the componentRef of an expression if matches."
    1377  input ComponentRef cr;
    1378  output Exp exp;
    1379 algorithm
    1380   exp := CREF(cr);
     1377 input Absyn.ComponentRef cr;
     1378 output Absyn.Exp exp;
     1379algorithm
     1380  exp := Absyn.CREF(cr);
    13811381annotation(__OpenModelica_EarlyInline = true);
    13821382end crefExp;
    13831383
    13841384public function expComponentRefStr
    1385   input Exp aexp;
     1385  input Absyn.Exp aexp;
    13861386  output String outString;
    13871387algorithm
     
    13901390
    13911391public function printComponentRefStr
    1392   input ComponentRef cr;
     1392  input Absyn.ComponentRef cr;
    13931393  output String ostring;
    13941394algorithm
     
    13961396    local
    13971397      String s1,s2;
    1398       ComponentRef child;
    1399     case(CREF_IDENT(s1,_)) then s1;
    1400     case(CREF_QUAL(s1,_,child))
     1398      Absyn.ComponentRef child;
     1399    case(Absyn.CREF_IDENT(s1,_)) then s1;
     1400    case(Absyn.CREF_QUAL(s1,_,child))
    14011401      equation
    14021402        s2 = printComponentRefStr(child);
    14031403        s1 = s1 + "." + s2;
    14041404      then s1;
    1405     case(CREF_FULLYQUALIFIED(child))
     1405    case(Absyn.CREF_FULLYQUALIFIED(child))
    14061406      equation
    14071407        s2 = printComponentRefStr(child);
    14081408        s1 = "." + s2;
    14091409      then s1;
    1410     case (ALLWILD()) then "__";
    1411     case (WILD()) then "_";
     1410    case (Absyn.ALLWILD()) then "__";
     1411    case (Absyn.WILD()) then "_";
    14121412  end match;
    14131413end printComponentRefStr;
    14141414
    14151415public function pathEqual "Returns true if two paths are equal."
    1416   input Path inPath1;
    1417   input Path inPath2;
     1416  input Absyn.Path inPath1;
     1417  input Absyn.Path inPath2;
    14181418  output Boolean outBoolean;
    14191419algorithm
     
    14221422      String id1,id2;
    14231423      Boolean res;
    1424       Path path1,path2;
     1424      Absyn.Path path1,path2;
    14251425    // fully qual vs. path
    1426     case (FULLYQUALIFIED(path1),path2) then pathEqual(path1,path2);
     1426    case (Absyn.FULLYQUALIFIED(path1),path2) then pathEqual(path1,path2);
    14271427    // path vs. fully qual
    1428     case (path1,FULLYQUALIFIED(path2)) then pathEqual(path1,path2);
     1428    case (path1,Absyn.FULLYQUALIFIED(path2)) then pathEqual(path1,path2);
    14291429    // ident vs. ident
    1430     case (IDENT(id1),IDENT(id2))
     1430    case (Absyn.IDENT(id1),Absyn.IDENT(id2))
    14311431      then stringEq(id1, id2);
    14321432    // qual ident vs. qual ident
    1433     case (QUALIFIED(id1, path1),QUALIFIED(id2, path2))
     1433    case (Absyn.QUALIFIED(id1, path1),Absyn.QUALIFIED(id2, path2))
    14341434      equation
    14351435        res = if stringEq(id1, id2) then pathEqual(path1, path2) else false;
     
    14411441
    14421442public function pathEqualCaseInsensitive "Returns true if two paths are equal."
    1443   input Path inPath1;
    1444   input Path inPath2;
     1443  input Absyn.Path inPath1;
     1444  input Absyn.Path inPath2;
    14451445  output Boolean outBoolean;
    14461446algorithm
     
    14491449      String id1,id2;
    14501450      Boolean res;
    1451       Path path1,path2;
     1451      Absyn.Path path1,path2;
    14521452    // fully qual vs. path
    1453     case (FULLYQUALIFIED(path1),path2) then pathEqualCaseInsensitive(path1,path2);
     1453    case (Absyn.FULLYQUALIFIED(path1),path2) then pathEqualCaseInsensitive(path1,path2);
    14541454    // path vs. fully qual
    1455     case (path1,FULLYQUALIFIED(path2)) then pathEqualCaseInsensitive(path1,path2);
     1455    case (path1,Absyn.FULLYQUALIFIED(path2)) then pathEqualCaseInsensitive(path1,path2);
    14561456    // ident vs. ident
    1457     case (IDENT(id1),IDENT(id2))
     1457    case (Absyn.IDENT(id1),Absyn.IDENT(id2))
    14581458      then stringEq(System.tolower(id1), System.tolower(id2));
    14591459    // qual ident vs. qual ident
    1460     case (QUALIFIED(id1, path1),QUALIFIED(id2, path2))
     1460    case (Absyn.QUALIFIED(id1, path1),Absyn.QUALIFIED(id2, path2))
    14611461      equation
    14621462        res = if stringEq(System.tolower(id1), System.tolower(id2)) then pathEqualCaseInsensitive(path1, path2) else false;
     
    14701470  "Author BZ 2009-01
    14711471   Check whether two type specs are equal or not."
    1472   input TypeSpec a,b;
     1472  input Absyn.TypeSpec a,b;
    14731473  output Boolean ob;
    14741474algorithm
    14751475  ob := matchcontinue(a,b)
    14761476    local
    1477       Path p1,p2;
    1478       Option<ArrayDim> oad1,oad2;
    1479       list<TypeSpec> lst1,lst2;
    1480       Ident i1, i2;
     1477      Absyn.Path p1,p2;
     1478      Option<Absyn.ArrayDim> oad1,oad2;
     1479      list<Absyn.TypeSpec> lst1,lst2;
     1480      Absyn.Ident i1, i2;
    14811481      Integer pos1, pos2;
    14821482
    14831483    // first try full equality
    1484     case(TPATH(p1,oad1), TPATH(p2,oad2))
     1484    case(Absyn.TPATH(p1,oad1), Absyn.TPATH(p2,oad2))
    14851485      equation
    14861486        true = pathEqual(p1,p2);
     
    14881488      then true;
    14891489
    1490     case(TCOMPLEX(p1,lst1,oad1),TCOMPLEX(p2,lst2,oad2))
     1490    case(Absyn.TCOMPLEX(p1,lst1,oad1),Absyn.TCOMPLEX(p2,lst2,oad2))
    14911491      equation
    14921492        true = pathEqual(p1,p2);
     
    15021502  "Author BZ
    15031503   helper function for typeSpecEqual"
    1504   input Option<ArrayDim> oad1,oad2;
     1504  input Option<Absyn.ArrayDim> oad1,oad2;
    15051505  output Boolean b;
    15061506algorithm b:= matchcontinue(oad1,oad2)
    15071507  local
    1508     list<Subscript> ad1,ad2;
     1508    list<Absyn.Subscript> ad1,ad2;
    15091509  case(SOME(ad1),SOME(ad2))
    15101510    equation
     
    15161516end optArrayDimEqual;
    15171517
    1518 public function typeSpecPathString "This function simply converts a Path to a string."
    1519   input TypeSpec tp;
     1518public function typeSpecPathString "This function simply converts a Absyn.Path to a string."
     1519  input Absyn.TypeSpec tp;
    15201520  output String s;
    15211521algorithm s := match(tp)
    1522   local Path p;
    1523   case(TCOMPLEX(path = p)) then pathString(p);
    1524   case(TPATH(path = p)) then pathString(p);
     1522  local Absyn.Path p;
     1523  case(Absyn.TCOMPLEX(path = p)) then pathString(p);
     1524  case(Absyn.TPATH(path = p)) then pathString(p);
    15251525end match;
    15261526end typeSpecPathString;
    15271527
    15281528public function typeSpecPath
    1529   "Converts a TypeSpec to Path"
    1530   input TypeSpec tp;
    1531   output Path op;
     1529  "Converts a Absyn.TypeSpec to Absyn.Path"
     1530  input Absyn.TypeSpec tp;
     1531  output Absyn.Path op;
    15321532algorithm
    15331533  op := match(tp)
    1534     local Path p;
    1535     case(TCOMPLEX(path = p)) then p;
    1536     case(TPATH(path = p)) then p;
     1534    local Absyn.Path p;
     1535    case(Absyn.TCOMPLEX(path = p)) then p;
     1536    case(Absyn.TPATH(path = p)) then p;
    15371537  end match;
    15381538end typeSpecPath;
    15391539
    15401540public function typeSpecDimensions
    1541   "Returns the dimensions of a TypeSpec."
    1542   input TypeSpec inTypeSpec;
    1543   output ArrayDim outDimensions;
     1541  "Returns the dimensions of a Absyn.TypeSpec."
     1542  input Absyn.TypeSpec inTypeSpec;
     1543  output Absyn.ArrayDim outDimensions;
    15441544algorithm
    15451545  outDimensions := match(inTypeSpec)
    15461546    local
    1547       ArrayDim dim;
    1548 
    1549     case TPATH(arrayDim = SOME(dim)) then dim;
    1550     case TCOMPLEX(arrayDim = SOME(dim)) then dim;
     1547      Absyn.ArrayDim dim;
     1548
     1549    case Absyn.TPATH(arrayDim = SOME(dim)) then dim;
     1550    case Absyn.TCOMPLEX(arrayDim = SOME(dim)) then dim;
    15511551    else {};
    15521552
     
    15541554end typeSpecDimensions;
    15551555
    1556 public function pathString "This function simply converts a Path to a string."
    1557   input Path path;
     1556public function pathString "This function simply converts a Absyn.Path to a string."
     1557  input Absyn.Path path;
    15581558  input String delimiter=".";
    15591559  input Boolean usefq=true;
     
    15611561  output String s;
    15621562protected
    1563   Path p1,p2;
     1563  Absyn.Path p1,p2;
    15641564  Integer count=0, len=0, dlen=stringLength(delimiter);
    15651565  Boolean b;
     
    15681568  p1 :=  if usefq then path else makeNotFullyQualified(path);
    15691569  _ := match p1
    1570     case IDENT()
     1570    case Absyn.IDENT()
    15711571      algorithm
    15721572        // Do not allocate memory if we're just going to copy the only identifier
     
    15801580  while b loop
    15811581    (p2,len,count,b) := match p2
    1582       case IDENT() then (p2,len+1,count+stringLength(p2.name),false);
    1583       case QUALIFIED() then (p2.path,len+1,count+stringLength(p2.name),true);
    1584       case FULLYQUALIFIED() then (p2.path,len+1,count,true);
     1582      case Absyn.IDENT() then (p2,len+1,count+stringLength(p2.name),false);
     1583      case Absyn.QUALIFIED() then (p2.path,len+1,count+stringLength(p2.name),true);
     1584      case Absyn.FULLYQUALIFIED() then (p2.path,len+1,count,true);
    15851585    end match;
    15861586  end while;
     
    15911591
    15921592function pathStringWork
    1593   input Path inPath;
     1593  input Absyn.Path inPath;
    15941594  input Integer len;
    15951595  input String delimiter;
     
    15981598  output String s="";
    15991599protected
    1600   Path p=inPath;
     1600  Absyn.Path p=inPath;
    16011601  Boolean b=true;
    16021602  Integer count=0;
     
    16071607  while b loop
    16081608    (p,count,b) := match p
    1609       case IDENT()
     1609      case Absyn.IDENT()
    16101610        algorithm
    16111611          System.stringAllocatorStringCopy(sb, p.name, if reverse then len-count-stringLength(p.name) else count);
    16121612        then (p,count+stringLength(p.name),false);
    1613       case QUALIFIED()
     1613      case Absyn.QUALIFIED()
    16141614        algorithm
    16151615          System.stringAllocatorStringCopy(sb, p.name, if reverse then len-count-dlen-stringLength(p.name) else count);
    16161616          System.stringAllocatorStringCopy(sb, delimiter, if reverse then len-count-dlen else count+stringLength(p.name));
    16171617        then (p.path,count+stringLength(p.name)+dlen,true);
    1618       case FULLYQUALIFIED()
     1618      case Absyn.FULLYQUALIFIED()
    16191619        algorithm
    16201620          System.stringAllocatorStringCopy(sb, delimiter, if reverse then len-count-dlen else count);
     
    16311631
    16321632function pathStringDefault
    1633   input Path path;
     1633  input Absyn.Path path;
    16341634  output String s = pathString(path);
    16351635end pathStringDefault;
    16361636
    16371637public function classNameCompare
    1638   input Class c1,c2;
     1638  input Absyn.Class c1,c2;
    16391639  output Integer o;
    16401640algorithm
     
    16431643
    16441644public function classNameGreater
    1645   input Class c1,c2;
     1645  input Absyn.Class c1,c2;
    16461646  output Boolean b;
    16471647algorithm
     
    16501650
    16511651public function pathCompare
    1652   input Path ip1;
    1653   input Path ip2;
     1652  input Absyn.Path ip1;
     1653  input Absyn.Path ip2;
    16541654  output Integer o;
    16551655algorithm
    16561656  o := match (ip1,ip2)
    16571657    local
    1658       Path p1,p2;
     1658      Absyn.Path p1,p2;
    16591659      String i1,i2;
    1660     case (FULLYQUALIFIED(p1),FULLYQUALIFIED(p2)) then pathCompare(p1,p2);
    1661     case (FULLYQUALIFIED(),_) then 1;
    1662     case (_,FULLYQUALIFIED()) then -1;
    1663     case (QUALIFIED(i1,p1),QUALIFIED(i2,p2))
     1660    case (Absyn.FULLYQUALIFIED(p1),Absyn.FULLYQUALIFIED(p2)) then pathCompare(p1,p2);
     1661    case (Absyn.FULLYQUALIFIED(),_) then 1;
     1662    case (_,Absyn.FULLYQUALIFIED()) then -1;
     1663    case (Absyn.QUALIFIED(i1,p1),Absyn.QUALIFIED(i2,p2))
    16641664      equation
    16651665        o = stringCompare(i1,i2);
    16661666        o = if o == 0 then pathCompare(p1, p2) else o;
    16671667      then o;
    1668     case (QUALIFIED(),_) then 1;
    1669     case (_,QUALIFIED()) then -1;
    1670     case (IDENT(i1),IDENT(i2))
     1668    case (Absyn.QUALIFIED(),_) then 1;
     1669    case (_,Absyn.QUALIFIED()) then -1;
     1670    case (Absyn.IDENT(i1),Absyn.IDENT(i2))
    16711671      then stringCompare(i1,i2);
    16721672  end match;
     
    16741674
    16751675public function pathCompareNoQual
    1676   input Path ip1;
    1677   input Path ip2;
     1676  input Absyn.Path ip1;
     1677  input Absyn.Path ip2;
    16781678  output Integer o;
    16791679algorithm
    16801680  o := match (ip1,ip2)
    16811681    local
    1682       Path p1,p2;
     1682      Absyn.Path p1,p2;
    16831683      String i1,i2;
    1684     case (FULLYQUALIFIED(p1),p2) then pathCompareNoQual(p1,p2);
    1685     case (p1,FULLYQUALIFIED(p2)) then pathCompareNoQual(p1,p2);
    1686     case (QUALIFIED(i1,p1),QUALIFIED(i2,p2))
     1684    case (Absyn.FULLYQUALIFIED(p1),p2) then pathCompareNoQual(p1,p2);
     1685    case (p1,Absyn.FULLYQUALIFIED(p2)) then pathCompareNoQual(p1,p2);
     1686    case (Absyn.QUALIFIED(i1,p1),Absyn.QUALIFIED(i2,p2))
    16871687      equation
    16881688        o = stringCompare(i1,i2);
    16891689        o = if o == 0 then pathCompare(p1, p2) else o;
    16901690      then o;
    1691     case (QUALIFIED(),_) then 1;
    1692     case (_,QUALIFIED()) then -1;
    1693     case (IDENT(i1),IDENT(i2))
     1691    case (Absyn.QUALIFIED(),_) then 1;
     1692    case (_,Absyn.QUALIFIED()) then -1;
     1693    case (Absyn.IDENT(i1),Absyn.IDENT(i2))
    16941694      then stringCompare(i1,i2);
    16951695  end match;
     
    16971697
    16981698public function pathHashMod "Hashes a path."
    1699   input Path path;
     1699  input Absyn.Path path;
    17001700  input Integer mod;
    17011701  output Integer hash;
     
    17091709
    17101710public function pathHashModWork "Hashes a path."
    1711   input Path path;
     1711  input Absyn.Path path;
    17121712  input Integer acc;
    17131713  output Integer hash;
     
    17151715  hash := match (path,acc)
    17161716    local
    1717       Path p;
     1717      Absyn.Path p;
    17181718      String s;
    17191719      Integer i,i2;
    1720     case (FULLYQUALIFIED(p),_) then pathHashModWork(p, acc*31 + 46 /* '.' */);
    1721     case (QUALIFIED(s,p),_) equation i = stringHashDjb2(s); i2 = acc*31+46; then pathHashModWork(p, i2*31 + i);
    1722     case (IDENT(s),_) equation i = stringHashDjb2(s); i2 = acc*31+46; then i2*31 + i;
     1720    case (Absyn.FULLYQUALIFIED(p),_) then pathHashModWork(p, acc*31 + 46 /* '.' */);
     1721    case (Absyn.QUALIFIED(s,p),_) equation i = stringHashDjb2(s); i2 = acc*31+46; then pathHashModWork(p, i2*31 + i);
     1722    case (Absyn.IDENT(s),_) equation i = stringHashDjb2(s); i2 = acc*31+46; then i2*31 + i;
    17231723  end match;
    17241724end pathHashModWork;
    17251725
    17261726public function optPathString "Returns a path converted to string or an empty string if nothing exist"
    1727   input Option<Path> inPathOption;
     1727  input Option<Absyn.Path> inPathOption;
    17281728  output String outString;
    17291729algorithm
    17301730  outString := match (inPathOption)
    17311731    local
    1732       Ident str;
    1733       Path p;
     1732      Absyn.Ident str;
     1733      Absyn.Path p;
    17341734    case (NONE()) then "";
    17351735    case (SOME(p))
     
    17471747  (Replaces dots with that separator). And also unquotes each ident.
    17481748"
    1749   input Path inPath;
     1749  input Absyn.Path inPath;
    17501750  input String repStr;
    17511751  output String outString;
     
    17641764  "Converts a string into a qualified path."
    17651765  input String str;
    1766   output Path qualifiedPath;
     1766  output Absyn.Path qualifiedPath;
    17671767
    17681768protected
     
    17761776  "Converts a list of strings into a qualified path."
    17771777  input list<String> paths;
    1778   output Path qualifiedPath;
     1778  output Absyn.Path qualifiedPath;
    17791779algorithm
    17801780  qualifiedPath := matchcontinue(paths)
     
    17821782      String str;
    17831783      list<String> rest_str;
    1784       Path p;
     1784      Absyn.Path p;
    17851785    case ({}) then fail();
    1786     case (str :: {}) then IDENT(str);
     1786    case (str :: {}) then Absyn.IDENT(str);
    17871787    case (str :: rest_str)
    17881788      equation
    17891789        p = stringListPath(rest_str);
    17901790      then
    1791         QUALIFIED(str, p);
     1791        Absyn.QUALIFIED(str, p);
    17921792  end matchcontinue;
    17931793end stringListPath;
     
    17971797   Ex: {'a', 'b', 'c'} => c.b.a"
    17981798  input list<String> inStrings;
    1799   output Path outPath;
     1799  output Absyn.Path outPath;
    18001800protected
    18011801  String id;
    18021802  list<String> rest_str;
    1803   Path path;
     1803  Absyn.Path path;
    18041804algorithm
    18051805  id :: rest_str := inStrings;
    1806   path := IDENT(id);
     1806  path := Absyn.IDENT(id);
    18071807  outPath := stringListPathReversed2(rest_str, path);
    18081808end stringListPathReversed;
     
    18101810protected function stringListPathReversed2
    18111811  input list<String> inStrings;
    1812   input Path inAccumPath;
    1813   output Path outPath;
     1812  input Absyn.Path inAccumPath;
     1813  output Absyn.Path outPath;
    18141814algorithm
    18151815  outPath := match(inStrings, inAccumPath)
     
    18171817      String id;
    18181818      list<String> rest_str;
    1819       Path path;
     1819      Absyn.Path path;
    18201820
    18211821    case ({}, _) then inAccumPath;
     
    18231823    case (id :: rest_str, _)
    18241824      equation
    1825         path = QUALIFIED(id, inAccumPath);
     1825        path = Absyn.QUALIFIED(id, inAccumPath);
    18261826      then
    18271827        stringListPathReversed2(rest_str, path);
     
    18311831
    18321832public function pathTwoLastIdents "Returns the two last idents of a path"
    1833   input Path inPath;
    1834   output Path outTwoLast;
     1833  input Absyn.Path inPath;
     1834  output Absyn.Path outTwoLast;
    18351835algorithm
    18361836  outTwoLast := match(inPath)
    18371837    local
    1838       Path p;
    1839 
    1840     case QUALIFIED(path = IDENT()) then inPath;
    1841     case QUALIFIED(path = p) then pathTwoLastIdents(p);
    1842     case FULLYQUALIFIED(path = p) then pathTwoLastIdents(p);
     1838      Absyn.Path p;
     1839
     1840    case Absyn.QUALIFIED(path = Absyn.IDENT()) then inPath;
     1841    case Absyn.QUALIFIED(path = p) then pathTwoLastIdents(p);
     1842    case Absyn.FULLYQUALIFIED(path = p) then pathTwoLastIdents(p);
    18431843  end match;
    18441844end pathTwoLastIdents;
     
    18461846public function pathLastIdent
    18471847  "Returns the last ident (after last dot) in a path"
    1848   input Path inPath;
     1848  input Absyn.Path inPath;
    18491849  output String outIdent;
    18501850algorithm
    18511851  outIdent := match(inPath)
    18521852    local
    1853       Ident id;
    1854       Path p;
    1855 
    1856     case QUALIFIED(path = p) then pathLastIdent(p);
    1857     case IDENT(name = id) then id;
    1858     case FULLYQUALIFIED(path = p) then pathLastIdent(p);
     1853      Absyn.Ident id;
     1854      Absyn.Path p;
     1855
     1856    case Absyn.QUALIFIED(path = p) then pathLastIdent(p);
     1857    case Absyn.IDENT(name = id) then id;
     1858    case Absyn.FULLYQUALIFIED(path = p) then pathLastIdent(p);
    18591859  end match;
    18601860end pathLastIdent;
     
    18621862public function pathLast
    18631863  "Returns the last ident (after last dot) in a path"
    1864   input output Path path;
     1864  input output Absyn.Path path;
    18651865algorithm
    18661866  path := match path
    18671867    local
    1868       Path p;
    1869     case QUALIFIED(path = p) then pathLast(p);
    1870     case IDENT() then path;
    1871     case FULLYQUALIFIED(path = p) then pathLast(p);
     1868      Absyn.Path p;
     1869    case Absyn.QUALIFIED(path = p) then pathLast(p);
     1870    case Absyn.IDENT() then path;
     1871    case Absyn.FULLYQUALIFIED(path = p) then pathLast(p);
    18721872  end match;
    18731873end pathLast;
    18741874
    18751875public function pathFirstIdent "Returns the first ident (before first dot) in a path"
    1876   input Path inPath;
    1877   output Ident outIdent;
     1876  input Absyn.Path inPath;
     1877  output Absyn.Ident outIdent;
    18781878algorithm
    18791879  outIdent := match (inPath)
    18801880    local
    1881       Ident n;
    1882       Path p;
    1883 
    1884     case (FULLYQUALIFIED(path = p)) then pathFirstIdent(p);
    1885     case (QUALIFIED(name = n)) then n;
    1886     case (IDENT(name = n)) then n;
     1881      Absyn.Ident n;
     1882      Absyn.Path p;
     1883
     1884    case (Absyn.FULLYQUALIFIED(path = p)) then pathFirstIdent(p);
     1885    case (Absyn.QUALIFIED(name = n)) then n;
     1886    case (Absyn.IDENT(name = n)) then n;
    18871887  end match;
    18881888end pathFirstIdent;
    18891889
    18901890public function pathFirstPath
    1891   input Path inPath;
    1892   output Path outPath;
     1891  input Absyn.Path inPath;
     1892  output Absyn.Path outPath;
    18931893algorithm
    18941894  outPath := match inPath
    18951895    local
    1896       Ident n;
    1897 
    1898     case IDENT() then inPath;
    1899     case QUALIFIED(name = n) then IDENT(n);
    1900     case FULLYQUALIFIED(path = outPath) then pathFirstPath(outPath);
     1896      Absyn.Ident n;
     1897
     1898    case Absyn.IDENT() then inPath;
     1899    case Absyn.QUALIFIED(name = n) then Absyn.IDENT(n);
     1900    case Absyn.FULLYQUALIFIED(path = outPath) then pathFirstPath(outPath);
    19011901  end match;
    19021902end pathFirstPath;
    19031903
    19041904public function pathSecondIdent
    1905   input Path inPath;
    1906   output Ident outIdent;
     1905  input Absyn.Path inPath;
     1906  output Absyn.Ident outIdent;
    19071907algorithm
    19081908  outIdent := match(inPath)
    19091909    local
    1910       Ident n;
    1911       Path p;
    1912 
    1913     case QUALIFIED(path = QUALIFIED(name = n)) then n;
    1914     case QUALIFIED(path = IDENT(name = n)) then n;
    1915     case FULLYQUALIFIED(path = p) then pathSecondIdent(p);
     1910      Absyn.Ident n;
     1911      Absyn.Path p;
     1912
     1913    case Absyn.QUALIFIED(path = Absyn.QUALIFIED(name = n)) then n;
     1914    case Absyn.QUALIFIED(path = Absyn.IDENT(name = n)) then n;
     1915    case Absyn.FULLYQUALIFIED(path = p) then pathSecondIdent(p);
    19161916
    19171917  end match;
     
    19191919
    19201920public function pathRest
    1921   input Path inPath;
    1922   output Path outPath;
     1921  input Absyn.Path inPath;
     1922  output Absyn.Path outPath;
    19231923algorithm
    19241924  outPath := match inPath
    1925     case QUALIFIED(path = outPath) then outPath;
    1926     case FULLYQUALIFIED(path = outPath) then pathRest(outPath);
     1925    case Absyn.QUALIFIED(path = outPath) then outPath;
     1926    case Absyn.FULLYQUALIFIED(path = outPath) then pathRest(outPath);
    19271927  end match;
    19281928end pathRest;
     
    19361936  outPath := matchcontinue(inPath1, inPath2)
    19371937    local
    1938       Ident ident1, ident2;
     1938      Absyn.Ident ident1, ident2;
    19391939      Absyn.Path path1, path2;
    19401940
     
    19551955public function pathPrefix
    19561956  "Returns the prefix of a path, i.e. this.is.a.path => this.is.a"
    1957   input Path path;
    1958   output Path prefix;
     1957  input Absyn.Path path;
     1958  output Absyn.Path prefix;
    19591959algorithm
    19601960  prefix := matchcontinue(path)
    19611961    local
    1962       Path p;
    1963       Ident n;
    1964 
    1965     case (FULLYQUALIFIED(path = p)) then pathPrefix(p);
    1966     case (QUALIFIED(name = n, path = IDENT())) then IDENT(n);
    1967     case (QUALIFIED(name = n, path = p))
     1962      Absyn.Path p;
     1963      Absyn.Ident n;
     1964
     1965    case (Absyn.FULLYQUALIFIED(path = p)) then pathPrefix(p);
     1966    case (Absyn.QUALIFIED(name = n, path = Absyn.IDENT())) then Absyn.IDENT(n);
     1967    case (Absyn.QUALIFIED(name = n, path = p))
    19681968      equation
    19691969        p = pathPrefix(p);
    19701970      then
    1971         QUALIFIED(n, p);
     1971        Absyn.QUALIFIED(n, p);
    19721972  end matchcontinue;
    19731973end pathPrefix;
     
    19751975public function prefixPath
    19761976  "Prefixes a path with an identifier."
    1977   input Ident prefix;
    1978   input Path path;
    1979   output Path outPath;
    1980 algorithm
    1981   outPath := QUALIFIED(prefix, path);
     1977  input Absyn.Ident prefix;
     1978  input Absyn.Path path;
     1979  output Absyn.Path outPath;
     1980algorithm
     1981  outPath := Absyn.QUALIFIED(prefix, path);
    19821982end prefixPath;
    19831983
    19841984public function prefixOptPath
    19851985  "Prefixes an optional path with an identifier."
    1986   input Ident prefix;
    1987   input Option<Path> optPath;
    1988   output Option<Path> outPath;
     1986  input Absyn.Ident prefix;
     1987  input Option<Absyn.Path> optPath;
     1988  output Option<Absyn.Path> outPath;
    19891989algorithm
    19901990  outPath := match(prefix, optPath)
    19911991    local
    1992       Path path;
    1993 
    1994     case (_, NONE()) then SOME(IDENT(prefix));
    1995     case (_, SOME(path)) then SOME(QUALIFIED(prefix, path));
     1992      Absyn.Path path;
     1993
     1994    case (_, NONE()) then SOME(Absyn.IDENT(prefix));
     1995    case (_, SOME(path)) then SOME(Absyn.QUALIFIED(prefix, path));
    19961996  end match;
    19971997end prefixOptPath;
     
    20002000  "Adds a suffix to a path. Ex:
    20012001     suffixPath(a.b.c, 'd') => a.b.c.d"
    2002   input Path inPath;
    2003   input Ident inSuffix;
    2004   output Path outPath;
     2002  input Absyn.Path inPath;
     2003  input Absyn.Ident inSuffix;
     2004  output Absyn.Path outPath;
    20052005algorithm
    20062006  outPath := match(inPath, inSuffix)
    20072007    local
    2008       Ident name;
    2009       Path path;
    2010 
    2011     case (IDENT(name), _)
    2012       then QUALIFIED(name, IDENT(inSuffix));
    2013 
    2014     case (QUALIFIED(name, path), _)
     2008      Absyn.Ident name;
     2009      Absyn.Path path;
     2010
     2011    case (Absyn.IDENT(name), _)
     2012      then Absyn.QUALIFIED(name, Absyn.IDENT(inSuffix));
     2013
     2014    case (Absyn.QUALIFIED(name, path), _)
    20152015      equation
    20162016        path = suffixPath(path, inSuffix);
    20172017      then
    2018         QUALIFIED(name, path);
    2019 
    2020     case (FULLYQUALIFIED(path), _)
     2018        Absyn.QUALIFIED(name, path);
     2019
     2020    case (Absyn.FULLYQUALIFIED(path), _)
    20212021      equation
    20222022        path = suffixPath(path, inSuffix);
    20232023      then
    2024         FULLYQUALIFIED(path);
     2024        Absyn.FULLYQUALIFIED(path);
    20252025
    20262026  end match;
     
    20282028
    20292029public function pathSuffixOf "returns true if suffix_path is a suffix of path"
    2030   input Path suffix_path;
    2031   input Path path;
     2030  input Absyn.Path suffix_path;
     2031  input Absyn.Path path;
    20322032  output Boolean res;
    20332033algorithm
    20342034  res := matchcontinue(suffix_path,path)
    2035   local Path p;
     2035  local Absyn.Path p;
    20362036    case(_,_)
    20372037      equation
    20382038      true = pathEqual(suffix_path,path);
    20392039      then true;
    2040     case(_,FULLYQUALIFIED(path = p))
     2040    case(_,Absyn.FULLYQUALIFIED(path = p))
    20412041      then pathSuffixOf(suffix_path,p);
    2042     case(_,QUALIFIED(path = p))
     2042    case(_,Absyn.QUALIFIED(path = p))
    20432043      then pathSuffixOf(suffix_path,p);
    20442044    else false;
     
    20472047
    20482048public function pathSuffixOfr "returns true if suffix_path is a suffix of path"
    2049   input Path path;
    2050   input Path suffix_path;
     2049  input Absyn.Path path;
     2050  input Absyn.Path suffix_path;
    20512051  output Boolean res;
    20522052algorithm
     
    20552055
    20562056public function pathToStringList
    2057   input Path path;
     2057  input Absyn.Path path;
    20582058  output list<String> outPaths;
    20592059algorithm
     
    20622062
    20632063protected function pathToStringListWork
    2064   input Path path;
     2064  input Absyn.Path path;
    20652065  input list<String> acc;
    20662066  output list<String> outPaths;
     
    20692069    local
    20702070      String n;
    2071       Path p;
     2071      Absyn.Path p;
    20722072      list<String> strings;
    20732073
    2074     case (IDENT(name = n),_) then n::acc;
    2075     case (FULLYQUALIFIED(path = p),_) then pathToStringListWork(p,acc);
    2076     case (QUALIFIED(name = n,path = p),_)
     2074    case (Absyn.IDENT(name = n),_) then n::acc;
     2075    case (Absyn.FULLYQUALIFIED(path = p),_) then pathToStringListWork(p,acc);
     2076    case (Absyn.QUALIFIED(name = n,path = p),_)
    20772077      then pathToStringListWork(p,n::acc);
    20782078  end match;
     
    20842084  (a, b.c.d) => b.c.d
    20852085"
    2086   input Path path;
    2087   input Path replPath;
    2088   output Path outPath;
     2086  input Absyn.Path path;
     2087  input Absyn.Path replPath;
     2088  output Absyn.Path outPath;
    20892089algorithm
    20902090  outPath := match(path,replPath)
    20912091    local
    2092       Path p;
     2092      Absyn.Path p;
    20932093    // Should not be possible to replace FQ paths
    2094     case (QUALIFIED(path = p), _) then joinPaths(replPath,p);
    2095     case (IDENT(), _) then replPath;
     2094    case (Absyn.QUALIFIED(path = p), _) then joinPaths(replPath,p);
     2095    case (Absyn.IDENT(), _) then replPath;
    20962096  end match;
    20972097end pathReplaceFirstIdent;
     
    20992099public function addSubscriptsLast
    21002100  "Function for appending subscripts at end of last ident"
    2101   input ComponentRef icr;
    2102   input list<Subscript> i;
    2103   output ComponentRef ocr;
     2101  input Absyn.ComponentRef icr;
     2102  input list<Absyn.Subscript> i;
     2103  output Absyn.ComponentRef ocr;
    21042104algorithm
    21052105  ocr := match(icr,i)
    21062106    local
    2107       list<Subscript> subs;
     2107      list<Absyn.Subscript> subs;
    21082108      String id;
    2109       ComponentRef cr;
    2110 
    2111     case (CREF_IDENT(id,subs),_)
    2112       then CREF_IDENT(id, listAppend(subs, i));
    2113 
    2114     case (CREF_QUAL(id,subs,cr),_)
     2109      Absyn.ComponentRef cr;
     2110
     2111    case (Absyn.CREF_IDENT(id,subs),_)
     2112      then Absyn.CREF_IDENT(id, listAppend(subs, i));
     2113
     2114    case (Absyn.CREF_QUAL(id,subs,cr),_)
    21152115      equation
    21162116        cr = addSubscriptsLast(cr,i);
    21172117      then
    2118         CREF_QUAL(id,subs,cr);
    2119     case (CREF_FULLYQUALIFIED(cr),_)
     2118        Absyn.CREF_QUAL(id,subs,cr);
     2119    case (Absyn.CREF_FULLYQUALIFIED(cr),_)
    21202120      equation
    21212121        cr = addSubscriptsLast(cr,i);
     
    21302130  (a[3], b.c.d) => b.c.d[3]
    21312131"
    2132   input ComponentRef icref;
    2133   input Path replPath;
    2134   output ComponentRef outCref;
     2132  input Absyn.ComponentRef icref;
     2133  input Absyn.Path replPath;
     2134  output Absyn.ComponentRef outCref;
    21352135algorithm
    21362136  outCref := match(icref,replPath)
    21372137    local
    2138       list<Subscript> subs;
    2139       ComponentRef cr,cref;
    2140     case (CREF_FULLYQUALIFIED(componentRef = cr),_)
     2138      list<Absyn.Subscript> subs;
     2139      Absyn.ComponentRef cr,cref;
     2140    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr),_)
    21412141      equation
    21422142        cr = crefReplaceFirstIdent(cr,replPath);
    21432143      then crefMakeFullyQualified(cr);
    2144     case (CREF_QUAL(componentRef = cr, subscripts = subs),_)
     2144    case (Absyn.CREF_QUAL(componentRef = cr, subscripts = subs),_)
    21452145      equation
    21462146        cref = pathToCref(replPath);
    21472147        cref = addSubscriptsLast(cref,subs);
    21482148      then joinCrefs(cref,cr);
    2149     case (CREF_IDENT(subscripts = subs),_)
     2149    case (Absyn.CREF_IDENT(subscripts = subs),_)
    21502150      equation
    21512151        cref = pathToCref(replPath);
     
    21572157public function pathPrefixOf
    21582158  "Returns true if prefixPath is a prefix of path, false otherwise."
    2159   input Path prefixPath;
    2160   input Path path;
     2159  input Absyn.Path prefixPath;
     2160  input Absyn.Path path;
    21612161  output Boolean isPrefix;
    21622162algorithm
    21632163  isPrefix := matchcontinue(prefixPath, path)
    21642164    local
    2165       Path p, p2;
     2165      Absyn.Path p, p2;
    21662166      String id, id2;
    2167     case (FULLYQUALIFIED(p), p2) then pathPrefixOf(p, p2);
    2168     case (p, FULLYQUALIFIED(p2)) then pathPrefixOf(p, p2);
    2169     case (IDENT(id), IDENT(id2)) then stringEq(id, id2);
    2170     case (IDENT(id), QUALIFIED(name = id2)) then stringEq(id, id2);
    2171     case (QUALIFIED(id, p), QUALIFIED(id2, p2))
     2167    case (Absyn.FULLYQUALIFIED(p), p2) then pathPrefixOf(p, p2);
     2168    case (p, Absyn.FULLYQUALIFIED(p2)) then pathPrefixOf(p, p2);
     2169    case (Absyn.IDENT(id), Absyn.IDENT(id2)) then stringEq(id, id2);
     2170    case (Absyn.IDENT(id), Absyn.QUALIFIED(name = id2)) then stringEq(id, id2);
     2171    case (Absyn.QUALIFIED(id, p), Absyn.QUALIFIED(id2, p2))
    21722172      equation
    21732173        true = stringEq(id, id2);
     
    21852185  Returns true if prefixCr is a prefix of cr, i.e., false otherwise.
    21862186  Subscripts are NOT checked."
    2187   input ComponentRef prefixCr;
    2188   input ComponentRef cr;
     2187  input Absyn.ComponentRef prefixCr;
     2188  input Absyn.ComponentRef cr;
    21892189  output Boolean out;
    21902190algorithm
     
    22012201
    22022202public function removePrefix "removes the prefix_path from path, and returns the rest of path"
    2203   input Path prefix_path;
    2204   input Path path;
    2205   output Path newPath;
     2203  input Absyn.Path prefix_path;
     2204  input Absyn.Path path;
     2205  output Absyn.Path newPath;
    22062206algorithm
    22072207  newPath := match(prefix_path,path)
    2208     local Path p,p2; Ident id1,id2;
     2208    local Absyn.Path p,p2; Absyn.Ident id1,id2;
    22092209    // fullyqual path
    2210     case (p,FULLYQUALIFIED(p2)) then removePrefix(p,p2);
     2210    case (p,Absyn.FULLYQUALIFIED(p2)) then removePrefix(p,p2);
    22112211    // qual
    2212     case (QUALIFIED(name=id1,path=p),QUALIFIED(name=id2,path=p2))
     2212    case (Absyn.QUALIFIED(name=id1,path=p),Absyn.QUALIFIED(name=id2,path=p2))
    22132213      equation
    22142214        true = stringEq(id1, id2);
     
    22162216        removePrefix(p,p2);
    22172217    // ids
    2218     case(IDENT(id1),QUALIFIED(name=id2,path=p2))
     2218    case(Absyn.IDENT(id1),Absyn.QUALIFIED(name=id2,path=p2))
    22192219      equation
    22202220        true = stringEq(id1, id2);
     
    22292229    removePartialPrefix(A.B.C, B.C.D.E) => D.E
    22302230  "
    2231   input Path inPrefix;
    2232   input Path inPath;
    2233   output Path outPath;
     2231  input Absyn.Path inPrefix;
     2232  input Absyn.Path inPath;
     2233  output Absyn.Path outPath;
    22342234algorithm
    22352235  outPath := matchcontinue(inPrefix, inPath)
    22362236    local
    2237       Path p;
     2237      Absyn.Path p;
    22382238
    22392239    case (_, _)
     
    22432243        p;
    22442244
    2245     case (QUALIFIED(path = p), _)
     2245    case (Absyn.QUALIFIED(path = p), _)
    22462246      equation
    22472247        p = removePrefix(p, inPath);
     
    22492249        p;
    22502250
    2251     case (FULLYQUALIFIED(path = p), _)
     2251    case (Absyn.FULLYQUALIFIED(path = p), _)
    22522252      equation
    22532253        p = removePartialPrefix(p, inPath);
     
    22682268  otherwise fails. Subscripts are NOT checked.
    22692269"
    2270   input ComponentRef prefixCr;
    2271   input ComponentRef cr;
    2272   output ComponentRef out;
     2270  input Absyn.ComponentRef prefixCr;
     2271  input Absyn.ComponentRef cr;
     2272  output Absyn.ComponentRef out;
    22732273algorithm
    22742274  out := match(prefixCr, cr)
    22752275    local
    2276       Ident prefixIdent, ident;
    2277       ComponentRef prefixRestCr, restCr;
     2276      Absyn.Ident prefixIdent, ident;
     2277      Absyn.ComponentRef prefixRestCr, restCr;
    22782278    // fqual
    2279     case(CREF_FULLYQUALIFIED(componentRef = prefixRestCr), CREF_FULLYQUALIFIED(componentRef = restCr))
     2279    case(Absyn.CREF_FULLYQUALIFIED(componentRef = prefixRestCr), Absyn.CREF_FULLYQUALIFIED(componentRef = restCr))
    22802280      then
    22812281        crefRemovePrefix(prefixRestCr, restCr);
    22822282    // qual
    2283     case(CREF_QUAL(name = prefixIdent, componentRef = prefixRestCr), CREF_QUAL(name = ident, componentRef = restCr))
     2283    case(Absyn.CREF_QUAL(name = prefixIdent, componentRef = prefixRestCr), Absyn.CREF_QUAL(name = ident, componentRef = restCr))
    22842284      equation
    22852285        true = stringEq(prefixIdent, ident);
     
    22872287        crefRemovePrefix(prefixRestCr, restCr);
    22882288    // id vs. qual
    2289     case(CREF_IDENT(name = prefixIdent), CREF_QUAL(name = ident, componentRef = restCr))
     2289    case(Absyn.CREF_IDENT(name = prefixIdent), Absyn.CREF_QUAL(name = ident, componentRef = restCr))
    22902290      equation
    22912291        true = stringEq(prefixIdent, ident);
    22922292      then restCr;
    22932293    // id vs. id
    2294     case(CREF_IDENT(name = prefixIdent), CREF_IDENT(name = ident))
     2294    case(Absyn.CREF_IDENT(name = prefixIdent), Absyn.CREF_IDENT(name = ident))
    22952295      equation
    22962296        true = stringEq(prefixIdent, ident);
    2297       then CREF_IDENT("", {});
     2297      then Absyn.CREF_IDENT("", {});
    22982298  end match;
    22992299end crefRemovePrefix;
     
    23012301public function pathContains
    23022302  "Author BZ,
    2303    checks if one IDENT(..) is contained in path."
    2304   input Path fullPath;
    2305   input Path pathId;
     2303   checks if one Absyn.IDENT(..) is contained in path."
     2304  input Absyn.Path fullPath;
     2305  input Absyn.Path pathId;
    23062306  output Boolean b;
    23072307algorithm
     
    23092309    local
    23102310      String str1,str2;
    2311       Path qp;
     2311      Absyn.Path qp;
    23122312      Boolean b1,b2;
    23132313
    2314     case(IDENT(str1),IDENT(str2)) then stringEq(str1,str2);
    2315 
    2316     case(QUALIFIED(str1,qp),IDENT(str2))
     2314    case(Absyn.IDENT(str1),Absyn.IDENT(str2)) then stringEq(str1,str2);
     2315
     2316    case(Absyn.QUALIFIED(str1,qp),Absyn.IDENT(str2))
    23172317      equation
    23182318        b1 = stringEq(str1,str2);
     
    23222322        b1;
    23232323
    2324     case(FULLYQUALIFIED(qp),_) then pathContains(qp,pathId);
     2324    case(Absyn.FULLYQUALIFIED(qp),_) then pathContains(qp,pathId);
    23252325  end match;
    23262326end pathContains;
     
    23282328public function pathContainsString
    23292329  "Author OT,
    2330    checks if Path contains the given string."
    2331   input Path p1;
     2330   checks if Absyn.Path contains the given string."
     2331  input Absyn.Path p1;
    23322332  input String str;
    23332333  output Boolean b;
     
    23362336    local
    23372337      String str1,searchStr;
    2338       Path qp;
     2338      Absyn.Path qp;
    23392339      Boolean b1,b2,b3;
    23402340
    2341     case(IDENT(str1),searchStr)
     2341    case(Absyn.IDENT(str1),searchStr)
    23422342      equation
    23432343        b1 = System.stringFind(str1,searchStr) <> -1;
    23442344      then b1;
    23452345
    2346     case(QUALIFIED(str1,qp),searchStr)
     2346    case(Absyn.QUALIFIED(str1,qp),searchStr)
    23472347      equation
    23482348        b1 = System.stringFind(str1, searchStr) <> -1;
     
    23522352        b3;
    23532353
    2354     case(FULLYQUALIFIED(qp), searchStr) then pathContainsString(qp, searchStr);
     2354    case(Absyn.FULLYQUALIFIED(qp), searchStr) then pathContainsString(qp, searchStr);
    23552355  end match;
    23562356end pathContainsString;
     
    23642364     pathContainedIn(A.B.C.D, A.B.C.D) => A.B.C.D
    23652365     pathContainedIn(B.C,A.B) => A.B.C"
    2366   input Path subPath;
    2367   input Path path;
    2368   output Path completePath;
     2366  input Absyn.Path subPath;
     2367  input Absyn.Path path;
     2368  output Absyn.Path completePath;
    23692369algorithm
    23702370  completePath := matchcontinue(subPath,path)
    23712371    local
    2372       Ident ident;
    2373       Path newPath,newSubPath;
     2372      Absyn.Ident ident;
     2373      Absyn.Path newPath,newSubPath;
    23742374
    23752375    // A suffix, e.g. C.D in A.B.C.D
     
    23852385        newPath = stripLast(path);
    23862386        newPath=pathContainedIn(subPath,newPath);
    2387       then joinPaths(newPath,IDENT(ident));
     2387      then joinPaths(newPath,Absyn.IDENT(ident));
    23882388
    23892389    // strip last ident of subpath and recursively check if suffix.
     
    23932393        newSubPath = stripLast(subPath);
    23942394        newSubPath=pathContainedIn(newSubPath,path);
    2395       then joinPaths(newSubPath,IDENT(ident));
     2395      then joinPaths(newSubPath,Absyn.IDENT(ident));
    23962396
    23972397  end matchcontinue;
     
    24012401  "Author BZ 2009-08
    24022402   Function for getting ComponentRefs out from Subscripts"
    2403   input list<Subscript> isubs;
     2403  input list<Absyn.Subscript> isubs;
    24042404  input Boolean includeSubs "include crefs from array subscripts";
    24052405  input Boolean includeFunctions "note that if you say includeSubs = false then you won't get the functions from array subscripts";
    2406   output list<ComponentRef> crefs;
     2406  output list<Absyn.ComponentRef> crefs;
    24072407algorithm
    24082408  crefs := match(isubs,includeSubs,includeFunctions)
    24092409    local
    2410       list<ComponentRef> crefs1;
    2411       Exp exp;
    2412       list<Subscript> subs;
     2410      list<Absyn.ComponentRef> crefs1;
     2411      Absyn.Exp exp;
     2412      list<Absyn.Subscript> subs;
    24132413
    24142414    case({},_,_) then {};
    24152415
    2416     case(NOSUB()::subs,_,_) then getCrefsFromSubs(subs,includeSubs,includeFunctions);
    2417 
    2418     case(SUBSCRIPT(exp)::subs,_,_)
     2416    case(Absyn.NOSUB()::subs,_,_) then getCrefsFromSubs(subs,includeSubs,includeFunctions);
     2417
     2418    case(Absyn.SUBSCRIPT(exp)::subs,_,_)
    24192419      equation
    24202420        crefs1 = getCrefsFromSubs(subs,includeSubs,includeFunctions);
     
    24282428  "Returns a flattened list of the
    24292429   component references in an expression"
    2430   input Exp inExp;
     2430  input Absyn.Exp inExp;
    24312431  input Boolean includeSubs "include crefs from array subscripts";
    24322432  input Boolean includeFunctions "note that if you say includeSubs = false then you won't get the functions from array subscripts";
    2433   output list<ComponentRef> outComponentRefLst;
     2433  output list<Absyn.ComponentRef> outComponentRefLst;
    24342434algorithm
    24352435  outComponentRefLst := match (inExp,includeSubs,includeFunctions)
    24362436    local
    2437       ComponentRef cr;
    2438       list<ComponentRef> l1,l2,res;
    2439       ComponentCondition e1,e2,e3;
    2440       Operator op;
    2441       list<tuple<ComponentCondition, ComponentCondition>> e4;
    2442       FunctionArgs farg;
    2443       list<ComponentCondition> expl;
    2444       list<list<ComponentCondition>> expll;
    2445       list<Subscript> subs;
    2446       list<list<ComponentRef>> lstres1;
    2447       list<list<ComponentRef>> crefll;
    2448 
    2449     case (INTEGER(),_,_) then {};
    2450     case (REAL(),_,_) then {};
    2451     case (STRING(),_,_) then {};
    2452     case (BOOL(),_,_) then {};
    2453     case (CREF(componentRef = ALLWILD()),_,_) then {};
    2454     case (CREF(componentRef = WILD()),_,_) then {};
    2455     case (CREF(componentRef = cr),false,_) then {cr};
    2456 
    2457     case (CREF(componentRef = (cr)),true,_)
     2437      Absyn.ComponentRef cr;
     2438      list<Absyn.ComponentRef> l1,l2,res;
     2439      Absyn.ComponentCondition e1,e2,e3;
     2440      Absyn.Operator op;
     2441      list<tuple<Absyn.ComponentCondition, Absyn.ComponentCondition>> e4;
     2442      Absyn.FunctionArgs farg;
     2443      list<Absyn.ComponentCondition> expl;
     2444      list<list<Absyn.ComponentCondition>> expll;
     2445      list<Absyn.Subscript> subs;
     2446      list<list<Absyn.ComponentRef>> lstres1;
     2447      list<list<Absyn.ComponentRef>> crefll;
     2448
     2449    case (Absyn.INTEGER(),_,_) then {};
     2450    case (Absyn.REAL(),_,_) then {};
     2451    case (Absyn.STRING(),_,_) then {};
     2452    case (Absyn.BOOL(),_,_) then {};
     2453    case (Absyn.CREF(componentRef = Absyn.ALLWILD()),_,_) then {};
     2454    case (Absyn.CREF(componentRef = Absyn.WILD()),_,_) then {};
     2455    case (Absyn.CREF(componentRef = cr),false,_) then {cr};
     2456
     2457    case (Absyn.CREF(componentRef = (cr)),true,_)
    24582458      equation
    24592459        subs = getSubsFromCref(cr,includeSubs,includeFunctions);
     
    24612461      then cr::l1;
    24622462
    2463     case (BINARY(exp1 = e1,exp2 = e2),_,_)
     2463    case (Absyn.BINARY(exp1 = e1,exp2 = e2),_,_)
    24642464      equation
    24652465        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    24692469        res;
    24702470
    2471     case (UNARY(exp = e1),_,_)
     2471    case (Absyn.UNARY(exp = e1),_,_)
    24722472      equation
    24732473        res = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    24752475        res;
    24762476
    2477     case (LBINARY(exp1 = e1,exp2 = e2),_,_)
     2477    case (Absyn.LBINARY(exp1 = e1,exp2 = e2),_,_)
    24782478      equation
    24792479        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    24832483        res;
    24842484
    2485     case (LUNARY(exp = e1),_,_)
     2485    case (Absyn.LUNARY(exp = e1),_,_)
    24862486      equation
    24872487        res = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    24892489        res;
    24902490
    2491     case (RELATION(exp1 = e1,exp2 = e2),_,_)
     2491    case (Absyn.RELATION(exp1 = e1,exp2 = e2),_,_)
    24922492      equation
    24932493        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    24982498
    24992499    // TODO: Handle else if-branches.
    2500     case (IFEXP(ifExp = e1,trueBranch = e2,elseBranch = e3),_,_)
     2500    case (Absyn.IFEXP(ifExp = e1,trueBranch = e2,elseBranch = e3),_,_)
    25012501      then List.flatten({
    25022502        getCrefFromExp(e1, includeSubs, includeFunctions),
     
    25042504        getCrefFromExp(e3, includeSubs, includeFunctions)});
    25052505
    2506     case (CALL(function_ = cr, functionArgs = farg),_,_)
     2506    case (Absyn.CALL(function_ = cr, functionArgs = farg),_,_)
    25072507      equation
    25082508        res = getCrefFromFarg(farg,includeSubs,includeFunctions);
     
    25102510      then
    25112511        res;
    2512     case (PARTEVALFUNCTION(function_ = cr, functionArgs = farg),_,_)
     2512    case (Absyn.PARTEVALFUNCTION(function_ = cr, functionArgs = farg),_,_)
    25132513      equation
    25142514        res = getCrefFromFarg(farg,includeSubs,includeFunctions);
     
    25162516      then
    25172517        res;
    2518     case (ARRAY(arrayExp = expl),_,_)
     2518    case (Absyn.ARRAY(arrayExp = expl),_,_)
    25192519      equation
    25202520        lstres1 = List.map2(expl, getCrefFromExp, includeSubs, includeFunctions);
     
    25222522      then
    25232523        res;
    2524     case (MATRIX(matrix = expll),_,_)
     2524    case (Absyn.MATRIX(matrix = expll),_,_)
    25252525      equation
    25262526        res = List.flatten(List.flatten(List.map2List(expll, getCrefFromExp, includeSubs, includeFunctions)));
    25272527      then
    25282528        res;
    2529     case (RANGE(start = e1,step = SOME(e3),stop = e2),_,_)
     2529    case (Absyn.RANGE(start = e1,step = SOME(e3),stop = e2),_,_)
    25302530      equation
    25312531        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    25362536      then
    25372537        res;
    2538     case (RANGE(start = e1,step = NONE(),stop = e2),_,_)
     2538    case (Absyn.RANGE(start = e1,step = NONE(),stop = e2),_,_)
    25392539      equation
    25402540        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    25442544        res;
    25452545
    2546     case (END(),_,_) then {};
    2547 
    2548     case (TUPLE(expressions = expl),_,_)
     2546    case (Absyn.END(),_,_) then {};
     2547
     2548    case (Absyn.TUPLE(expressions = expl),_,_)
    25492549      equation
    25502550        crefll = List.map2(expl,getCrefFromExp,includeSubs,includeFunctions);
     
    25532553        res;
    25542554
    2555     case (CODE(),_,_) then {};
    2556 
    2557     case (AS(exp = e1),_,_) then getCrefFromExp(e1,includeSubs,includeFunctions);
    2558 
    2559     case (CONS(e1,e2),_,_)
     2555    case (Absyn.CODE(),_,_) then {};
     2556
     2557    case (Absyn.AS(exp = e1),_,_) then getCrefFromExp(e1,includeSubs,includeFunctions);
     2558
     2559    case (Absyn.CONS(e1,e2),_,_)
    25602560      equation
    25612561        l1 = getCrefFromExp(e1,includeSubs,includeFunctions);
     
    25652565        res;
    25662566
    2567     case (LIST(expl),_,_)
     2567    case (Absyn.LIST(expl),_,_)
    25682568      equation
    25692569        crefll = List.map2(expl,getCrefFromExp,includeSubs,includeFunctions);
     
    25722572        res;
    25732573
    2574     case (MATCHEXP(),_,_) then fail();
    2575 
    2576     case (DOT(),_,_)
     2574    case (Absyn.MATCHEXP(),_,_) then fail();
     2575
     2576    case (Absyn.DOT(),_,_)
    25772577      // inExp.index is only allowed to contain names to index the function call; not crefs that are evaluated in any way
    25782578      then getCrefFromExp(inExp.exp,includeSubs,includeFunctions);
     
    25872587public function getCrefFromFarg "Returns the flattened list of all component references
    25882588  present in a list of function arguments."
    2589   input FunctionArgs inFunctionArgs;
     2589  input Absyn.FunctionArgs inFunctionArgs;
    25902590  input Boolean includeSubs "include crefs from array subscripts";
    25912591  input Boolean includeFunctions "note that if you say includeSubs = false then you won't get the functions from array subscripts";
    2592   output list<ComponentRef> outComponentRefLst;
     2592  output list<Absyn.ComponentRef> outComponentRefLst;
    25932593algorithm
    25942594  outComponentRefLst := match (inFunctionArgs,includeSubs,includeFunctions)
    25952595    local
    2596       list<list<ComponentRef>> l1,l2;
    2597       list<ComponentRef> fl1,fl2,fl3,res;
    2598       list<ComponentCondition> expl;
    2599       list<NamedArg> nargl;
    2600       ForIterators iterators;
    2601       Exp exp;
    2602 
    2603     case (FUNCTIONARGS(args = expl,argNames = nargl),_,_)
     2596      list<list<Absyn.ComponentRef>> l1,l2;
     2597      list<Absyn.ComponentRef> fl1,fl2,fl3,res;
     2598      list<Absyn.ComponentCondition> expl;
     2599      list<Absyn.NamedArg> nargl;
     2600      Absyn.ForIterators iterators;
     2601      Absyn.Exp exp;
     2602
     2603    case (Absyn.FUNCTIONARGS(args = expl,argNames = nargl),_,_)
    26042604      equation
    26052605        l1 = List.map2(expl, getCrefFromExp, includeSubs, includeFunctions);
     
    26112611        res;
    26122612
    2613     case (FOR_ITER_FARG(exp,_,iterators),_,_)
     2613    case (Absyn.FOR_ITER_FARG(exp,_,iterators),_,_)
    26142614      equation
    26152615        l1 = List.map2Option(List.map(iterators,iteratorRange),getCrefFromExp,includeSubs,includeFunctions);
     
    26262626
    26272627public function iteratorName
    2628   input ForIterator iterator;
     2628  input Absyn.ForIterator iterator;
    26292629  output String name;
    26302630algorithm
    2631   ITERATOR(name=name) := iterator;
     2631  Absyn.ITERATOR(name=name) := iterator;
    26322632end iteratorName;
    26332633
    26342634public function iteratorRange
    2635   input ForIterator iterator;
    2636   output Option<Exp> range;
    2637 algorithm
    2638   ITERATOR(range=range) := iterator;
     2635  input Absyn.ForIterator iterator;
     2636  output Option<Absyn.Exp> range;
     2637algorithm
     2638  Absyn.ITERATOR(range=range) := iterator;
    26392639end iteratorRange;
    26402640
    26412641public function iteratorGuard
    2642   input ForIterator iterator;
    2643   output Option<Exp> guardExp;
    2644 algorithm
    2645   ITERATOR(guardExp=guardExp) := iterator;
     2642  input Absyn.ForIterator iterator;
     2643  output Option<Absyn.Exp> guardExp;
     2644algorithm
     2645  Absyn.ITERATOR(guardExp=guardExp) := iterator;
    26462646end iteratorGuard;
    26472647
     
    26492649public function getNamedFuncArgNamesAndValues
    26502650"returns the names from a list of NamedArgs as a string list"
    2651   input list<NamedArg> inNamedArgList;
     2651  input list<Absyn.NamedArg> inNamedArgList;
    26522652  output list<String> outStringList;
    2653   output list<Exp> outExpList;
     2653  output list<Absyn.Exp> outExpList;
    26542654algorithm
    26552655  (outStringList,outExpList) := match ( inNamedArgList )
    26562656    local
    2657       list<NamedArg> cdr;
     2657      list<Absyn.NamedArg> cdr;
    26582658      String s;
    2659       Exp e;
     2659      Absyn.Exp e;
    26602660      list<String> slst;
    2661       list<Exp> elst;
     2661      list<Absyn.Exp> elst;
    26622662
    26632663    case ({})  then ({},{});
    2664     case (NAMEDARG(argName=s,argValue=e) :: cdr)
     2664    case (Absyn.NAMEDARG(argName=s,argValue=e) :: cdr)
    26652665      equation
    26662666        (slst,elst) = getNamedFuncArgNamesAndValues(cdr);
     
    26722672protected function getCrefFromNarg "Returns the flattened list of all component references
    26732673  present in a list of named function arguments."
    2674   input NamedArg inNamedArg;
     2674  input Absyn.NamedArg inNamedArg;
    26752675  input Boolean includeSubs "include crefs from array subscripts";
    26762676  input Boolean includeFunctions "note that if you say includeSubs = false then you won't get the functions from array subscripts";
    2677   output list<ComponentRef> outComponentRefLst;
     2677  output list<Absyn.ComponentRef> outComponentRefLst;
    26782678algorithm
    26792679  outComponentRefLst := match (inNamedArg,includeSubs,includeFunctions)
    26802680    local
    2681       list<ComponentRef> res;
    2682       ComponentCondition exp;
    2683     case (NAMEDARG(argValue = exp),_,_)
     2681      list<Absyn.ComponentRef> res;
     2682      Absyn.ComponentCondition exp;
     2683    case (Absyn.NAMEDARG(argValue = exp),_,_)
    26842684      equation
    26852685        res = getCrefFromExp(exp,includeSubs,includeFunctions);
     
    26902690
    26912691public function joinPaths "This function joins two paths"
    2692   input Path inPath1;
    2693   input Path inPath2;
    2694   output Path outPath;
     2692  input Absyn.Path inPath1;
     2693  input Absyn.Path inPath2;
     2694  output Absyn.Path outPath;
    26952695algorithm
    26962696  outPath := match (inPath1,inPath2)
    26972697    local
    2698       Ident str;
    2699       Path p2,p_1,p;
    2700     case (IDENT(name = str),p2) then QUALIFIED(str,p2);
    2701     case (QUALIFIED(name = str,path = p),p2)
     2698      Absyn.Ident str;
     2699      Absyn.Path p2,p_1,p;
     2700    case (Absyn.IDENT(name = str),p2) then Absyn.QUALIFIED(str,p2);
     2701    case (Absyn.QUALIFIED(name = str,path = p),p2)
    27022702      equation
    27032703        p_1 = joinPaths(p, p2);
    27042704      then
    2705         QUALIFIED(str,p_1);
    2706     case(FULLYQUALIFIED(p),p2) then joinPaths(p,p2);
    2707     case(p,FULLYQUALIFIED(p2)) then joinPaths(p,p2);
     2705        Absyn.QUALIFIED(str,p_1);
     2706    case(Absyn.FULLYQUALIFIED(p),p2) then joinPaths(p,p2);
     2707    case(p,Absyn.FULLYQUALIFIED(p2)) then joinPaths(p,p2);
    27082708  end match;
    27092709end joinPaths;
    27102710
    27112711public function joinPathsOpt "This function joins two paths when the first one might be NONE"
    2712   input Option<Path> inPath1;
    2713   input Path inPath2;
    2714   output Path outPath;
     2712  input Option<Absyn.Path> inPath1;
     2713  input Absyn.Path inPath2;
     2714  output Absyn.Path outPath;
    27152715algorithm
    27162716  outPath := match (inPath1,inPath2)
    2717     local Path p;
     2717    local Absyn.Path p;
    27182718    case (NONE(), _) then inPath2;
    27192719    case (SOME(p), _) then joinPaths(p, inPath2);
     
    27222722
    27232723public function joinPathsOptSuffix
    2724   input Path inPath1;
    2725   input Option<Path> inPath2;
    2726   output Path outPath;
     2724  input Absyn.Path inPath1;
     2725  input Option<Absyn.Path> inPath2;
     2726  output Absyn.Path outPath;
    27272727algorithm
    27282728  outPath := match(inPath1, inPath2)
    27292729    local
    2730       Path p;
     2730      Absyn.Path p;
    27312731
    27322732    case (_, SOME(p)) then joinPaths(inPath1, p);
     
    27382738public function selectPathsOpt "This function selects the second path when the first one
    27392739  is NONE() otherwise it will select the first one."
    2740   input Option<Path> inPath1;
    2741   input Path inPath2;
    2742   output Path outPath;
     2740  input Option<Absyn.Path> inPath1;
     2741  input Absyn.Path inPath2;
     2742  output Absyn.Path outPath;
    27432743algorithm
    27442744  outPath := match (inPath1,inPath2)
    27452745    local
    2746       Path p;
     2746      Absyn.Path p;
    27472747    case (NONE(), p) then p;
    27482748    case (SOME(p),_) then p;
     
    27522752public function pathAppendList "author Lucian
    27532753  This function joins a path list"
    2754   input list<Path> inPathLst;
    2755   output Path outPath;
     2754  input list<Absyn.Path> inPathLst;
     2755  output Absyn.Path outPath;
    27562756algorithm
    27572757  outPath := match (inPathLst)
    27582758    local
    2759       Path path,res_path,first;
    2760       list<Path> rest;
    2761     case ({}) then IDENT("");
     2759      Absyn.Path path,res_path,first;
     2760      list<Absyn.Path> rest;
     2761    case ({}) then Absyn.IDENT("");
    27622762    case ((path :: {})) then path;
    27632763    case ((first :: rest))
     
    27722772public function stripLast "Returns the path given as argument to
    27732773  the function minus the last ident."
    2774   input Path inPath;
    2775   output Path outPath;
     2774  input Absyn.Path inPath;
     2775  output Absyn.Path outPath;
    27762776algorithm
    27772777  outPath := match (inPath)
    27782778    local
    2779       Ident str;
    2780       Path p;
    2781 
    2782     case QUALIFIED(name = str, path = IDENT())
    2783       then IDENT(str);
    2784 
    2785     case QUALIFIED(name = str, path = p)
     2779      Absyn.Ident str;
     2780      Absyn.Path p;
     2781
     2782    case Absyn.QUALIFIED(name = str, path = Absyn.IDENT())
     2783      then Absyn.IDENT(str);
     2784
     2785    case Absyn.QUALIFIED(name = str, path = p)
    27862786      equation
    27872787        p = stripLast(p);
    27882788      then
    2789         QUALIFIED(str, p);
    2790 
    2791     case FULLYQUALIFIED(p)
     2789        Absyn.QUALIFIED(str, p);
     2790
     2791    case Absyn.FULLYQUALIFIED(p)
    27922792      equation
    27932793        p = stripLast(p);
    27942794      then
    2795         FULLYQUALIFIED(p);
     2795        Absyn.FULLYQUALIFIED(p);
    27962796
    27972797  end match;
     
    27992799
    28002800public function stripLastOpt
    2801   input Path inPath;
    2802   output Option<Path> outPath;
     2801  input Absyn.Path inPath;
     2802  output Option<Absyn.Path> outPath;
    28032803algorithm
    28042804  outPath := match(inPath)
    28052805    local
    2806       Path p;
    2807 
    2808     case IDENT() then NONE();
     2806      Absyn.Path p;
     2807
     2808    case Absyn.IDENT() then NONE();
    28092809
    28102810    else
     
    28192819public function crefStripLast "Returns the path given as argument to
    28202820  the function minus the last ident."
    2821   input ComponentRef inCref;
    2822   output ComponentRef outCref;
     2821  input Absyn.ComponentRef inCref;
     2822  output Absyn.ComponentRef outCref;
    28232823algorithm
    28242824  outCref := match (inCref)
    28252825    local
    2826       Ident str;
    2827       ComponentRef c_1, c;
    2828       list<Subscript> subs;
    2829 
    2830     case (CREF_IDENT()) then fail();
    2831     case (CREF_QUAL(name = str,subscripts = subs, componentRef = CREF_IDENT())) then CREF_IDENT(str,subs);
    2832     case (CREF_QUAL(name = str,subscripts = subs,componentRef = c))
     2826      Absyn.Ident str;
     2827      Absyn.ComponentRef c_1, c;
     2828      list<Absyn.Subscript> subs;
     2829
     2830    case (Absyn.CREF_IDENT()) then fail();
     2831    case (Absyn.CREF_QUAL(name = str,subscripts = subs, componentRef = Absyn.CREF_IDENT())) then Absyn.CREF_IDENT(str,subs);
     2832    case (Absyn.CREF_QUAL(name = str,subscripts = subs,componentRef = c))
    28332833      equation
    28342834        c_1 = crefStripLast(c);
    28352835      then
    2836         CREF_QUAL(str,subs,c_1);
    2837     case (CREF_FULLYQUALIFIED(componentRef = c))
     2836        Absyn.CREF_QUAL(str,subs,c_1);
     2837    case (Absyn.CREF_FULLYQUALIFIED(componentRef = c))
    28382838      equation
    28392839        c_1 = crefStripLast(c);
     
    28482848qualified part, and ident part (all_but_last, last);
    28492849"
    2850   input Path inPath;
    2851   output Path outPath1;
    2852   output Path outPath2;
     2850  input Absyn.Path inPath;
     2851  output Absyn.Path outPath1;
     2852  output Absyn.Path outPath2;
    28532853algorithm (outPath1,outPath2) := match(inPath)
    28542854  local
    2855     Path qPath,curPath,identPath;
     2855    Absyn.Path qPath,curPath,identPath;
    28562856    String s1,s2;
    28572857
    2858   case (QUALIFIED(name = s1, path = IDENT(name = s2)))
    2859     then (IDENT(s1), IDENT(s2));
    2860 
    2861   case (QUALIFIED(name = s1, path = qPath))
     2858  case (Absyn.QUALIFIED(name = s1, path = Absyn.IDENT(name = s2)))
     2859    then (Absyn.IDENT(s1), Absyn.IDENT(s2));
     2860
     2861  case (Absyn.QUALIFIED(name = s1, path = qPath))
    28622862    equation
    28632863      (curPath, identPath) = splitQualAndIdentPath(qPath);
    28642864    then
    2865       (QUALIFIED(s1, curPath), identPath);
    2866 
    2867   case (FULLYQUALIFIED(qPath))
     2865      (Absyn.QUALIFIED(s1, curPath), identPath);
     2866
     2867  case (Absyn.FULLYQUALIFIED(qPath))
    28682868    equation
    28692869      (curPath, identPath) = splitQualAndIdentPath(qPath);
     
    28752875public function stripFirst "Returns the path given as argument
    28762876  to the function minus the first ident."
    2877   input Path inPath;
    2878   output Path outPath;
     2877  input Absyn.Path inPath;
     2878  output Absyn.Path outPath;
    28792879algorithm
    28802880  outPath:=
    28812881  match (inPath)
    28822882    local
    2883       Path p;
    2884     case (QUALIFIED(path = p)) then p;
    2885     case(FULLYQUALIFIED(p)) then stripFirst(p);
     2883      Absyn.Path p;
     2884    case (Absyn.QUALIFIED(path = p)) then p;
     2885    case(Absyn.FULLYQUALIFIED(p)) then stripFirst(p);
    28862886  end match;
    28872887end stripFirst;
    28882888
    2889 public function crefToPath "This function converts a ComponentRef to a Path, if possible.
     2889public function crefToPath "This function converts a Absyn.ComponentRef to a Absyn.Path, if possible.
    28902890  If the component reference contains subscripts, it will silently fail."
    2891   input ComponentRef inComponentRef;
    2892   output Path outPath;
     2891  input Absyn.ComponentRef inComponentRef;
     2892  output Absyn.Path outPath;
    28932893algorithm
    28942894  outPath:=
    28952895  match (inComponentRef)
    28962896    local
    2897       Ident i;
    2898       Path p;
    2899       ComponentRef c;
    2900     case CREF_IDENT(name = i,subscripts = {}) then IDENT(i);
    2901     case CREF_QUAL(name = i,subscripts = {},componentRef = c)
     2897      Absyn.Ident i;
     2898      Absyn.Path p;
     2899      Absyn.ComponentRef c;
     2900    case Absyn.CREF_IDENT(name = i,subscripts = {}) then Absyn.IDENT(i);
     2901    case Absyn.CREF_QUAL(name = i,subscripts = {},componentRef = c)
    29022902      equation
    29032903        p = crefToPath(c);
    29042904      then
    2905         QUALIFIED(i,p);
    2906     case CREF_FULLYQUALIFIED(componentRef = c)
     2905        Absyn.QUALIFIED(i,p);
     2906    case Absyn.CREF_FULLYQUALIFIED(componentRef = c)
    29072907      equation
    29082908        p = crefToPath(c);
    29092909      then
    2910         FULLYQUALIFIED(p);
     2910        Absyn.FULLYQUALIFIED(p);
    29112911  end match;
    29122912end crefToPath;
    29132913
    2914 public function elementSpecToPath "This function converts a ElementSpec to a Path, if possible.
    2915   If the ElementSpec is not EXTENDS, it will silently fail."
    2916   input ElementSpec inElementSpec;
    2917   output Path outPath;
     2914public function elementSpecToPath "This function converts a Absyn.ElementSpec to a Absyn.Path, if possible.
     2915  If the Absyn.ElementSpec is not EXTENDS, it will silently fail."
     2916  input Absyn.ElementSpec inElementSpec;
     2917  output Absyn.Path outPath;
    29182918algorithm
    29192919  outPath:= match (inElementSpec)
    29202920    local
    2921       Path p;
    2922     case EXTENDS(path = p) then p;
     2921      Absyn.Path p;
     2922    case Absyn.EXTENDS(path = p) then p;
    29232923  end match;
    29242924end elementSpecToPath;
    29252925
    29262926public function crefToPathIgnoreSubs
    2927   "Converts a ComponentRef to a Path, ignoring any subscripts."
    2928   input ComponentRef inComponentRef;
    2929   output Path outPath;
     2927  "Converts a Absyn.ComponentRef to a Absyn.Path, ignoring any subscripts."
     2928  input Absyn.ComponentRef inComponentRef;
     2929  output Absyn.Path outPath;
    29302930algorithm
    29312931  outPath := match(inComponentRef)
    29322932    local
    2933       Ident i;
    2934       Path p;
    2935       ComponentRef c;
    2936 
    2937     case CREF_IDENT(name = i) then IDENT(i);
    2938 
    2939     case CREF_QUAL(name = i, componentRef = c)
     2933      Absyn.Ident i;
     2934      Absyn.Path p;
     2935      Absyn.ComponentRef c;
     2936
     2937    case Absyn.CREF_IDENT(name = i) then Absyn.IDENT(i);
     2938
     2939    case Absyn.CREF_QUAL(name = i, componentRef = c)
    29402940      equation
    29412941        p = crefToPathIgnoreSubs(c);
    29422942      then
    2943         QUALIFIED(i, p);
    2944 
    2945     case CREF_FULLYQUALIFIED(componentRef = c)
     2943        Absyn.QUALIFIED(i, p);
     2944
     2945    case Absyn.CREF_FULLYQUALIFIED(componentRef = c)
    29462946      equation
    29472947        p = crefToPathIgnoreSubs(c);
    29482948      then
    2949         FULLYQUALIFIED(p);
     2949        Absyn.FULLYQUALIFIED(p);
    29502950  end match;
    29512951end crefToPathIgnoreSubs;
    29522952
    2953 public function pathToCref "This function converts a Path to a ComponentRef."
    2954   input Path inPath;
    2955   output ComponentRef outComponentRef;
     2953public function pathToCref "This function converts a Absyn.Path to a Absyn.ComponentRef."
     2954  input Absyn.Path inPath;
     2955  output Absyn.ComponentRef outComponentRef;
    29562956algorithm
    29572957  outComponentRef:=
    29582958  match (inPath)
    29592959    local
    2960       Ident i;
    2961       ComponentRef c;
    2962       Path p;
    2963     case IDENT(name = i) then CREF_IDENT(i,{});
    2964     case QUALIFIED(name = i,path = p)
     2960      Absyn.Ident i;
     2961      Absyn.ComponentRef c;
     2962      Absyn.Path p;
     2963    case Absyn.IDENT(name = i) then Absyn.CREF_IDENT(i,{});
     2964    case Absyn.QUALIFIED(name = i,path = p)
    29652965      equation
    29662966        c = pathToCref(p);
    29672967      then
    2968         CREF_QUAL(i,{},c);
    2969     case(FULLYQUALIFIED(p))
     2968        Absyn.CREF_QUAL(i,{},c);
     2969    case(Absyn.FULLYQUALIFIED(p))
    29702970      equation
    29712971        c = pathToCref(p);
     
    29752975
    29762976public function pathToCrefWithSubs
    2977   "This function converts a Path to a ComponentRef, and applies the given
     2977  "This function converts a Absyn.Path to a Absyn.ComponentRef, and applies the given
    29782978  subscripts to the last identifier."
    2979   input Path inPath;
    2980   input list<Subscript> inSubs;
    2981   output ComponentRef outComponentRef;
     2979  input Absyn.Path inPath;
     2980  input list<Absyn.Subscript> inSubs;
     2981  output Absyn.ComponentRef outComponentRef;
    29822982algorithm
    29832983  outComponentRef := match(inPath, inSubs)
    29842984    local
    2985       Ident i;
    2986       ComponentRef c;
    2987       Path p;
    2988 
    2989     case (IDENT(name = i), _) then CREF_IDENT(i, inSubs);
    2990 
    2991     case (QUALIFIED(name = i, path = p), _)
     2985      Absyn.Ident i;
     2986      Absyn.ComponentRef c;
     2987      Absyn.Path p;
     2988
     2989    case (Absyn.IDENT(name = i), _) then Absyn.CREF_IDENT(i, inSubs);
     2990
     2991    case (Absyn.QUALIFIED(name = i, path = p), _)
    29922992      equation
    29932993        c = pathToCrefWithSubs(p, inSubs);
    29942994      then
    2995         CREF_QUAL(i, {}, c);
    2996 
    2997     case (FULLYQUALIFIED(p), _)
     2995        Absyn.CREF_QUAL(i, {}, c);
     2996
     2997    case (Absyn.FULLYQUALIFIED(p), _)
    29982998      equation
    29992999        c = pathToCrefWithSubs(p, inSubs);
     
    30053005public function crefLastIdent
    30063006  "Returns the last identifier in a component reference."
    3007   input ComponentRef inComponentRef;
    3008   output Ident outIdent;
     3007  input Absyn.ComponentRef inComponentRef;
     3008  output Absyn.Ident outIdent;
    30093009algorithm
    30103010  outIdent := match(inComponentRef)
    30113011    local
    3012       ComponentRef cref;
    3013       Ident id;
    3014 
    3015     case CREF_IDENT(name = id) then id;
    3016     case CREF_QUAL(componentRef = cref) then crefLastIdent(cref);
    3017     case CREF_FULLYQUALIFIED(componentRef = cref) then crefLastIdent(cref);
     3012      Absyn.ComponentRef cref;
     3013      Absyn.Ident id;
     3014
     3015    case Absyn.CREF_IDENT(name = id) then id;
     3016    case Absyn.CREF_QUAL(componentRef = cref) then crefLastIdent(cref);
     3017    case Absyn.CREF_FULLYQUALIFIED(componentRef = cref) then crefLastIdent(cref);
    30183018  end match;
    30193019end crefLastIdent;
     
    30223022  "Returns the basename of the component reference, but fails if it encounters
    30233023  any subscripts."
    3024   input ComponentRef inCref;
    3025   output Ident outIdent;
     3024  input Absyn.ComponentRef inCref;
     3025  output Absyn.Ident outIdent;
    30263026algorithm
    30273027  outIdent := match(inCref)
    30283028    local
    3029       Ident id;
    3030       ComponentRef cr;
    3031     case CREF_IDENT(name = id, subscripts = {}) then id;
    3032     case CREF_QUAL(name = id, subscripts = {}) then id;
    3033     case CREF_FULLYQUALIFIED(componentRef = cr) then crefFirstIdentNoSubs(cr);
     3029      Absyn.Ident id;
     3030      Absyn.ComponentRef cr;
     3031    case Absyn.CREF_IDENT(name = id, subscripts = {}) then id;
     3032    case Absyn.CREF_QUAL(name = id, subscripts = {}) then id;
     3033    case Absyn.CREF_FULLYQUALIFIED(componentRef = cr) then crefFirstIdentNoSubs(cr);
    30343034  end match;
    30353035end crefFirstIdentNoSubs;
     
    30373037public function crefIsIdent
    30383038  "Returns true if the component reference is a simple identifier, otherwise false."
    3039   input ComponentRef inComponentRef;
     3039  input Absyn.ComponentRef inComponentRef;
    30403040  output Boolean outIsIdent;
    30413041algorithm
    30423042  outIsIdent := match(inComponentRef)
    3043     case CREF_IDENT() then true;
     3043    case Absyn.CREF_IDENT() then true;
    30443044    else false;
    30453045  end match;
     
    30483048public function crefIsQual
    30493049  "Returns true if the component reference is a qualified identifier, otherwise false."
    3050   input ComponentRef inComponentRef;
     3050  input Absyn.ComponentRef inComponentRef;
    30513051  output Boolean outIsQual;
    30523052algorithm
    30533053  outIsQual := match(inComponentRef)
    3054     case CREF_QUAL() then true;
    3055     case CREF_FULLYQUALIFIED() then true;
     3054    case Absyn.CREF_QUAL() then true;
     3055    case Absyn.CREF_FULLYQUALIFIED() then true;
    30563056    else false;
    30573057  end match;
    30583058end crefIsQual;
    30593059
    3060 public function crefLastSubs "Return the last subscripts of an ComponentRef"
    3061   input ComponentRef inComponentRef;
    3062   output list<Subscript> outSubscriptLst;
     3060public function crefLastSubs "Return the last subscripts of an Absyn.ComponentRef"
     3061  input Absyn.ComponentRef inComponentRef;
     3062  output list<Absyn.Subscript> outSubscriptLst;
    30633063algorithm
    30643064  outSubscriptLst:=
    30653065  match (inComponentRef)
    30663066    local
    3067       Ident id;
    3068       list<Subscript> subs,res;
    3069       ComponentRef cr;
    3070     case (CREF_IDENT(subscripts= subs)) then subs;
    3071     case (CREF_QUAL(componentRef = cr))
     3067      Absyn.Ident id;
     3068      list<Absyn.Subscript> subs,res;
     3069      Absyn.ComponentRef cr;
     3070    case (Absyn.CREF_IDENT(subscripts= subs)) then subs;
     3071    case (Absyn.CREF_QUAL(componentRef = cr))
    30723072      equation
    30733073        res = crefLastSubs(cr);
    30743074      then
    30753075        res;
    3076     case (CREF_FULLYQUALIFIED(componentRef = cr))
     3076    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr))
    30773077      equation
    30783078        res = crefLastSubs(cr);
     
    30833083
    30843084public function crefSetLastSubs
    3085   input ComponentRef inCref;
    3086   input list<Subscript> inSubscripts;
    3087   output ComponentRef outCref = inCref;
     3085  input Absyn.ComponentRef inCref;
     3086  input list<Absyn.Subscript> inSubscripts;
     3087  output Absyn.ComponentRef outCref = inCref;
    30883088algorithm
    30893089  outCref := match outCref
    3090     case CREF_IDENT()
     3090    case Absyn.CREF_IDENT()
    30913091      algorithm
    30923092        outCref.subscripts := inSubscripts;
     
    30943094        outCref;
    30953095
    3096     case CREF_QUAL()
     3096    case Absyn.CREF_QUAL()
    30973097      algorithm
    30983098        outCref.componentRef := crefSetLastSubs(outCref.componentRef, inSubscripts);
     
    31003100        outCref;
    31013101
    3102     case CREF_FULLYQUALIFIED()
     3102    case Absyn.CREF_FULLYQUALIFIED()
    31033103      algorithm
    31043104        outCref.componentRef := crefSetLastSubs(outCref.componentRef, inSubscripts);
     
    31103110
    31113111public function crefHasSubscripts "This function finds if a cref has subscripts"
    3112   input ComponentRef cref;
     3112  input Absyn.ComponentRef cref;
    31133113  output Boolean hasSubscripts;
    31143114algorithm
    31153115  hasSubscripts := match cref
    3116     case CREF_IDENT() then not listEmpty(cref.subscripts);
    3117     case CREF_QUAL(subscripts = {}) then crefHasSubscripts(cref.componentRef);
    3118     case CREF_FULLYQUALIFIED() then crefHasSubscripts(cref.componentRef);
    3119     case WILD() then false;
    3120     case ALLWILD() then false;
     3116    case Absyn.CREF_IDENT() then not listEmpty(cref.subscripts);
     3117    case Absyn.CREF_QUAL(subscripts = {}) then crefHasSubscripts(cref.componentRef);
     3118    case Absyn.CREF_FULLYQUALIFIED() then crefHasSubscripts(cref.componentRef);
     3119    case Absyn.WILD() then false;
     3120    case Absyn.ALLWILD() then false;
    31213121    else true;
    31223122  end match;
     
    31263126Author: BZ, 2009-09
    31273127 Extract subscripts of crefs."
    3128   input ComponentRef cr;
     3128  input Absyn.ComponentRef cr;
    31293129  input Boolean includeSubs "include crefs from array subscripts";
    31303130  input Boolean includeFunctions "note that if you say includeSubs = false then you won't get the functions from array subscripts";
    3131   output list<Subscript> subscripts;
     3131  output list<Absyn.Subscript> subscripts;
    31323132algorithm
    31333133  subscripts := match(cr,includeSubs,includeFunctions)
    31343134    local
    3135       list<Subscript> subs2;
    3136       ComponentRef child;
    3137 
    3138     case(CREF_IDENT(_,subs2), _, _) then subs2;
    3139 
    3140     case(CREF_QUAL(_,subs2,child), _, _)
     3135      list<Absyn.Subscript> subs2;
     3136      Absyn.ComponentRef child;
     3137
     3138    case(Absyn.CREF_IDENT(_,subs2), _, _) then subs2;
     3139
     3140    case(Absyn.CREF_QUAL(_,subs2,child), _, _)
    31413141      equation
    31423142        subscripts = getSubsFromCref(child, includeSubs, includeFunctions);
     
    31453145        subscripts;
    31463146
    3147     case(CREF_FULLYQUALIFIED(child), _, _)
     3147    case(Absyn.CREF_FULLYQUALIFIED(child), _, _)
    31483148      equation
    31493149        subscripts = getSubsFromCref(child, includeSubs, includeFunctions);
     
    31553155// stefan
    31563156public function crefGetLastIdent
    3157 "Gets the last ident in a ComponentRef"
    3158   input ComponentRef inComponentRef;
    3159   output ComponentRef outComponentRef;
     3157"Gets the last ident in a Absyn.ComponentRef"
     3158  input Absyn.ComponentRef inComponentRef;
     3159  output Absyn.ComponentRef outComponentRef;
    31603160algorithm
    31613161  outComponentRef := match (inComponentRef)
    31623162    local
    3163       ComponentRef cref,cref_1;
    3164       Ident id;
    3165       list<Subscript> subs;
    3166     case(CREF_IDENT(id,subs)) then CREF_IDENT(id,subs);
    3167     case(CREF_QUAL(_,_,cref))
     3163      Absyn.ComponentRef cref,cref_1;
     3164      Absyn.Ident id;
     3165      list<Absyn.Subscript> subs;
     3166    case(Absyn.CREF_IDENT(id,subs)) then Absyn.CREF_IDENT(id,subs);
     3167    case(Absyn.CREF_QUAL(_,_,cref))
    31683168      equation
    31693169        cref_1 = crefGetLastIdent(cref);
    31703170      then
    31713171        cref_1;
    3172     case(CREF_FULLYQUALIFIED(cref))
     3172    case(Absyn.CREF_FULLYQUALIFIED(cref))
    31733173      equation
    31743174        cref_1 = crefGetLastIdent(cref);
     
    31783178end crefGetLastIdent;
    31793179
    3180 public function crefStripLastSubs "Strips the last subscripts of a ComponentRef"
    3181   input ComponentRef inComponentRef;
    3182   output ComponentRef outComponentRef;
     3180public function crefStripLastSubs "Strips the last subscripts of a Absyn.ComponentRef"
     3181  input Absyn.ComponentRef inComponentRef;
     3182  output Absyn.ComponentRef outComponentRef;
    31833183algorithm
    31843184  outComponentRef:=
    31853185  match (inComponentRef)
    31863186    local
    3187       Ident id;
    3188       list<Subscript> subs,s;
    3189       ComponentRef cr_1,cr;
    3190     case (CREF_IDENT(name = id)) then CREF_IDENT(id,{});
    3191     case (CREF_QUAL(name= id,subscripts= s,componentRef = cr))
     3187      Absyn.Ident id;
     3188      list<Absyn.Subscript> subs,s;
     3189      Absyn.ComponentRef cr_1,cr;
     3190    case (Absyn.CREF_IDENT(name = id)) then Absyn.CREF_IDENT(id,{});
     3191    case (Absyn.CREF_QUAL(name= id,subscripts= s,componentRef = cr))
    31923192      equation
    31933193        cr_1 = crefStripLastSubs(cr);
    31943194      then
    3195         CREF_QUAL(id,s,cr_1);
    3196     case (CREF_FULLYQUALIFIED(componentRef = cr))
     3195        Absyn.CREF_QUAL(id,s,cr_1);
     3196    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr))
    31973197      equation
    31983198        cr_1 = crefStripLastSubs(cr);
     
    32033203
    32043204public function joinCrefs "This function joins two ComponentRefs."
    3205   input ComponentRef inComponentRef1;
    3206   input ComponentRef inComponentRef2;
    3207   output ComponentRef outComponentRef;
     3205  input Absyn.ComponentRef inComponentRef1;
     3206  input Absyn.ComponentRef inComponentRef2;
     3207  output Absyn.ComponentRef outComponentRef;
    32083208algorithm
    32093209  outComponentRef:=
    32103210  match (inComponentRef1,inComponentRef2)
    32113211    local
    3212       Ident id;
    3213       list<Subscript> sub;
    3214       ComponentRef cr2,cr_1,cr;
    3215     case (CREF_IDENT(name = id,subscripts = sub),cr2)
    3216       equation
    3217         failure(CREF_FULLYQUALIFIED() = cr2);
    3218       then CREF_QUAL(id,sub,cr2);
    3219     case (CREF_QUAL(name = id,subscripts = sub,componentRef = cr),cr2)
     3212      Absyn.Ident id;
     3213      list<Absyn.Subscript> sub;
     3214      Absyn.ComponentRef cr2,cr_1,cr;
     3215    case (Absyn.CREF_IDENT(name = id,subscripts = sub),cr2)
     3216      equation
     3217        failure(Absyn.CREF_FULLYQUALIFIED() = cr2);
     3218      then Absyn.CREF_QUAL(id,sub,cr2);
     3219    case (Absyn.CREF_QUAL(name = id,subscripts = sub,componentRef = cr),cr2)
    32203220      equation
    32213221        cr_1 = joinCrefs(cr, cr2);
    32223222      then
    3223         CREF_QUAL(id,sub,cr_1);
    3224     case (CREF_FULLYQUALIFIED(componentRef = cr),cr2)
     3223        Absyn.CREF_QUAL(id,sub,cr_1);
     3224    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr),cr2)
    32253225      equation
    32263226        cr_1 = joinCrefs(cr, cr2);
     
    32303230end joinCrefs;
    32313231
    3232 public function crefFirstIdent "Returns first ident from a ComponentRef"
    3233   input ComponentRef inCref;
    3234   output Ident outIdent;
     3232public function crefFirstIdent "Returns first ident from a Absyn.ComponentRef"
     3233  input Absyn.ComponentRef inCref;
     3234  output Absyn.Ident outIdent;
    32353235algorithm
    32363236  outIdent := match inCref
    3237     case CREF_IDENT() then inCref.name;
    3238     case CREF_QUAL() then inCref.name;
    3239     case CREF_FULLYQUALIFIED() then crefFirstIdent(inCref.componentRef);
     3237    case Absyn.CREF_IDENT() then inCref.name;
     3238    case Absyn.CREF_QUAL() then inCref.name;
     3239    case Absyn.CREF_FULLYQUALIFIED() then crefFirstIdent(inCref.componentRef);
    32403240  end match;
    32413241end crefFirstIdent;
    32423242
    32433243public function crefSecondIdent
    3244   input ComponentRef cref;
    3245   output Ident ident;
     3244  input Absyn.ComponentRef cref;
     3245  output Absyn.Ident ident;
    32463246algorithm
    32473247  ident := match cref
    3248     case CREF_QUAL() then crefFirstIdent(cref.componentRef);
    3249     case CREF_FULLYQUALIFIED() then crefSecondIdent(cref.componentRef);
     3248    case Absyn.CREF_QUAL() then crefFirstIdent(cref.componentRef);
     3249    case Absyn.CREF_FULLYQUALIFIED() then crefSecondIdent(cref.componentRef);
    32503250  end match;
    32513251end crefSecondIdent;
     
    32533253public function crefFirstCref
    32543254  "Returns the first part of a cref."
    3255   input ComponentRef inCref;
    3256   output ComponentRef outCref;
     3255  input Absyn.ComponentRef inCref;
     3256  output Absyn.ComponentRef outCref;
    32573257algorithm
    32583258  outCref := match inCref
    3259     case CREF_QUAL() then CREF_IDENT(inCref.name, inCref.subscripts);
    3260     case CREF_FULLYQUALIFIED() then crefFirstCref(inCref.componentRef);
     3259    case Absyn.CREF_QUAL() then Absyn.CREF_IDENT(inCref.name, inCref.subscripts);
     3260    case Absyn.CREF_FULLYQUALIFIED() then crefFirstCref(inCref.componentRef);
    32613261    else inCref;
    32623262  end match;
    32633263end crefFirstCref;
    32643264
    3265 public function crefStripFirst "Strip the first ident from a ComponentRef"
    3266   input ComponentRef inComponentRef;
    3267   output ComponentRef outComponentRef;
     3265public function crefStripFirst "Strip the first ident from a Absyn.ComponentRef"
     3266  input Absyn.ComponentRef inComponentRef;
     3267  output Absyn.ComponentRef outComponentRef;
    32683268algorithm
    32693269  outComponentRef:=
    32703270  match (inComponentRef)
    3271     local ComponentRef cr;
    3272     case CREF_QUAL(componentRef = cr) then cr;
    3273     case CREF_FULLYQUALIFIED(componentRef = cr) then crefStripFirst(cr);
     3271    local Absyn.ComponentRef cr;
     3272    case Absyn.CREF_QUAL(componentRef = cr) then cr;
     3273    case Absyn.CREF_FULLYQUALIFIED(componentRef = cr) then crefStripFirst(cr);
    32743274  end match;
    32753275end crefStripFirst;
    32763276
    32773277public function crefIsFullyQualified
    3278   input ComponentRef inCref;
     3278  input Absyn.ComponentRef inCref;
    32793279  output Boolean outIsFullyQualified;
    32803280algorithm
    32813281  outIsFullyQualified := match inCref
    3282     case CREF_FULLYQUALIFIED() then true;
     3282    case Absyn.CREF_FULLYQUALIFIED() then true;
    32833283    else false;
    32843284  end match;
     
    32873287public function crefMakeFullyQualified
    32883288  "Makes a component reference fully qualified unless it already is."
    3289   input ComponentRef inComponentRef;
    3290   output ComponentRef outComponentRef;
     3289  input Absyn.ComponentRef inComponentRef;
     3290  output Absyn.ComponentRef outComponentRef;
    32913291algorithm
    32923292  outComponentRef := match(inComponentRef)
    3293     case CREF_FULLYQUALIFIED() then inComponentRef;
    3294     else CREF_FULLYQUALIFIED(inComponentRef);
     3293    case Absyn.CREF_FULLYQUALIFIED() then inComponentRef;
     3294    else Absyn.CREF_FULLYQUALIFIED(inComponentRef);
    32953295  end match;
    32963296end crefMakeFullyQualified;
    32973297
    32983298public function restrString "Maps a class restriction to the corresponding string for printing"
    3299   input Restriction inRestriction;
     3299  input Absyn.Restriction inRestriction;
    33003300  output String outString;
    33013301algorithm
    33023302  outString:=
    33033303  match (inRestriction)
    3304     case R_CLASS() then "CLASS";
    3305     case R_OPTIMIZATION() then "OPTIMIZATION";
    3306     case R_MODEL() then "MODEL";
    3307     case R_RECORD() then "RECORD";
    3308     case R_BLOCK() then "BLOCK";
    3309     case R_CONNECTOR() then "CONNECTOR";
    3310     case R_EXP_CONNECTOR() then "EXPANDABLE CONNECTOR";
    3311     case R_TYPE() then "TYPE";
    3312     case R_PACKAGE() then "PACKAGE";
    3313     case R_FUNCTION(FR_NORMAL_FUNCTION(PURE())) then "PURE FUNCTION";
    3314     case R_FUNCTION(FR_NORMAL_FUNCTION(IMPURE())) then "IMPURE FUNCTION";
    3315     case R_FUNCTION(FR_NORMAL_FUNCTION(NO_PURITY())) then "FUNCTION";
    3316     case R_FUNCTION(FR_OPERATOR_FUNCTION()) then "OPERATOR FUNCTION";
    3317     case R_PREDEFINED_INTEGER() then "PREDEFINED_INT";
    3318     case R_PREDEFINED_REAL() then "PREDEFINED_REAL";
    3319     case R_PREDEFINED_STRING() then "PREDEFINED_STRING";
    3320     case R_PREDEFINED_BOOLEAN() then "PREDEFINED_BOOL";
     3304    case Absyn.R_CLASS() then "CLASS";
     3305    case Absyn.R_OPTIMIZATION() then "OPTIMIZATION";
     3306    case Absyn.R_MODEL() then "MODEL";
     3307    case Absyn.R_RECORD() then "RECORD";
     3308    case Absyn.R_BLOCK() then "BLOCK";
     3309    case Absyn.R_CONNECTOR() then "CONNECTOR";
     3310    case Absyn.R_EXP_CONNECTOR() then "EXPANDABLE CONNECTOR";
     3311    case Absyn.R_TYPE() then "TYPE";
     3312    case Absyn.R_PACKAGE() then "PACKAGE";
     3313    case Absyn.R_FUNCTION(Absyn.FR_NORMAL_FUNCTION(Absyn.PURE())) then "PURE FUNCTION";
     3314    case Absyn.R_FUNCTION(Absyn.FR_NORMAL_FUNCTION(Absyn.IMPURE())) then "IMPURE FUNCTION";
     3315    case Absyn.R_FUNCTION(Absyn.FR_NORMAL_FUNCTION(Absyn.NO_PURITY())) then "FUNCTION";
     3316    case Absyn.R_FUNCTION(Absyn.FR_OPERATOR_FUNCTION()) then "OPERATOR FUNCTION";
     3317    case Absyn.R_PREDEFINED_INTEGER() then "PREDEFINED_INT";
     3318    case Absyn.R_PREDEFINED_REAL() then "PREDEFINED_REAL";
     3319    case Absyn.R_PREDEFINED_STRING() then "PREDEFINED_STRING";
     3320    case Absyn.R_PREDEFINED_BOOLEAN() then "PREDEFINED_BOOL";
    33213321    // BTH
    3322     case R_PREDEFINED_CLOCK() then "PREDEFINED_CLOCK";
     3322    case Absyn.R_PREDEFINED_CLOCK() then "PREDEFINED_CLOCK";
    33233323
    33243324    /* MetaModelica restriction */
    3325     case R_UNIONTYPE() then "UNIONTYPE";
     3325    case Absyn.R_UNIONTYPE() then "UNIONTYPE";
    33263326    else "* Unknown restriction *";
    33273327  end match;
     
    33293329
    33303330public function lastClassname "Returns the path (=name) of the last class in a program"
    3331   input Program inProgram;
    3332   output Path outPath;
     3331  input Absyn.Program inProgram;
     3332  output Absyn.Path outPath;
    33333333protected
    3334   list<Class> lst;
    3335   Ident id;
    3336 algorithm
    3337   PROGRAM(classes = lst) := inProgram;
    3338   CLASS(name = id) := List.last(lst);
    3339   outPath := IDENT(id);
     3334  list<Absyn.Class> lst;
     3335  Absyn.Ident id;
     3336algorithm
     3337  Absyn.PROGRAM(classes = lst) := inProgram;
     3338  Absyn.CLASS(name = id) := List.last(lst);
     3339  outPath := Absyn.IDENT(id);
    33403340end lastClassname;
    33413341
    33423342public function classFilename
    33433343  "Retrieves the filename where the class is stored."
    3344   input Class inClass;
     3344  input Absyn.Class inClass;
    33453345  output String outFilename;
    33463346algorithm
    3347   CLASS(info = SOURCEINFO(fileName = outFilename)) := inClass;
     3347  Absyn.CLASS(info = SOURCEINFO(fileName = outFilename)) := inClass;
    33483348end classFilename;
    33493349
    33503350public function setClassFilename "Sets the filename where the class is stored."
    3351   input Class inClass;
     3351  input Absyn.Class inClass;
    33523352  input String fileName;
    3353   output Class outClass;
     3353  output Absyn.Class outClass;
    33543354algorithm
    33553355  outClass := match inClass
    33563356    local
    33573357      SourceInfo info;
    3358       Class cl;
    3359     case cl as CLASS(info=info as SOURCEINFO())
     3358      Absyn.Class cl;
     3359    case cl as Absyn.CLASS(info=info as SOURCEINFO())
    33603360      equation
    33613361        info.fileName = fileName;
     
    33673367public function setClassName "author: BZ
    33683368  Sets the name of the class"
    3369   input Class inClass;
     3369  input Absyn.Class inClass;
    33703370  input String newName;
    3371   output Class outClass = inClass;
     3371  output Absyn.Class outClass = inClass;
    33723372algorithm
    33733373  outClass := match outClass
    3374     case CLASS()
     3374    case Absyn.CLASS()
    33753375      algorithm
    33763376        outClass.name := newName;
     
    33813381
    33823382public function setClassBody
    3383   input Class inClass;
    3384   input ClassDef inBody;
    3385   output Class outClass = inClass;
     3383  input Absyn.Class inClass;
     3384  input Absyn.ClassDef inBody;
     3385  output Absyn.Class outClass = inClass;
    33863386algorithm
    33873387  outClass := match outClass
    3388     case CLASS()
     3388    case Absyn.CLASS()
    33893389      algorithm
    33903390        outClass.body := inBody;
     
    33943394end setClassBody;
    33953395
    3396 public function crefEqual " Checks if the name of a ComponentRef is
    3397  equal to the name of another ComponentRef, including subscripts.
     3396public function crefEqual " Checks if the name of a Absyn.ComponentRef is
     3397 equal to the name of another Absyn.ComponentRef, including subscripts.
    33983398 See also crefEqualNoSubs."
    3399   input ComponentRef iCr1;
    3400   input ComponentRef iCr2;
     3399  input Absyn.ComponentRef iCr1;
     3400  input Absyn.ComponentRef iCr2;
    34013401  output Boolean outBoolean;
    34023402algorithm
    34033403  outBoolean := matchcontinue (iCr1,iCr2)
    34043404    local
    3405       Ident id,id2;
    3406       list<Subscript> ss1,ss2;
    3407       ComponentRef cr1,cr2;
    3408 
    3409     case (CREF_IDENT(name = id,subscripts=ss1),CREF_IDENT(name = id2,subscripts = ss2))
     3405      Absyn.Ident id,id2;
     3406      list<Absyn.Subscript> ss1,ss2;
     3407      Absyn.ComponentRef cr1,cr2;
     3408
     3409    case (Absyn.CREF_IDENT(name = id,subscripts=ss1),Absyn.CREF_IDENT(name = id2,subscripts = ss2))
    34103410      equation
    34113411        true = stringEq(id, id2);
     
    34143414        true;
    34153415
    3416     case (CREF_QUAL(name = id,subscripts = ss1, componentRef = cr1),CREF_QUAL(name = id2,subscripts = ss2, componentRef = cr2))
     3416    case (Absyn.CREF_QUAL(name = id,subscripts = ss1, componentRef = cr1),Absyn.CREF_QUAL(name = id2,subscripts = ss2, componentRef = cr2))
    34173417      equation
    34183418        true = stringEq(id, id2);
     
    34223422        true;
    34233423
    3424     case (CREF_FULLYQUALIFIED(componentRef = cr1),CREF_FULLYQUALIFIED(componentRef = cr2))
     3424    case (Absyn.CREF_FULLYQUALIFIED(componentRef = cr1),Absyn.CREF_FULLYQUALIFIED(componentRef = cr2))
    34253425      then
    34263426        crefEqual(cr1, cr2);
     
    34343434   a.b, a -> true
    34353435   b.c, a -> false"
    3436   input ComponentRef iCr1;
    3437   input ComponentRef iCr2;
     3436  input Absyn.ComponentRef iCr1;
     3437  input Absyn.ComponentRef iCr2;
    34383438  output Boolean outBoolean;
    34393439algorithm
     
    34423442
    34433443public function subscriptEqual
    3444   input Subscript inSubscript1;
    3445   input Subscript inSubscript2;
     3444  input Absyn.Subscript inSubscript1;
     3445  input Absyn.Subscript inSubscript2;
    34463446  output Boolean outIsEqual;
    34473447algorithm
    34483448  outIsEqual := match(inSubscript1, inSubscript2)
    34493449    local
    3450       Exp e1, e2;
    3451 
    3452     case (NOSUB(), NOSUB()) then true;
    3453     case (SUBSCRIPT(e1), SUBSCRIPT(e2)) then expEqual(e1, e2);
     3450      Absyn.Exp e1, e2;
     3451
     3452    case (Absyn.NOSUB(), Absyn.NOSUB()) then true;
     3453    case (Absyn.SUBSCRIPT(e1), Absyn.SUBSCRIPT(e2)) then expEqual(e1, e2);
    34543454    else false;
    34553455  end match;
     
    34583458public function subscriptsEqual
    34593459  "Checks if two subscript lists are equal."
    3460   input list<Subscript> inSubList1;
    3461   input list<Subscript> inSubList2;
     3460  input list<Absyn.Subscript> inSubList1;
     3461  input list<Absyn.Subscript> inSubList2;
    34623462  output Boolean outIsEqual;
    34633463algorithm
     
    34663466
    34673467public function crefEqualNoSubs
    3468   "Checks if the name of a ComponentRef is equal to the name
    3469    of another ComponentRef without checking subscripts.
     3468  "Checks if the name of a Absyn.ComponentRef is equal to the name
     3469   of another Absyn.ComponentRef without checking subscripts.
    34703470   See also crefEqual."
    3471   input ComponentRef cr1;
    3472   input ComponentRef cr2;
     3471  input Absyn.ComponentRef cr1;
     3472  input Absyn.ComponentRef cr2;
    34733473  output Boolean outBoolean;
    34743474algorithm
    34753475  outBoolean := matchcontinue (cr1,cr2)
    34763476    local
    3477       ComponentRef rest1,rest2;
    3478       Ident id,id2;
    3479     case (CREF_IDENT(name = id),CREF_IDENT(name = id2))
     3477      Absyn.ComponentRef rest1,rest2;
     3478      Absyn.Ident id,id2;
     3479    case (Absyn.CREF_IDENT(name = id),Absyn.CREF_IDENT(name = id2))
    34803480      equation
    34813481        true = stringEq(id, id2);
    34823482      then
    34833483        true;
    3484     case (CREF_QUAL(name = id,componentRef = rest1),CREF_QUAL(name = id2,componentRef = rest2))
     3484    case (Absyn.CREF_QUAL(name = id,componentRef = rest1),Absyn.CREF_QUAL(name = id2,componentRef = rest2))
    34853485      equation
    34863486        true = stringEq(id, id2);
     
    34883488      then
    34893489        true;
    3490     case (CREF_FULLYQUALIFIED(componentRef = rest1),CREF_FULLYQUALIFIED(componentRef = rest2))
     3490    case (Absyn.CREF_FULLYQUALIFIED(componentRef = rest1),Absyn.CREF_FULLYQUALIFIED(componentRef = rest2))
    34913491      then crefEqualNoSubs(rest1, rest2);
    34923492    else false;
     
    34953495
    34963496public function isPackageRestriction "checks if the provided parameter is a package or not"
    3497   input Restriction inRestriction;
     3497  input Absyn.Restriction inRestriction;
    34983498  output Boolean outIsPackage;
    34993499algorithm
    35003500  outIsPackage := match(inRestriction)
    3501     case R_PACKAGE() then true;
     3501    case Absyn.R_PACKAGE() then true;
    35023502    else false;
    35033503  end match;
     
    35053505
    35063506public function isFunctionRestriction "checks if restriction is a function or not"
    3507   input Restriction inRestriction;
     3507  input Absyn.Restriction inRestriction;
    35083508  output Boolean outIsFunction;
    35093509algorithm
    35103510  outIsFunction := match(inRestriction)
    3511     case R_FUNCTION() then true;
     3511    case Absyn.R_FUNCTION() then true;
    35123512    else false;
    35133513  end match;
     
    35153515
    35163516public function expEqual "Returns true if two expressions are equal"
    3517   input Exp exp1;
    3518   input Exp exp2;
     3517  input Absyn.Exp exp1;
     3518  input Absyn.Exp exp2;
    35193519  output Boolean equal;
    35203520algorithm
     
    35223522    local
    35233523      Boolean b;
    3524       Exp x, y;
     3524      Absyn.Exp x, y;
    35253525      Integer i;
    35263526      String r;
    35273527
    35283528    // real vs. integer
    3529     case (INTEGER(i), REAL(r))
     3529    case (Absyn.INTEGER(i), Absyn.REAL(r))
    35303530      equation
    35313531        b = realEq(intReal(i), System.stringReal(r));
    35323532      then b;
    35333533
    3534     case (REAL(r), INTEGER(i))
     3534    case (Absyn.REAL(r), Absyn.INTEGER(i))
    35353535      equation
    35363536        b = realEq(intReal(i), System.stringReal(r));
     
    35433543
    35443544public function eachEqual "Returns true if two each attributes are equal"
    3545   input Each each1;
    3546   input Each each2;
     3545  input Absyn.Each each1;
     3546  input Absyn.Each each2;
    35473547  output Boolean equal;
    35483548algorithm
    35493549  equal := match(each1, each2)
    3550     case(NON_EACH(), NON_EACH()) then true;
    3551     case(EACH(), EACH()) then true;
     3550    case(Absyn.NON_EACH(), Absyn.NON_EACH()) then true;
     3551    case(Absyn.EACH(), Absyn.EACH()) then true;
    35523552    else false;
    35533553  end match;
    35543554end eachEqual;
    35553555
    3556 protected function functionArgsEqual "Returns true if two FunctionArgs are equal"
    3557   input FunctionArgs args1;
    3558   input FunctionArgs args2;
     3556protected function functionArgsEqual "Returns true if two Absyn.FunctionArgs are equal"
     3557  input Absyn.FunctionArgs args1;
     3558  input Absyn.FunctionArgs args2;
    35593559  output Boolean equal;
    35603560algorithm
    35613561  equal := match(args1,args2)
    35623562    local
    3563       list<Exp> expl1,expl2;
    3564 
    3565     case (FUNCTIONARGS(args = expl1), FUNCTIONARGS(args = expl2))
     3563      list<Absyn.Exp> expl1,expl2;
     3564
     3565    case (Absyn.FUNCTIONARGS(args = expl1), Absyn.FUNCTIONARGS(args = expl2))
    35663566      then List.isEqualOnTrue(expl1, expl2, expEqual);
    35673567
     
    35723572public function getClassName "author: adrpo
    35733573  gets the name of the class."
    3574   input Class inClass;
     3574  input Absyn.Class inClass;
    35753575  output String outName;
    35763576algorithm
    3577   CLASS(name=outName) := inClass;
     3577  Absyn.CLASS(name=outName) := inClass;
    35783578end getClassName;
    35793579
    3580 public type IteratorIndexedCref = tuple<ComponentRef, Integer>;
     3580public type IteratorIndexedCref = tuple<Absyn.ComponentRef, Integer>;
    35813581
    35823582public function findIteratorIndexedCrefs
     
    35843584   iterator, and return a list of cref-Integer tuples, where the cref is the
    35853585   index of the subscript."
    3586   input Exp inExp;
     3586  input Absyn.Exp inExp;
    35873587  input String inIterator;
    35883588  input list<IteratorIndexedCref> inCrefs = {};
     
    35983598  "Traversal function used by deduceReductionIterationRange. Used to find crefs
    35993599   which are subscripted by a given iterator."
    3600   input Exp inExp;
     3600  input Absyn.Exp inExp;
    36013601  input list<IteratorIndexedCref> inCrefs;
    36023602  input String inIterator;
    3603   output Exp outExp = inExp;
     3603  output Absyn.Exp outExp = inExp;
    36043604  output list<IteratorIndexedCref> outCrefs;
    36053605algorithm
    36063606  outCrefs := match inExp
    36073607    local
    3608       ComponentRef cref;
    3609 
    3610     case CREF(componentRef = cref)
     3608      Absyn.ComponentRef cref;
     3609
     3610    case Absyn.CREF(componentRef = cref)
    36113611      then getIteratorIndexedCrefs(cref, inIterator, inCrefs);
    36123612
     
    36213621  output Boolean outEqual;
    36223622protected
    3623   ComponentRef cr1, cr2;
     3623  Absyn.ComponentRef cr1, cr2;
    36243624  Integer idx1, idx2;
    36253625algorithm
     
    36363636   iterator i:
    36373637     a[i] => (a, 1), b[1, i] => (b, 2), c[i+1] => (), d[2].e[i] => (d[2].e, 1)"
    3638   input ComponentRef inCref;
     3638  input Absyn.ComponentRef inCref;
    36393639  input String inIterator;
    36403640  input list<IteratorIndexedCref> inCrefs;
    36413641  output list<IteratorIndexedCref> outCrefs = inCrefs;
    36423642protected
    3643   list<tuple<ComponentRef, Integer>> crefs;
     3643  list<tuple<Absyn.ComponentRef, Integer>> crefs;
    36443644algorithm
    36453645  outCrefs := match inCref
    36463646    local
    3647       list<Subscript> subs;
     3647      list<Absyn.Subscript> subs;
    36483648      Integer idx;
    36493649      String name, id;
    3650       ComponentRef cref;
    3651 
    3652     case CREF_IDENT(name = id, subscripts = subs)
     3650      Absyn.ComponentRef cref;
     3651
     3652    case Absyn.CREF_IDENT(name = id, subscripts = subs)
    36533653      algorithm
    36543654        // For each subscript, check if the subscript consists of only the
     
    36573657        for sub in subs loop
    36583658          _ := match sub
    3659             case SUBSCRIPT(subscript = CREF(componentRef =
    3660                 CREF_IDENT(name = name, subscripts = {})))
     3659            case Absyn.SUBSCRIPT(subscript = Absyn.CREF(componentRef =
     3660                Absyn.CREF_IDENT(name = name, subscripts = {})))
    36613661              algorithm
    36623662                if name == inIterator then
    3663                   outCrefs := (CREF_IDENT(id, {}), idx) :: outCrefs;
     3663                  outCrefs := (Absyn.CREF_IDENT(id, {}), idx) :: outCrefs;
    36643664                end if;
    36653665              then
     
    36743674        outCrefs;
    36753675
    3676     case CREF_QUAL(name = id, subscripts = subs, componentRef = cref)
     3676    case Absyn.CREF_QUAL(name = id, subscripts = subs, componentRef = cref)
    36773677      algorithm
    36783678        crefs := getIteratorIndexedCrefs(cref, inIterator, {});
     
    36823682        for cr in crefs loop
    36833683          (cref, idx) := cr;
    3684           outCrefs := (CREF_QUAL(id, subs, cref), idx) :: outCrefs;
     3684          outCrefs := (Absyn.CREF_QUAL(id, subs, cref), idx) :: outCrefs;
    36853685        end for;
    36863686      then
    3687         getIteratorIndexedCrefs(CREF_IDENT(id, subs), inIterator, outCrefs);
    3688 
    3689     case CREF_FULLYQUALIFIED(componentRef = cref)
     3687        getIteratorIndexedCrefs(Absyn.CREF_IDENT(id, subs), inIterator, outCrefs);
     3688
     3689    case Absyn.CREF_FULLYQUALIFIED(componentRef = cref)
    36903690      algorithm
    36913691        crefs := getIteratorIndexedCrefs(cref, inIterator, {});
     
    36943694        for cr in crefs loop
    36953695          (cref, idx) := cr;
    3696           outCrefs := (CREF_FULLYQUALIFIED(cref), idx) :: outCrefs;
     3696          outCrefs := (Absyn.CREF_FULLYQUALIFIED(cref), idx) :: outCrefs;
    36973697        end for;
    36983698      then
     
    37043704
    37053705public function pathReplaceIdent
    3706   input Path path;
     3706  input Absyn.Path path;
    37073707  input String last;
    3708   output Path out;
     3708  output Absyn.Path out;
    37093709algorithm
    37103710  out := match (path,last)
    3711     local Path p; String n,s;
    3712     case (FULLYQUALIFIED(p),s) equation p = pathReplaceIdent(p,s); then FULLYQUALIFIED(p);
    3713     case (QUALIFIED(n,p),s) equation p = pathReplaceIdent(p,s); then QUALIFIED(n,p);
    3714     case (IDENT(),s) then IDENT(s);
     3711    local Absyn.Path p; String n,s;
     3712    case (Absyn.FULLYQUALIFIED(p),s) equation p = pathReplaceIdent(p,s); then Absyn.FULLYQUALIFIED(p);
     3713    case (Absyn.QUALIFIED(n,p),s) equation p = pathReplaceIdent(p,s); then Absyn.QUALIFIED(n,p);
     3714    case (Absyn.IDENT(),s) then Absyn.IDENT(s);
    37153715  end match;
    37163716end pathReplaceIdent;
     
    37253725public function isOuter
    37263726"@author: adrpo
    3727   this function returns true if the given InnerOuter
    3728   is one of INNER_OUTER() or OUTER()"
    3729   input InnerOuter io;
     3727  this function returns true if the given Absyn.InnerOuter
     3728  is one of Absyn.INNER_OUTER() or Absyn.OUTER()"
     3729  input Absyn.InnerOuter io;
    37303730  output Boolean isItAnOuter;
    37313731algorithm
    37323732  isItAnOuter := match(io)
    3733     case (INNER_OUTER()) then true;
    3734     case (OUTER()) then true;
     3733    case (Absyn.INNER_OUTER()) then true;
     3734    case (Absyn.OUTER()) then true;
    37353735    else false;
    37363736  end match;
     
    37393739public function isInner
    37403740"@author: adrpo
    3741   this function returns true if the given InnerOuter
    3742   is one of INNER_OUTER() or INNER()"
    3743   input InnerOuter io;
     3741  this function returns true if the given Absyn.InnerOuter
     3742  is one of Absyn.INNER_OUTER() or Absyn.INNER()"
     3743  input Absyn.InnerOuter io;
    37443744  output Boolean isItAnInner;
    37453745algorithm
    37463746  isItAnInner := match(io)
    3747     case (INNER_OUTER()) then true;
    3748     case (INNER()) then true;
     3747    case (Absyn.INNER_OUTER()) then true;
     3748    case (Absyn.INNER()) then true;
    37493749    else false;
    37503750  end match;
     
    37523752
    37533753public function isOnlyInner
    3754   "Returns true if the InnerOuter is INNER, false otherwise."
    3755   input InnerOuter inIO;
     3754  "Returns true if the Absyn.InnerOuter is Absyn.INNER, false otherwise."
     3755  input Absyn.InnerOuter inIO;
    37563756  output Boolean outOnlyInner;
    37573757algorithm
    37583758  outOnlyInner := match(inIO)
    3759     case (INNER()) then true;
     3759    case (Absyn.INNER()) then true;
    37603760    else false;
    37613761  end match;
     
    37633763
    37643764public function isOnlyOuter
    3765   "Returns true if the InnerOuter is OUTER, false otherwise."
    3766   input InnerOuter inIO;
     3765  "Returns true if the Absyn.InnerOuter is Absyn.OUTER, false otherwise."
     3766  input Absyn.InnerOuter inIO;
    37673767  output Boolean outOnlyOuter;
    37683768algorithm
    37693769  outOnlyOuter := match(inIO)
    3770     case (OUTER()) then true;
     3770    case (Absyn.OUTER()) then true;
    37713771    else false;
    37723772  end match;
     
    37743774
    37753775public function isInnerOuter
    3776   input InnerOuter inIO;
     3776  input Absyn.InnerOuter inIO;
    37773777  output Boolean outIsInnerOuter;
    37783778algorithm
    37793779  outIsInnerOuter := match(inIO)
    3780     case (INNER_OUTER()) then true;
     3780    case (Absyn.INNER_OUTER()) then true;
    37813781    else false;
    37823782  end match;
     
    37843784
    37853785public function isNotInnerOuter
    3786   input InnerOuter inIO;
     3786  input Absyn.InnerOuter inIO;
    37873787  output Boolean outIsNotInnerOuter;
    37883788algorithm
    37893789  outIsNotInnerOuter := match(inIO)
    3790     case (NOT_INNER_OUTER()) then true;
     3790    case (Absyn.NOT_INNER_OUTER()) then true;
    37913791    else false;
    37923792  end match;
    37933793end isNotInnerOuter;
    37943794
    3795 public function innerOuterEqual "Returns true if two InnerOuter's are equal"
    3796   input InnerOuter io1;
    3797   input InnerOuter io2;
     3795public function innerOuterEqual "Returns true if two Absyn.InnerOuter's are equal"
     3796  input Absyn.InnerOuter io1;
     3797  input Absyn.InnerOuter io2;
    37983798  output Boolean res;
    37993799algorithm
    38003800  res := match(io1,io2)
    3801     case(INNER(),INNER()) then true;
    3802     case(OUTER(),OUTER()) then true;
    3803     case(INNER_OUTER(),INNER_OUTER()) then true;
    3804     case(NOT_INNER_OUTER(),NOT_INNER_OUTER()) then true;
     3801    case(Absyn.INNER(),Absyn.INNER()) then true;
     3802    case(Absyn.OUTER(),Absyn.OUTER()) then true;
     3803    case(Absyn.INNER_OUTER(),Absyn.INNER_OUTER()) then true;
     3804    case(Absyn.NOT_INNER_OUTER(),Absyn.NOT_INNER_OUTER()) then true;
    38053805    else false;
    38063806  end match;
     
    38093809public function makeFullyQualified
    38103810"Makes a path fully qualified unless it already is."
    3811   input Path inPath;
    3812   output Path outPath;
     3811  input Absyn.Path inPath;
     3812  output Absyn.Path outPath;
    38133813algorithm
    38143814  outPath := match(inPath)
    3815     case FULLYQUALIFIED() then inPath;
    3816     else FULLYQUALIFIED(inPath);
     3815    case Absyn.FULLYQUALIFIED() then inPath;
     3816    else Absyn.FULLYQUALIFIED(inPath);
    38173817  end match;
    38183818end makeFullyQualified;
     
    38203820public function makeNotFullyQualified
    38213821"Makes a path not fully qualified unless it already is."
    3822   input Path inPath;
    3823   output Path outPath;
     3822  input Absyn.Path inPath;
     3823  output Absyn.Path outPath;
    38243824algorithm
    38253825  outPath := match inPath
    3826     local Path path;
    3827     case FULLYQUALIFIED(path) then path;
     3826    local Absyn.Path path;
     3827    case Absyn.FULLYQUALIFIED(path) then path;
    38283828    else inPath;
    38293829  end match;
     
    38313831
    38323832public function importEqual "Compares two import elements. "
    3833   input Import im1;
    3834   input Import im2;
     3833  input Absyn.Import im1;
     3834  input Absyn.Import im2;
    38353835  output Boolean outBoolean;
    38363836algorithm
    38373837  outBoolean := matchcontinue (im1,im2)
    38383838    local
    3839       Ident id,id2;
    3840       Path p1,p2;
    3841     case (NAMED_IMPORT(name = id,path=p1),NAMED_IMPORT(name = id2,path=p2))
     3839      Absyn.Ident id,id2;
     3840      Absyn.Path p1,p2;
     3841    case (Absyn.NAMED_IMPORT(name = id,path=p1),Absyn.NAMED_IMPORT(name = id2,path=p2))
    38423842      equation
    38433843        true = stringEq(id, id2);
     
    38453845      then
    38463846        true;
    3847     case (QUAL_IMPORT(path=p1),QUAL_IMPORT(path=p2))
     3847    case (Absyn.QUAL_IMPORT(path=p1),Absyn.QUAL_IMPORT(path=p2))
    38483848      equation
    38493849        true = pathEqual(p1,p2);
    38503850      then
    38513851        true;
    3852     case (UNQUAL_IMPORT(path=p1),UNQUAL_IMPORT(path=p2))
     3852    case (Absyn.UNQUAL_IMPORT(path=p1),Absyn.UNQUAL_IMPORT(path=p2))
    38533853      equation
    38543854        true = pathEqual(p1,p2);
     
    38603860
    38613861public function canonIfExp "Transforms an if-expression to canonical form (without else-if branches)"
    3862   input Exp inExp;
    3863   output Exp outExp;
     3862  input Absyn.Exp inExp;
     3863  output Absyn.Exp outExp;
    38643864algorithm
    38653865  outExp := match inExp
    38663866    local
    3867       Exp cond,tb,eb,ei_cond,ei_tb,e;
    3868       list<tuple<Exp,Exp>> eib;
    3869 
    3870     case IFEXP(elseIfBranch={}) then inExp;
    3871     case IFEXP(ifExp=cond,trueBranch=tb,elseBranch=eb,elseIfBranch=(ei_cond,ei_tb)::eib)
    3872       equation
    3873         e = canonIfExp(IFEXP(ei_cond,ei_tb,eb,eib));
    3874       then IFEXP(cond,tb,e,{});
     3867      Absyn.Exp cond,tb,eb,ei_cond,ei_tb,e;
     3868      list<tuple<Absyn.Exp,Absyn.Exp>> eib;
     3869
     3870    case Absyn.IFEXP(elseIfBranch={}) then inExp;
     3871    case Absyn.IFEXP(ifExp=cond,trueBranch=tb,elseBranch=eb,elseIfBranch=(ei_cond,ei_tb)::eib)
     3872      equation
     3873        e = canonIfExp(Absyn.IFEXP(ei_cond,ei_tb,eb,eib));
     3874      then Absyn.IFEXP(cond,tb,e,{});
    38753875  end match;
    38763876end canonIfExp;
     
    38793879"@author: adrpo
    38803880  This function checks if a modification only contains literal expressions"
    3881   input list<ElementArg> inMod;
     3881  input list<Absyn.ElementArg> inMod;
    38823882  output Boolean onlyLiterals;
    38833883algorithm
    38843884  onlyLiterals := matchcontinue(inMod)
    38853885    local
    3886       list<ElementArg> dive, rest;
    3887       EqMod eqMod;
     3886      list<Absyn.ElementArg> dive, rest;
     3887      Absyn.EqMod eqMod;
    38883888      Boolean b1, b2, b3, b;
    38893889
     
    38913891
    38923892    // skip "interaction" annotation!
    3893     case (MODIFICATION(path = IDENT(name = "interaction")) :: rest)
     3893    case (Absyn.MODIFICATION(path = Absyn.IDENT(name = "interaction")) :: rest)
    38943894      equation
    38953895        b = onlyLiteralsInAnnotationMod(rest);
     
    38993899
    39003900    // search inside, some(exp)
    3901     case (MODIFICATION(modification = SOME(CLASSMOD(dive, eqMod))) :: rest)
     3901    case (Absyn.MODIFICATION(modification = SOME(Absyn.CLASSMOD(dive, eqMod))) :: rest)
    39023902      equation
    39033903        b1 = onlyLiteralsInEqMod(eqMod);
     
    39233923"@author: adrpo
    39243924  This function checks if an optional expression only contains literal expressions"
    3925   input EqMod eqMod;
     3925  input Absyn.EqMod eqMod;
    39263926  output Boolean onlyLiterals;
    39273927algorithm
    39283928  onlyLiterals := match (eqMod)
    39293929    local
    3930       Exp exp;
    3931       list<Exp> lst;
     3930      Absyn.Exp exp;
     3931      list<Absyn.Exp> lst;
    39323932      Boolean b;
    39333933
    3934     case (NOMOD()) then true;
     3934    case (Absyn.NOMOD()) then true;
    39353935
    39363936    // search inside, some(exp)
    3937     case (EQMOD(exp=exp))
     3937    case (Absyn.EQMOD(exp=exp))
    39383938      equation
    39393939         (_, lst::{}) = traverseExpBidir(exp, onlyLiteralsInExpEnter, onlyLiteralsInExpExit, {}::{});
     
    39463946protected function onlyLiteralsInExpEnter
    39473947"@author: adrpo
    3948  Visitor function for checking if Exp contains only literals, NO CREFS!
     3948 Visitor function for checking if Absyn.Exp contains only literals, NO CREFS!
    39493949 It returns an empty list if it doesn't contain any crefs!"
    3950   input Exp inExp;
    3951   input list<list<Exp>> inLst;
    3952   output Exp outExp;
    3953   output list<list<Exp>> outLst;
     3950  input Absyn.Exp inExp;
     3951  input list<list<Absyn.Exp>> inLst;
     3952  output Absyn.Exp outExp;
     3953  output list<list<Absyn.Exp>> outLst;
    39543954algorithm
    39553955  (outExp,outLst) := match (inExp,inLst)
    39563956    local
    39573957      Boolean b;
    3958       Exp e;
    3959       ComponentRef cr;
    3960       list<Exp> lst;
    3961       list<list<Exp>> rest;
     3958      Absyn.Exp e;
     3959      Absyn.ComponentRef cr;
     3960      list<Absyn.Exp> lst;
     3961      list<list<Absyn.Exp>> rest;
    39623962      String name;
    3963       FunctionArgs fargs;
     3963      Absyn.FunctionArgs fargs;
    39643964
    39653965    // first handle all graphic enumerations!
    39663966    // FillPattern.*, Smooth.*, TextAlignment.*, etc!
    3967     case (e as CREF(CREF_QUAL(name=name)), lst::rest)
     3967    case (e as Absyn.CREF(Absyn.CREF_QUAL(name=name)), lst::rest)
    39683968      equation
    39693969        b = listMember(name,{
     
    39793979
    39803980    // crefs, add to list
    3981     case (CREF(), lst::rest) then (inExp,(inExp::lst)::rest);
     3981    case (Absyn.CREF(), lst::rest) then (inExp,(inExp::lst)::rest);
    39823982
    39833983    // anything else, return the same!
     
    39893989protected function onlyLiteralsInExpExit
    39903990"@author: adrpo
    3991  Visitor function for checking if Exp contains only literals, NO CREFS!
     3991 Visitor function for checking if Absyn.Exp contains only literals, NO CREFS!
    39923992 It returns an empty list if it doesn't contain any crefs!"
    3993   input Exp inExp;
    3994   input list<list<Exp>> inLst;
    3995   output Exp outExp;
    3996   output list<list<Exp>> outLst;
     3993  input Absyn.Exp inExp;
     3994  input list<list<Absyn.Exp>> inLst;
     3995  output Absyn.Exp outExp;
     3996  output list<list<Absyn.Exp>> outLst;
    39973997algorithm
    39983998  (outExp,outLst) := match (inExp,inLst)
    39993999    local
    4000       list<list<Exp>> lst;
     4000      list<list<Absyn.Exp>> lst;
    40014001
    40024002    // first handle DynamicSelect; pop the stack (ignore any crefs inside DynamicSelect)
    4003     case (CALL(function_ = CREF_IDENT(name = "DynamicSelect")), lst)
     4003    case (Absyn.CALL(function_ = Absyn.CREF_IDENT(name = "DynamicSelect")), lst)
    40044004      then (inExp, lst);
    40054005
     
    40114011
    40124012public function makeCons
    4013   input Exp e1;
    4014   input Exp e2;
    4015   output Exp e;
    4016 algorithm
    4017   e := CONS(e1,e2);
     4013  input Absyn.Exp e1;
     4014  input Absyn.Exp e2;
     4015  output Absyn.Exp e;
     4016algorithm
     4017  e := Absyn.CONS(e1,e2);
    40184018annotation(__OpenModelica_EarlyInline = true);
    40194019end makeCons;
    40204020
    40214021public function crefIdent
    4022   input ComponentRef cr;
     4022  input Absyn.ComponentRef cr;
    40234023  output String str;
    40244024algorithm
    4025   CREF_IDENT(str,{}) := cr;
     4025  Absyn.CREF_IDENT(str,{}) := cr;
    40264026end crefIdent;
    40274027
    40284028public function unqotePathIdents
    4029   input Path inPath;
    4030   output Path path;
     4029  input Absyn.Path inPath;
     4030  output Absyn.Path path;
    40314031algorithm
    40324032  path := stringListPath(List.map(pathToStringList(inPath), System.unquoteIdentifier));
     
    40364036  "If the given component reference is fully qualified this function removes the
    40374037  fully qualified qualifier, otherwise does nothing."
    4038   input ComponentRef inCref;
    4039   output ComponentRef outCref;
     4038  input Absyn.ComponentRef inCref;
     4039  output Absyn.ComponentRef outCref;
    40404040algorithm
    40414041  outCref := match(inCref)
    40424042    local
    4043       ComponentRef cref;
    4044 
    4045     case CREF_FULLYQUALIFIED(componentRef = cref) then cref;
     4043      Absyn.ComponentRef cref;
     4044
     4045    case Absyn.CREF_FULLYQUALIFIED(componentRef = cref) then cref;
    40464046    else inCref;
    40474047  end match;
     
    40494049
    40504050public function pathIsFullyQualified
    4051   input Path inPath;
     4051  input Absyn.Path inPath;
    40524052  output Boolean outIsQualified;
    40534053algorithm
    40544054  outIsQualified := match(inPath)
    4055     case FULLYQUALIFIED() then true;
     4055    case Absyn.FULLYQUALIFIED() then true;
    40564056    else false;
    40574057  end match;
     
    40594059
    40604060public function pathIsIdent
    4061   input Path inPath;
     4061  input Absyn.Path inPath;
    40624062  output Boolean outIsIdent;
    40634063algorithm
    40644064  outIsIdent := match(inPath)
    4065     case IDENT() then true;
     4065    case Absyn.IDENT() then true;
    40664066    else false;
    40674067  end match;
     
    40694069
    40704070public function pathIsQual
    4071   input Path inPath;
     4071  input Absyn.Path inPath;
    40724072  output Boolean outIsQual;
    40734073algorithm
    40744074  outIsQual := match(inPath)
    4075     case QUALIFIED() then true;
     4075    case Absyn.QUALIFIED() then true;
    40764076    else false;
    40774077  end match;
     
    40794079
    40804080public function withinEqual
    4081   input Within within1;
    4082   input Within within2;
     4081  input Absyn.Within within1;
     4082  input Absyn.Within within2;
    40834083  output Boolean b;
    40844084algorithm
    40854085  b := match (within1,within2)
    40864086    local
    4087       Path p1,p2;
    4088     case (TOP(),TOP()) then true;
    4089     case (WITHIN(p1),WITHIN(p2)) then pathEqual(p1,p2);
     4087      Absyn.Path p1,p2;
     4088    case (Absyn.TOP(),Absyn.TOP()) then true;
     4089    case (Absyn.WITHIN(p1),Absyn.WITHIN(p2)) then pathEqual(p1,p2);
    40904090    else false;
    40914091  end match;
     
    40934093
    40944094public function withinEqualCaseInsensitive
    4095   input Within within1;
    4096   input Within within2;
     4095  input Absyn.Within within1;
     4096  input Absyn.Within within2;
    40974097  output Boolean b;
    40984098algorithm
    40994099  b := match (within1,within2)
    41004100    local
    4101       Path p1,p2;
    4102     case (TOP(),TOP()) then true;
    4103     case (WITHIN(p1),WITHIN(p2)) then pathEqualCaseInsensitive(p1,p2);
     4101      Absyn.Path p1,p2;
     4102    case (Absyn.TOP(),Absyn.TOP()) then true;
     4103    case (Absyn.WITHIN(p1),Absyn.WITHIN(p2)) then pathEqualCaseInsensitive(p1,p2);
    41044104    else false;
    41054105  end match;
     
    41074107
    41084108public function withinString
    4109   input Within w1;
     4109  input Absyn.Within w1;
    41104110  output String str;
    41114111algorithm
    41124112  str := match (w1)
    41134113    local
    4114       Path p1;
    4115     case (TOP()) then "within ;";
    4116     case (WITHIN(p1)) then "within " + pathString(p1) + ";";
     4114      Absyn.Path p1;
     4115    case (Absyn.TOP()) then "within ;";
     4116    case (Absyn.WITHIN(p1)) then "within " + pathString(p1) + ";";
    41174117  end match;
    41184118end withinString;
    41194119
    41204120public function joinWithinPath
    4121   input Within within_;
    4122   input Path path;
    4123   output Path outPath;
     4121  input Absyn.Within within_;
     4122  input Absyn.Path path;
     4123  output Absyn.Path outPath;
    41244124algorithm
    41254125  outPath := match (within_,path)
    41264126    local
    4127       Path path1;
    4128     case (TOP(),_) then path;
    4129     case (WITHIN(path1),_) then joinPaths(path1,path);
     4127      Absyn.Path path1;
     4128    case (Absyn.TOP(),_) then path;
     4129    case (Absyn.WITHIN(path1),_) then joinPaths(path1,path);
    41304130  end match;
    41314131end joinWithinPath;
    41324132
    41334133public function innerOuterStr
    4134   input InnerOuter io;
     4134  input Absyn.InnerOuter io;
    41354135  output String str;
    41364136algorithm
    41374137  str := match(io)
    4138     case (INNER_OUTER()) then "inner outer ";
    4139     case (INNER()) then "inner ";
    4140     case (OUTER()) then "outer ";
    4141     case (NOT_INNER_OUTER()) then "";
     4138    case (Absyn.INNER_OUTER()) then "inner outer ";
     4139    case (Absyn.INNER()) then "inner ";
     4140    case (Absyn.OUTER()) then "outer ";
     4141    case (Absyn.NOT_INNER_OUTER()) then "";
    41424142  end match;
    41434143end innerOuterStr;
    41444144
    41454145public function subscriptExpOpt
    4146   input Subscript inSub;
    4147   output Option<Exp> outExpOpt;
     4146  input Absyn.Subscript inSub;
     4147  output Option<Absyn.Exp> outExpOpt;
    41484148algorithm
    41494149  outExpOpt := match(inSub)
    41504150    local
    4151       Exp e;
    4152 
    4153     case SUBSCRIPT(subscript = e) then SOME(e);
    4154     case NOSUB() then NONE();
     4151      Absyn.Exp e;
     4152
     4153    case Absyn.SUBSCRIPT(subscript = e) then SOME(e);
     4154    case Absyn.NOSUB() then NONE();
    41554155  end match;
    41564156end subscriptExpOpt;
    41574157
    41584158public function crefInsertSubscriptLstLst
    4159   input Exp inExp;
    4160   input list<list<Subscript>> inLst;
    4161   output Exp outExp;
    4162   output list<list<Subscript>> outLst;
     4159  input Absyn.Exp inExp;
     4160  input list<list<Absyn.Subscript>> inLst;
     4161  output Absyn.Exp outExp;
     4162  output list<list<Absyn.Subscript>> outLst;
    41634163algorithm
    41644164  (outExp,outLst) := matchcontinue(inExp,inLst)
    41654165    local
    4166       ComponentRef cref,cref2;
    4167       list<list<Subscript>> subs;
    4168       Exp e;
    4169     case (CREF(componentRef=cref),subs)
     4166      Absyn.ComponentRef cref,cref2;
     4167      list<list<Absyn.Subscript>> subs;
     4168      Absyn.Exp e;
     4169    case (Absyn.CREF(componentRef=cref),subs)
    41704170      equation
    41714171        cref2 = crefInsertSubscriptLstLst2(cref,subs);
    41724172      then
    4173          (CREF(cref2),subs);
     4173         (Absyn.CREF(cref2),subs);
    41744174    else (inExp,inLst);
    41754175  end matchcontinue;
     
    41784178public function crefInsertSubscriptLstLst2
    41794179"Helper function to crefInsertSubscriptLstLst"
    4180   input ComponentRef inCref;
    4181   input list<list<Subscript>> inSubs;
    4182   output ComponentRef outCref;
     4180  input Absyn.ComponentRef inCref;
     4181  input list<list<Absyn.Subscript>> inSubs;
     4182  output Absyn.ComponentRef outCref;
    41834183algorithm
    41844184  outCref := matchcontinue(inCref,inSubs)
    41854185    local
    4186       ComponentRef cref, cref2;
    4187       Ident n;
    4188       list<list<Subscript>> subs;
    4189       list<Subscript> s;
     4186      Absyn.ComponentRef cref, cref2;
     4187      Absyn.Ident n;
     4188      list<list<Absyn.Subscript>> subs;
     4189      list<Absyn.Subscript> s;
    41904190      case (cref,{})
    41914191        then cref;
    4192       case (CREF_IDENT(name = n), {s})
    4193         then CREF_IDENT(n,s);
    4194       case (CREF_QUAL(name = n, componentRef = cref), s::subs)
     4192      case (Absyn.CREF_IDENT(name = n), {s})
     4193        then Absyn.CREF_IDENT(n,s);
     4194      case (Absyn.CREF_QUAL(name = n, componentRef = cref), s::subs)
    41954195        equation
    41964196          cref2 = crefInsertSubscriptLstLst2(cref, subs);
    41974197        then
    4198           CREF_QUAL(n,s,cref2);
    4199       case (CREF_FULLYQUALIFIED(componentRef = cref), subs)
     4198          Absyn.CREF_QUAL(n,s,cref2);
     4199      case (Absyn.CREF_FULLYQUALIFIED(componentRef = cref), subs)
    42004200        equation
    42014201          cref2 = crefInsertSubscriptLstLst2(cref, subs);
     
    42064206
    42074207public function isCref
    4208   input Exp exp;
     4208  input Absyn.Exp exp;
    42094209  output Boolean b;
    42104210algorithm
    42114211  b := match exp
    4212     case CREF() then true;
     4212    case Absyn.CREF() then true;
    42134213    else false;
    42144214  end match;
     
    42164216
    42174217public function isTuple
    4218   input Exp exp;
     4218  input Absyn.Exp exp;
    42194219  output Boolean b;
    42204220algorithm
    42214221  b := match exp
    4222     case TUPLE(__) then true;
     4222    case Absyn.TUPLE(__) then true;
    42234223    else false;
    42244224  end match;
     
    42284228  "@author: johti
    42294229   Returns true if all fields are crefs"
    4230   input list<Exp> expLst;
     4230  input list<Absyn.Exp> expLst;
    42314231  output Boolean b;
    42324232algorithm
     
    42384238    Returns true if everything contained
    42394239    in the tuple or a cons cell is a constant reference."
    4240   input Exp inExp;
     4240  input Absyn.Exp inExp;
    42414241  output Boolean b;
    42424242algorithm
    42434243  b := match inExp
    4244     case TUPLE(__) then allFieldsAreCrefs(inExp.expressions);
    4245     case CONS(__) then complexIsCref(inExp.head) and complexIsCref(inExp.rest);
     4244    case Absyn.TUPLE(__) then allFieldsAreCrefs(inExp.expressions);
     4245    case Absyn.CONS(__) then complexIsCref(inExp.head) and complexIsCref(inExp.rest);
    42464246    case _ then isCref(inExp);
    42474247  end match;
     
    42494249
    42504250public function isDerCref
    4251   input Exp exp;
     4251  input Absyn.Exp exp;
    42524252  output Boolean b;
    42534253algorithm
    42544254  b := match exp
    4255     case CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF()},{})) then true;
     4255    case Absyn.CALL(Absyn.CREF_IDENT("der",{}),Absyn.FUNCTIONARGS({Absyn.CREF()},{})) then true;
    42564256    else false;
    42574257  end match;
     
    42594259
    42604260public function isDerCrefFail
    4261   input Exp exp;
    4262 algorithm
    4263   CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF()},{})) := exp;
     4261  input Absyn.Exp exp;
     4262algorithm
     4263  Absyn.CALL(Absyn.CREF_IDENT("der",{}),Absyn.FUNCTIONARGS({Absyn.CREF()},{})) := exp;
    42644264end isDerCrefFail;
    42654265
     
    42684268  returns all the expressions from array dimension as a list
    42694269  also returns if we have unknown dimensions in the array dimension"
    4270   input ArrayDim inAd;
     4270  input Absyn.ArrayDim inAd;
    42714271  output Boolean hasUnknownDimensions;
    4272   output list<Exp> outExps;
     4272  output list<Absyn.Exp> outExps;
    42734273algorithm
    42744274  (hasUnknownDimensions, outExps) := getExpsFromArrayDim_tail(inAd, {});
     
    42794279  returns all the expressions from array dimension as a list
    42804280  also returns if we have unknown dimensions in the array dimension"
    4281   input Option<ArrayDim> inAdO;
     4281  input Option<Absyn.ArrayDim> inAdO;
    42824282  output Boolean hasUnknownDimensions;
    4283   output list<Exp> outExps;
     4283  output list<Absyn.Exp> outExps;
    42844284algorithm
    42854285  (hasUnknownDimensions, outExps) := match(inAdO)
    4286     local ArrayDim ad;
     4286    local Absyn.ArrayDim ad;
    42874287
    42884288    case (NONE()) then (false, {});
     
    43014301  returns all the expressions from array dimension as a list
    43024302  also returns if we have unknown dimensions in the array dimension"
    4303   input ArrayDim inAd;
    4304   input list<Exp> inAccumulator;
     4303  input Absyn.ArrayDim inAd;
     4304  input list<Absyn.Exp> inAccumulator;
    43054305  output Boolean hasUnknownDimensions;
    4306   output list<Exp> outExps;
     4306  output list<Absyn.Exp> outExps;
    43074307algorithm
    43084308  (hasUnknownDimensions, outExps) := match(inAd, inAccumulator)
    43094309    local
    4310       list<Subscript> rest;
    4311       Exp e;
    4312       list<Exp> exps, acc;
     4310      list<Absyn.Subscript> rest;
     4311      Absyn.Exp e;
     4312      list<Absyn.Exp> exps, acc;
    43134313      Boolean b;
    43144314
     
    43164316    case ({}, acc) then (false, listReverse(acc));
    43174317
    4318     // handle SUBSCRIPT
    4319     case (SUBSCRIPT(e)::rest, acc)
     4318    // handle Absyn.SUBSCRIPT
     4319    case (Absyn.SUBSCRIPT(e)::rest, acc)
    43204320      equation
    43214321        (b, exps) = getExpsFromArrayDim_tail(rest, e::acc);
     
    43234323         (b, exps);
    43244324
    4325     // handle NOSUB
    4326     case (NOSUB()::rest, acc)
     4325    // handle Absyn.NOSUB
     4326    case (Absyn.NOSUB()::rest, acc)
    43274327      equation
    43284328        (_, exps) = getExpsFromArrayDim_tail(rest, acc);
     
    43354335"@author: adrpo
    43364336 returns true if the given direction is input or output"
    4337  input Direction direction;
     4337 input Absyn.Direction direction;
    43384338 output Boolean isIorO "input or output only";
    43394339algorithm
    43404340  isIorO := match(direction)
    4341     case (INPUT()) then true;
    4342     case (OUTPUT()) then true;
    4343     case (INPUT_OUTPUT()) then true;
    4344     case (BIDIR()) then false;
     4341    case (Absyn.INPUT()) then true;
     4342    case (Absyn.OUTPUT()) then true;
     4343    case (Absyn.INPUT_OUTPUT()) then true;
     4344    case (Absyn.BIDIR()) then false;
    43454345  end match;
    43464346end isInputOrOutput;
    43474347
    43484348public function isInput
    4349   input Direction inDirection;
     4349  input Absyn.Direction inDirection;
    43504350  output Boolean outIsInput;
    43514351algorithm
    43524352  outIsInput := match(inDirection)
    4353     case INPUT() then true;
    4354     case INPUT_OUTPUT() then true;
     4353    case Absyn.INPUT() then true;
     4354    case Absyn.INPUT_OUTPUT() then true;
    43554355    else false;
    43564356  end match;
     
    43584358
    43594359public function isOutput
    4360   input Direction inDirection;
     4360  input Absyn.Direction inDirection;
    43614361  output Boolean outIsOutput;
    43624362algorithm
    43634363  outIsOutput := match(inDirection)
    4364     case OUTPUT() then true;
    4365     case INPUT_OUTPUT() then true;
     4364    case Absyn.OUTPUT() then true;
     4365    case Absyn.INPUT_OUTPUT() then true;
    43664366    else false;
    43674367  end match;
     
    43694369
    43704370public function directionEqual
    4371   input Direction inDirection1;
    4372   input Direction inDirection2;
     4371  input Absyn.Direction inDirection1;
     4372  input Absyn.Direction inDirection2;
    43734373  output Boolean outEqual;
    43744374algorithm
    43754375  outEqual := match(inDirection1, inDirection2)
    4376     case (BIDIR(), BIDIR()) then true;
    4377     case (INPUT(), INPUT()) then true;
    4378     case (OUTPUT(), OUTPUT()) then true;
    4379     case (INPUT_OUTPUT(), INPUT_OUTPUT()) then true;
     4376    case (Absyn.BIDIR(), Absyn.BIDIR()) then true;
     4377    case (Absyn.INPUT(), Absyn.INPUT()) then true;
     4378    case (Absyn.OUTPUT(), Absyn.OUTPUT()) then true;
     4379    case (Absyn.INPUT_OUTPUT(), Absyn.INPUT_OUTPUT()) then true;
    43804380    else false;
    43814381  end match;
     
    43834383
    43844384public function isFieldEqual
    4385   input IsField isField1;
    4386   input IsField isField2;
     4385  input Absyn.IsField isField1;
     4386  input Absyn.IsField isField2;
    43874387  output Boolean outEqual;
    43884388algorithm
    43894389  outEqual := match(isField1, isField2)
    4390     case (NONFIELD(), NONFIELD()) then true;
    4391     case (FIELD(), FIELD()) then true;
     4390    case (Absyn.NONFIELD(), Absyn.NONFIELD()) then true;
     4391    case (Absyn.FIELD(), Absyn.FIELD()) then true;
    43924392    else false;
    43934393  end match;
     
    43964396
    43974397public function pathLt
    4398   input Path path1;
    4399   input Path path2;
     4398  input Absyn.Path path1;
     4399  input Absyn.Path path2;
    44004400  output Boolean lt;
    44014401algorithm
     
    44044404
    44054405public function pathGe
    4406   input Path path1;
    4407   input Path path2;
     4406  input Absyn.Path path1;
     4407  input Absyn.Path path2;
    44084408  output Boolean ge;
    44094409algorithm
     
    44124412
    44134413public function getShortClass "Strips out long class definitions"
    4414   input Class cl;
    4415   output Class o;
     4414  input Absyn.Class cl;
     4415  output Absyn.Class o;
    44164416algorithm
    44174417  o := match cl
    44184418    local
    4419       Ident name;
     4419      Absyn.Ident name;
    44204420      Boolean pa, fi, en;
    4421       Restriction re;
    4422       ClassDef body;
    4423       Info info;
    4424     case CLASS(body=PARTS()) then fail();
    4425     case CLASS(body=CLASS_EXTENDS()) then fail();
    4426     case CLASS(name,pa,fi,en,re,body,info)
     4421      Absyn.Restriction re;
     4422      Absyn.ClassDef body;
     4423      Absyn.Info info;
     4424    case Absyn.CLASS(body=Absyn.PARTS()) then fail();
     4425    case Absyn.CLASS(body=Absyn.CLASS_EXTENDS()) then fail();
     4426    case Absyn.CLASS(name,pa,fi,en,re,body,info)
    44274427      equation
    44284428        body = stripClassDefComment(body);
    4429       then CLASS(name,pa,fi,en,re,body,info);
     4429      then Absyn.CLASS(name,pa,fi,en,re,body,info);
    44304430  end match;
    44314431end getShortClass;
     
    44334433protected function stripClassDefComment
    44344434  "Strips out class definition comments."
    4435   input ClassDef cl;
    4436   output ClassDef o;
     4435  input Absyn.ClassDef cl;
     4436  output Absyn.ClassDef o;
    44374437algorithm
    44384438  o := match cl
    44394439    local
    4440       EnumDef enumLiterals;
    4441       TypeSpec typeSpec;
    4442       ElementAttributes attributes;
    4443       list<ElementArg> arguments;
    4444       list<Path> functionNames;
    4445       Path functionName;
    4446       list<Ident> vars;
     4440      Absyn.EnumDef enumLiterals;
     4441      Absyn.TypeSpec typeSpec;
     4442      Absyn.ElementAttributes attributes;
     4443      list<Absyn.ElementArg> arguments;
     4444      list<Absyn.Path> functionNames;
     4445      Absyn.Path functionName;
     4446      list<Absyn.Ident> vars;
    44474447      list<String> typeVars;
    4448       Ident baseClassName;
    4449       list<ElementArg> modifications;
    4450       list<ClassPart> parts;
    4451       list<NamedArg> classAttrs;
    4452       list<Annotation> ann;
    4453     case PARTS(typeVars,classAttrs,parts,ann,_) then PARTS(typeVars,classAttrs,parts,ann,NONE());
    4454     case CLASS_EXTENDS(baseClassName,modifications,_,parts,ann) then CLASS_EXTENDS(baseClassName,modifications,NONE(),parts,ann);
    4455     case DERIVED(typeSpec,attributes,arguments,_) then DERIVED(typeSpec,attributes,arguments,NONE());
    4456     case ENUMERATION(enumLiterals,_) then ENUMERATION(enumLiterals,NONE());
    4457     case OVERLOAD(functionNames,_) then OVERLOAD(functionNames,NONE());
    4458     case PDER(functionName,vars,_) then PDER(functionName,vars,NONE());
     4448      Absyn.Ident baseClassName;
     4449      list<Absyn.ElementArg> modifications;
     4450      list<Absyn.ClassPart> parts;
     4451      list<Absyn.NamedArg> classAttrs;
     4452      list<Absyn.Annotation> ann;
     4453    case Absyn.PARTS(typeVars,classAttrs,parts,ann,_) then Absyn.PARTS(typeVars,classAttrs,parts,ann,NONE());
     4454    case Absyn.CLASS_EXTENDS(baseClassName,modifications,_,parts,ann) then Absyn.CLASS_EXTENDS(baseClassName,modifications,NONE(),parts,ann);
     4455    case Absyn.DERIVED(typeSpec,attributes,arguments,_) then Absyn.DERIVED(typeSpec,attributes,arguments,NONE());
     4456    case Absyn.ENUMERATION(enumLiterals,_) then Absyn.ENUMERATION(enumLiterals,NONE());
     4457    case Absyn.OVERLOAD(functionNames,_) then Absyn.OVERLOAD(functionNames,NONE());
     4458    case Absyn.PDER(functionName,vars,_) then Absyn.PDER(functionName,vars,NONE());
    44594459    else cl;
    44604460  end match;
     
    44624462
    44634463public function getFunctionInterface "Strips out the parts of a function definition that are not needed for the interface"
    4464   input Class cl;
    4465   output Class o;
     4464  input Absyn.Class cl;
     4465  output Absyn.Class o;
    44664466algorithm
    44674467  o := match cl
    44684468    local
    4469       Ident name;
     4469      Absyn.Ident name;
    44704470      Boolean partialPrefix, finalPrefix, encapsulatedPrefix;
    4471       Info info;
     4471      Absyn.Info info;
    44724472      list<String> typeVars;
    4473       list<ClassPart> classParts;
    4474       list<ElementItem> elts;
    4475       FunctionRestriction funcRest;
    4476       list<NamedArg> classAttr;
    4477     case CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,R_FUNCTION(funcRest),PARTS(typeVars,classAttr,classParts,_,_),info)
     4473      list<Absyn.ClassPart> classParts;
     4474      list<Absyn.ElementItem> elts;
     4475      Absyn.FunctionRestriction funcRest;
     4476      list<Absyn.NamedArg> classAttr;
     4477    case Absyn.CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,Absyn.R_FUNCTION(funcRest),Absyn.PARTS(typeVars,classAttr,classParts,_,_),info)
    44784478      equation
    44794479        (elts as _::_) = List.fold(listReverse(classParts),getFunctionInterfaceParts,{});
    4480       then CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,R_FUNCTION(funcRest),PARTS(typeVars,classAttr,PUBLIC(elts)::{},{},NONE()),info);
     4480      then Absyn.CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,Absyn.R_FUNCTION(funcRest),Absyn.PARTS(typeVars,classAttr,Absyn.PUBLIC(elts)::{},{},NONE()),info);
    44814481  end match;
    44824482end getFunctionInterface;
    44834483
    44844484protected function getFunctionInterfaceParts
    4485   input ClassPart part;
    4486   input list<ElementItem> elts;
    4487   output list<ElementItem> oelts;
     4485  input Absyn.ClassPart part;
     4486  input list<Absyn.ElementItem> elts;
     4487  output list<Absyn.ElementItem> oelts;
    44884488algorithm
    44894489  oelts := match (part,elts)
    44904490    local
    4491       list<ElementItem> elts1,elts2;
    4492     case (PUBLIC(elts1),elts2)
     4491      list<Absyn.ElementItem> elts1,elts2;
     4492    case (Absyn.PUBLIC(elts1),elts2)
    44934493      equation
    44944494        elts1 = List.filterOnTrue(elts1,filterAnnotationItem);
     
    44994499
    45004500protected function filterAnnotationItem
    4501   input ElementItem elt;
     4501  input Absyn.ElementItem elt;
    45024502  output Boolean outB;
    45034503algorithm
    45044504  outB := match elt
    4505     case ELEMENTITEM() then true;
     4505    case Absyn.ELEMENTITEM() then true;
    45064506    else false;
    45074507  end match;
     
    45104510public function filterNestedClasses
    45114511  "Filter outs the nested classes from the class if any."
    4512   input Class cl;
    4513   output Class o;
     4512  input Absyn.Class cl;
     4513  output Absyn.Class o;
    45144514algorithm
    45154515  o := match cl
    45164516    local
    4517       Ident name;
     4517      Absyn.Ident name;
    45184518      Boolean partialPrefix, finalPrefix, encapsulatedPrefix;
    4519       Restriction restriction;
     4519      Absyn.Restriction restriction;
    45204520      list<String> typeVars;
    4521       list<NamedArg> classAttrs;
    4522       list<ClassPart> classParts;
    4523       list<Annotation> annotations;
     4521      list<Absyn.NamedArg> classAttrs;
     4522      list<Absyn.ClassPart> classParts;
     4523      list<Absyn.Annotation> annotations;
    45244524      Option<String> comment;
    4525       Info info;
    4526     case CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,restriction,PARTS(typeVars,classAttrs,classParts,annotations,comment),info)
     4525      Absyn.Info info;
     4526    case Absyn.CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,restriction,Absyn.PARTS(typeVars,classAttrs,classParts,annotations,comment),info)
    45274527      equation
    45284528        (classParts as _::_) = List.fold(listReverse(classParts),filterNestedClassesParts,{});
    4529       then CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,restriction,PARTS(typeVars,classAttrs,classParts,annotations,comment),info);
     4529      then Absyn.CLASS(name,partialPrefix,finalPrefix,encapsulatedPrefix,restriction,Absyn.PARTS(typeVars,classAttrs,classParts,annotations,comment),info);
    45304530    else cl;
    45314531  end match;
     
    45344534protected function filterNestedClassesParts
    45354535  "Helper funciton for filterNestedClassesParts."
    4536   input ClassPart classPart;
    4537   input list<ClassPart> inClassParts;
    4538   output list<ClassPart> outClassPart;
     4536  input Absyn.ClassPart classPart;
     4537  input list<Absyn.ClassPart> inClassParts;
     4538  output list<Absyn.ClassPart> outClassPart;
    45394539algorithm
    45404540  outClassPart := match (classPart, inClassParts)
    45414541    local
    4542       list<ClassPart> classParts;
    4543       list<ElementItem> elts;
    4544     case (PUBLIC(elts), classParts)
     4542      list<Absyn.ClassPart> classParts;
     4543      list<Absyn.ElementItem> elts;
     4544    case (Absyn.PUBLIC(elts), classParts)
    45454545      equation
    45464546        classPart.contents = List.filterOnFalse(elts, isElementItemClass);
    45474547      then classPart::classParts;
    4548     case (PROTECTED(elts), classParts)
     4548    case (Absyn.PROTECTED(elts), classParts)
    45494549      equation
    45504550        classPart.contents = List.filterOnFalse(elts, isElementItemClass);
     
    45564556public function getExternalDecl
    45574557  "@author: adrpo
    4558    returns the EXTERNAL form parts if there is any.
     4558   returns the Absyn.EXTERNAL form parts if there is any.
    45594559   if there is none, it fails!"
    4560   input Class inCls;
    4561   output ClassPart outExternal;
     4560  input Absyn.Class inCls;
     4561  output Absyn.ClassPart outExternal;
    45624562protected
    4563   ClassPart cp;
    4564   list<ClassPart> class_parts;
    4565 algorithm
    4566   CLASS(body = PARTS(classParts = class_parts)) := inCls;
     4563  Absyn.ClassPart cp;
     4564  list<Absyn.ClassPart> class_parts;
     4565algorithm
     4566  Absyn.CLASS(body = Absyn.PARTS(classParts = class_parts)) := inCls;
    45674567  outExternal := List.find(class_parts, isExternalPart);
    45684568end getExternalDecl;
    45694569
    45704570protected function isExternalPart
    4571   input ClassPart inClassPart;
     4571  input Absyn.ClassPart inClassPart;
    45724572  output Boolean outFound;
    45734573algorithm
    45744574  outFound := match inClassPart
    4575     case EXTERNAL() then true;
     4575    case Absyn.EXTERNAL() then true;
    45764576    else false;
    45774577  end match;
     
    45794579
    45804580public function isParts
    4581   input ClassDef cl;
     4581  input Absyn.ClassDef cl;
    45824582  output Boolean b;
    45834583algorithm
    45844584  b := match cl
    4585     case PARTS() then true;
     4585    case Absyn.PARTS() then true;
    45864586    else false;
    45874587  end match;
    45884588end isParts;
    45894589
    4590 public function makeClassElement "Makes a class into an ElementItem"
    4591   input Class cl;
    4592   output ElementItem el;
     4590public function makeClassElement "Makes a class into an Absyn.ElementItem"
     4591  input Absyn.Class cl;
     4592  output Absyn.ElementItem el;
    45934593protected
    4594   Info info;
     4594  Absyn.Info info;
    45954595  Boolean fp;
    45964596algorithm
    4597   CLASS(finalPrefix = fp, info = info) := cl;
    4598   el := ELEMENTITEM(ELEMENT(fp,NONE(),NOT_INNER_OUTER(),CLASSDEF(false,cl),info,NONE()));
     4597  Absyn.CLASS(finalPrefix = fp, info = info) := cl;
     4598  el := Absyn.ELEMENTITEM(Absyn.ELEMENT(fp,NONE(),Absyn.NOT_INNER_OUTER(),Absyn.CLASSDEF(false,cl),info,NONE()));
    45994599end makeClassElement;
    46004600
    46014601public function componentName
    4602   input ComponentItem c;
     4602  input Absyn.ComponentItem c;
    46034603  output String name;
    46044604algorithm
    4605   COMPONENTITEM(component=COMPONENT(name=name)) := c;
     4605  Absyn.COMPONENTITEM(component=Absyn.COMPONENT(name=name)) := c;
    46064606end componentName;
    46074607
    46084608public function pathSetLastIdent
    4609   input Path inPath;
    4610   input Path inLastIdent;
    4611   output Path outPath;
     4609  input Absyn.Path inPath;
     4610  input Absyn.Path inLastIdent;
     4611  output Absyn.Path outPath;
    46124612algorithm
    46134613  outPath := match(inPath, inLastIdent)
    46144614    local
    4615       Path p;
     4615      Absyn.Path p;
    46164616      String n;
    46174617
    4618     case (IDENT(), _) then inLastIdent;
    4619 
    4620     case (QUALIFIED(n, p), _)
     4618    case (Absyn.IDENT(), _) then inLastIdent;
     4619
     4620    case (Absyn.QUALIFIED(n, p), _)
    46214621      equation
    46224622        p = pathSetLastIdent(p, inLastIdent);
    46234623      then
    4624         QUALIFIED(n, p);
    4625 
    4626     case (FULLYQUALIFIED(p), _)
     4624        Absyn.QUALIFIED(n, p);
     4625
     4626    case (Absyn.FULLYQUALIFIED(p), _)
    46274627      equation
    46284628        p = pathSetLastIdent(p, inLastIdent);
    46294629      then
    4630         FULLYQUALIFIED(p);
     4630        Absyn.FULLYQUALIFIED(p);
    46314631
    46324632  end match;
     
    46364636"@author:
    46374637  returns true if expression contains initial()"
    4638   input Exp inExp;
     4638  input Absyn.Exp inExp;
    46394639  output Boolean hasInitial;
    46404640algorithm
     
    46534653"@author:
    46544654  returns true if expression is initial()"
    4655   input Exp inExp;
     4655  input Absyn.Exp inExp;
    46564656  input Boolean inBool;
    4657   output Exp outExp;
     4657  output Absyn.Exp outExp;
    46584658  output Boolean outBool;
    46594659algorithm
    46604660  (outExp,outBool) := match (inExp,inBool)
    4661     local Exp e; Boolean b;
     4661    local Absyn.Exp e; Boolean b;
    46624662
    46634663    // make sure we don't have not initial()
    4664     case (UNARY(NOT(), _) , _) then (inExp,inBool);
     4664    case (Absyn.UNARY(Absyn.NOT(), _) , _) then (inExp,inBool);
    46654665    // we have initial
    46664666    case (e , _)
     
    46754675"@author:
    46764676  returns true if expression is initial()"
    4677   input Exp inExp;
     4677  input Absyn.Exp inExp;
    46784678  output Boolean hasReinit;
    46794679algorithm
    46804680  hasReinit := match(inExp)
    4681     case (CALL(function_ = CREF_IDENT("initial", _))) then true;
    4682     case (CALL(function_ = CREF_FULLYQUALIFIED(CREF_IDENT("initial", _)))) then true;
     4681    case (Absyn.CALL(function_ = Absyn.CREF_IDENT("initial", _))) then true;
     4682    case (Absyn.CALL(function_ = Absyn.CREF_FULLYQUALIFIED(Absyn.CREF_IDENT("initial", _)))) then true;
    46834683    else false;
    46844684  end match;
     
    46874687public function importPath
    46884688  "Return the path of the given import."
    4689   input Import inImport;
    4690   output Path outPath;
     4689  input Absyn.Import inImport;
     4690  output Absyn.Path outPath;
    46914691algorithm
    46924692  outPath := match(inImport)
    46934693    local
    4694       Path path;
    4695 
    4696     case NAMED_IMPORT(path = path) then path;
    4697     case QUAL_IMPORT(path = path) then path;
    4698     case UNQUAL_IMPORT(path = path) then path;
    4699     case GROUP_IMPORT(prefix = path) then path;
     4694      Absyn.Path path;
     4695
     4696    case Absyn.NAMED_IMPORT(path = path) then path;
     4697    case Absyn.QUAL_IMPORT(path = path) then path;
     4698    case Absyn.UNQUAL_IMPORT(path = path) then path;
     4699    case Absyn.GROUP_IMPORT(prefix = path) then path;
    47004700
    47014701  end match;
     
    47044704public function importName
    47054705  "Returns the import name of a named or qualified import."
    4706   input Import inImport;
    4707   output Ident outName;
     4706  input Absyn.Import inImport;
     4707  output Absyn.Ident outName;
    47084708algorithm
    47094709  outName := match(inImport)
    47104710    local
    4711       Ident name;
    4712       Path path;
     4711      Absyn.Ident name;
     4712      Absyn.Path path;
    47134713
    47144714    // Named import has a given name, 'import D = A.B.C' => D.
    4715     case NAMED_IMPORT(name = name) then name;
     4715    case Absyn.NAMED_IMPORT(name = name) then name;
    47164716    // Qualified import uses the last identifier, 'import A.B.C' => C.
    4717     case QUAL_IMPORT(path = path) then pathLastIdent(path);
     4717    case Absyn.QUAL_IMPORT(path = path) then pathLastIdent(path);
    47184718
    47194719  end match;
     
    47234723" This function takes an old annotation as first argument and a new
    47244724   annotation as  second argument and merges the two.
    4725    Annotation \"parts\" that exist in both the old and the new annotation
     4725   Absyn.Annotation \"parts\" that exist in both the old and the new annotation
    47264726   will be changed according to the new definition. For instance,
    47274727   merge_annotations(annotation(x=1,y=2),annotation(x=3))
    47284728   => annotation(x=3,y=2)"
    4729   input Annotation inAnnotation1;
    4730   input Annotation inAnnotation2;
    4731   output Annotation outAnnotation;
     4729  input Absyn.Annotation inAnnotation1;
     4730  input Absyn.Annotation inAnnotation2;
     4731  output Absyn.Annotation outAnnotation;
    47324732algorithm
    47334733  outAnnotation:=
    47344734  match (inAnnotation1,inAnnotation2)
    47354735    local
    4736       list<ElementArg> oldmods,newmods;
    4737       Annotation a;
    4738     case (ANNOTATION(elementArgs = {}),a) then a;
    4739 
    4740     case (ANNOTATION(elementArgs = oldmods),ANNOTATION(elementArgs = newmods))
    4741       then ANNOTATION(mergeAnnotations2(oldmods, newmods));
     4736      list<Absyn.ElementArg> oldmods,newmods;
     4737      Absyn.Annotation a;
     4738    case (Absyn.ANNOTATION(elementArgs = {}),a) then a;
     4739
     4740    case (Absyn.ANNOTATION(elementArgs = oldmods),Absyn.ANNOTATION(elementArgs = newmods))
     4741      then Absyn.ANNOTATION(mergeAnnotations2(oldmods, newmods));
    47424742  end match;
    47434743end mergeAnnotations;
     
    47464746
    47474747function mergeAnnotations2
    4748   input list<ElementArg> oldmods;
    4749   input list<ElementArg> newmods;
    4750   output list<ElementArg> res = listReverse(oldmods);
     4748  input list<Absyn.ElementArg> oldmods;
     4749  input list<Absyn.ElementArg> newmods;
     4750  output list<Absyn.ElementArg> res = listReverse(oldmods);
    47514751protected
    4752   list<ElementArg> mods;
     4752  list<Absyn.ElementArg> mods;
    47534753  Boolean b;
    4754   Path p;
    4755   ElementArg mod1,mod2;
     4754  Absyn.Path p;
     4755  Absyn.ElementArg mod1,mod2;
    47564756algorithm
    47574757  for mod in newmods loop
    4758     MODIFICATION(path=p) := mod;
     4758    Absyn.MODIFICATION(path=p) := mod;
    47594759    try
    47604760      mod2 := List.find(res, function isModificationOfPath(path=p));
     
    47694769
    47704770public function mergeCommentAnnotation
    4771   "Merges an annotation into a Comment option."
    4772   input Annotation inAnnotation;
    4773   input Option<Comment> inComment;
    4774   output Option<Comment> outComment;
     4771  "Merges an annotation into a Absyn.Comment option."
     4772  input Absyn.Annotation inAnnotation;
     4773  input Option<Absyn.Comment> inComment;
     4774  output Option<Absyn.Comment> outComment;
    47754775algorithm
    47764776  outComment := match inComment
    47774777    local
    4778       Annotation ann;
     4778      Absyn.Annotation ann;
    47794779      Option<String> cmt;
    47804780
    47814781    // No comment, create a new one.
    47824782    case NONE()
    4783       then SOME(COMMENT(SOME(inAnnotation), NONE()));
     4783      then SOME(Absyn.COMMENT(SOME(inAnnotation), NONE()));
    47844784
    47854785    // A comment without annotation, insert the annotation.
    4786     case SOME(COMMENT(annotation_ = NONE(), comment = cmt))
    4787       then SOME(COMMENT(SOME(inAnnotation), cmt));
     4786    case SOME(Absyn.COMMENT(annotation_ = NONE(), comment = cmt))
     4787      then SOME(Absyn.COMMENT(SOME(inAnnotation), cmt));
    47884788
    47894789    // A comment with annotation, merge the annotations.
    4790     case SOME(COMMENT(annotation_ = SOME(ann), comment = cmt))
    4791       then SOME(COMMENT(SOME(mergeAnnotations(ann, inAnnotation)), cmt));
     4790    case SOME(Absyn.COMMENT(annotation_ = SOME(ann), comment = cmt))
     4791      then SOME(Absyn.COMMENT(SOME(mergeAnnotations(ann, inAnnotation)), cmt));
    47924792
    47934793  end match;
     
    47964796function isModificationOfPath
    47974797"returns true or false if the given path is in the list of modifications"
    4798   input ElementArg mod;
    4799   input Path path;
     4798  input Absyn.ElementArg mod;
     4799  input Absyn.Path path;
    48004800  output Boolean yes;
    48014801algorithm
     
    48034803    local
    48044804      String id1,id2;
    4805     case (MODIFICATION(path = IDENT(name = id1)),IDENT(name = id2)) then id1==id2;
     4805    case (Absyn.MODIFICATION(path = Absyn.IDENT(name = id1)),Absyn.IDENT(name = id2)) then id1==id2;
    48064806    else false;
    48074807  end match;
     
    48094809
    48104810function subModsInSameOrder
    4811   input ElementArg oldmod;
    4812   input ElementArg newmod;
    4813   output ElementArg mod;
     4811  input Absyn.ElementArg oldmod;
     4812  input Absyn.ElementArg newmod;
     4813  output Absyn.ElementArg mod;
    48144814algorithm
    48154815  mod := match (oldmod,newmod)
    48164816    local
    4817       list<ElementArg> args1,args2,res;
    4818       ElementArg arg2;
    4819       EqMod eq1,eq2;
    4820       Path p;
     4817      list<Absyn.ElementArg> args1,args2,res;
     4818      Absyn.ElementArg arg2;
     4819      Absyn.EqMod eq1,eq2;
     4820      Absyn.Path p;
    48214821
    48224822    // mod1 or mod2 has no submods
    4823     case (_, MODIFICATION(modification=NONE())) then newmod;
    4824     case (MODIFICATION(modification=NONE()), _) then newmod;
     4823    case (_, Absyn.MODIFICATION(modification=NONE())) then newmod;
     4824    case (Absyn.MODIFICATION(modification=NONE()), _) then newmod;
    48254825    // mod1
    4826     case (MODIFICATION(modification=SOME(CLASSMOD(args1,_))), arg2 as MODIFICATION(modification=SOME(CLASSMOD(args2,eq2))))
     4826    case (Absyn.MODIFICATION(modification=SOME(Absyn.CLASSMOD(args1,_))), arg2 as Absyn.MODIFICATION(modification=SOME(Absyn.CLASSMOD(args2,eq2))))
    48274827      algorithm
    48284828        // Delete all items from args2 that are not in args1
    48294829        res := {};
    48304830        for arg1 in args1 loop
    4831           MODIFICATION(path=p) := arg1;
     4831          Absyn.MODIFICATION(path=p) := arg1;
    48324832          if List.exist(args2, function isModificationOfPath(path=p)) then
    48334833            res := arg1::res;
     
    48374837        // Merge the annotations
    48384838        res := mergeAnnotations2(res, args2);
    4839         arg2.modification := SOME(CLASSMOD(res,eq2));
     4839        arg2.modification := SOME(Absyn.CLASSMOD(res,eq2));
    48404840      then arg2;
    48414841  end match;
     
    48434843
    48444844public function annotationToElementArgs
    4845   input Annotation ann;
    4846   output list<ElementArg> args;
    4847 algorithm
    4848   ANNOTATION(args) := ann;
     4845  input Absyn.Annotation ann;
     4846  output list<Absyn.ElementArg> args;
     4847algorithm
     4848  Absyn.ANNOTATION(args) := ann;
    48494849end annotationToElementArgs;
    48504850
    48514851public function pathToTypeSpec
    4852   input Path inPath;
    4853   output TypeSpec outTypeSpec;
    4854 algorithm
    4855   outTypeSpec := TPATH(inPath, NONE());
     4852  input Absyn.Path inPath;
     4853  output Absyn.TypeSpec outTypeSpec;
     4854algorithm
     4855  outTypeSpec := Absyn.TPATH(inPath, NONE());
    48564856end pathToTypeSpec;
    48574857
    48584858public function typeSpecString
    4859   input TypeSpec inTs;
     4859  input Absyn.TypeSpec inTs;
    48604860  output String outStr;
    48614861algorithm
     
    48644864
    48654865public function crefString
    4866   input ComponentRef inCr;
     4866  input Absyn.ComponentRef inCr;
    48674867  output String outStr;
    48684868algorithm
     
    48714871
    48724872public function typeSpecStringNoQualNoDims
    4873   input TypeSpec inTs;
     4873  input Absyn.TypeSpec inTs;
    48744874  output String outStr;
    48754875algorithm
    48764876  outStr := match (inTs)
    48774877    local
    4878       Ident str,s,str1,str2,str3;
    4879       Path path;
    4880       Option<list<Subscript>> adim;
    4881       list<TypeSpec> typeSpecLst;
    4882 
    4883     case (TPATH(path = path))
     4878      Absyn.Ident str,s,str1,str2,str3;
     4879      Absyn.Path path;
     4880      Option<list<Absyn.Subscript>> adim;
     4881      list<Absyn.TypeSpec> typeSpecLst;
     4882
     4883    case (Absyn.TPATH(path = path))
    48844884      equation
    48854885        str = pathString(makeNotFullyQualified(path));
     
    48874887        str;
    48884888
    4889     case (TCOMPLEX(path = path,typeSpecs = typeSpecLst))
     4889    case (Absyn.TCOMPLEX(path = path,typeSpecs = typeSpecLst))
    48904890      equation
    48914891        str1 = pathString(makeNotFullyQualified(path));
     
    48994899
    49004900public function typeSpecStringNoQualNoDimsLst
    4901   input list<TypeSpec> inTypeSpecLst;
     4901  input list<Absyn.TypeSpec> inTypeSpecLst;
    49024902  output String outString;
    49034903algorithm
     
    49074907
    49084908public function crefStringIgnoreSubs
    4909   input ComponentRef inCr;
     4909  input Absyn.ComponentRef inCr;
    49104910  output String outStr;
    49114911protected
    4912   Path p;
     4912  Absyn.Path p;
    49134913algorithm
    49144914  p := crefToPathIgnoreSubs(inCr);
     
    49174917
    49184918public function importString
    4919   input Import inImp;
     4919  input Absyn.Import inImp;
    49204920  output String outStr;
    49214921algorithm
     
    49254925public function refString
    49264926"@author: adrpo
    4927  full Ref -> string
     4927 full Absyn.Ref -> string
    49284928 cref/path full qualified, type dims, subscripts in crefs"
    4929   input Ref inRef;
     4929  input Absyn.Ref inRef;
    49304930  output String outStr;
    49314931algorithm
    49324932  outStr := match(inRef)
    4933     local ComponentRef cr; TypeSpec ts; Import im;
    4934     case (RCR(cr)) then crefString(cr);
    4935     case (RTS(ts)) then typeSpecString(ts);
    4936     case (RIM(im)) then importString(im);
     4933    local Absyn.ComponentRef cr; Absyn.TypeSpec ts; Absyn.Import im;
     4934    case (Absyn.RCR(cr)) then crefString(cr);
     4935    case (Absyn.RTS(ts)) then typeSpecString(ts);
     4936    case (Absyn.RIM(im)) then importString(im);
    49374937  end match;
    49384938end refString;
     
    49404940public function refStringBrief
    49414941"@author: adrpo
    4942  brief Ref -> string
     4942 brief Absyn.Ref -> string
    49434943 no cref/path full qualified, no type dims, no subscripts in crefs"
    4944   input Ref inRef;
     4944  input Absyn.Ref inRef;
    49454945  output String outStr;
    49464946algorithm
    49474947  outStr := match(inRef)
    4948     local ComponentRef cr; TypeSpec ts; Import im;
    4949     case (RCR(cr)) then crefStringIgnoreSubs(cr);
    4950     case (RTS(ts)) then typeSpecStringNoQualNoDims(ts);
    4951     case (RIM(im)) then importString(im);
     4948    local Absyn.ComponentRef cr; Absyn.TypeSpec ts; Absyn.Import im;
     4949    case (Absyn.RCR(cr)) then crefStringIgnoreSubs(cr);
     4950    case (Absyn.RTS(ts)) then typeSpecStringNoQualNoDims(ts);
     4951    case (Absyn.RIM(im)) then importString(im);
    49524952  end match;
    49534953end refStringBrief;
    49544954
    49554955public function getArrayDimOptAsList
    4956   input Option<ArrayDim> inArrayDim;
    4957   output ArrayDim outArrayDim;
     4956  input Option<Absyn.ArrayDim> inArrayDim;
     4957  output Absyn.ArrayDim outArrayDim;
    49584958algorithm
    49594959  outArrayDim := match(inArrayDim)
    4960     local ArrayDim ad;
     4960    local Absyn.ArrayDim ad;
    49614961    case (SOME(ad)) then ad;
    49624962    else {};
     
    49664966public function removeCrefFromCrefs
    49674967"Removes a variable from a variable list"
    4968   input list<ComponentRef> inAbsynComponentRefLst;
    4969   input ComponentRef inComponentRef;
    4970   output list<ComponentRef> outAbsynComponentRefLst;
     4968  input list<Absyn.ComponentRef> inAbsynComponentRefLst;
     4969  input Absyn.ComponentRef inComponentRef;
     4970  output list<Absyn.ComponentRef> outAbsynComponentRefLst;
    49714971algorithm
    49724972  outAbsynComponentRefLst := matchcontinue (inAbsynComponentRefLst,inComponentRef)
    49734973    local
    49744974      String n1,n2;
    4975       list<ComponentRef> rest_1,rest;
    4976       ComponentRef cr1,cr2;
     4975      list<Absyn.ComponentRef> rest_1,rest;
     4976      Absyn.ComponentRef cr1,cr2;
    49774977    case ({},_) then {};
    49784978    case ((cr1 :: rest),cr2)
    49794979      equation
    4980         CREF_IDENT(name = n1,subscripts = {}) = cr1;
    4981         CREF_IDENT(name = n2,subscripts = {}) = cr2;
     4980        Absyn.CREF_IDENT(name = n1,subscripts = {}) = cr1;
     4981        Absyn.CREF_IDENT(name = n2,subscripts = {}) = cr2;
    49824982        true = stringEq(n1, n2);
    49834983        rest_1 = removeCrefFromCrefs(rest, cr2);
     
    49864986    case ((cr1 :: rest),cr2) // If modifier like on comp like: T t(x=t.y) => t.y must be removed
    49874987      equation
    4988         CREF_QUAL(name = n1) = cr1;
    4989         CREF_IDENT(name = n2) = cr2;
     4988        Absyn.CREF_QUAL(name = n1) = cr1;
     4989        Absyn.CREF_IDENT(name = n2) = cr2;
    49904990        true = stringEq(n1, n2);
    49914991        rest_1 = removeCrefFromCrefs(rest, cr2);
     
    50025002public function getNamedAnnotationInClass
    50035003  "Retrieve e.g. the documentation annotation as a string from the class passed as argument."
    5004   input Class inClass;
    5005   input Path id;
     5004  input Absyn.Class inClass;
     5005  input Absyn.Path id;
    50065006  input ModFunc f;
    50075007  output Option<TypeA> outString;
    50085008  partial function ModFunc
    5009     input Option<Modification> mod;
     5009    input Option<Absyn.Modification> mod;
    50105010    output TypeA docStr;
    50115011  end ModFunc;
     
    50145014    local
    50155015      TypeA str,res;
    5016       list<ClassPart> parts;
    5017       list<ElementArg> annlst;
    5018       list<Annotation> ann;
    5019 
    5020     case (CLASS(body = PARTS(ann = ann)),_,_)
     5016      list<Absyn.ClassPart> parts;
     5017      list<Absyn.ElementArg> annlst;
     5018      list<Absyn.Annotation> ann;
     5019
     5020    case (Absyn.CLASS(body = Absyn.PARTS(ann = ann)),_,_)
    50215021      equation
    50225022        annlst = List.flatten(List.map(ann,annotationToElementArgs));
     
    50255025        SOME(str);
    50265026
    5027     case (CLASS(body = CLASS_EXTENDS(ann = ann)),_,_)
     5027    case (Absyn.CLASS(body = Absyn.CLASS_EXTENDS(ann = ann)),_,_)
    50285028      equation
    50295029        annlst = List.flatten(List.map(ann,annotationToElementArgs));
     
    50325032        SOME(str);
    50335033
    5034     case (CLASS(body = DERIVED(comment = SOME(COMMENT(SOME(ANNOTATION(annlst)),_)))),_,_)
     5034    case (Absyn.CLASS(body = Absyn.DERIVED(comment = SOME(Absyn.COMMENT(SOME(Absyn.ANNOTATION(annlst)),_)))),_,_)
    50355035      equation
    50365036        SOME(res) = getNamedAnnotationStr(annlst,id,f);
     
    50385038        SOME(res);
    50395039
    5040     case (CLASS(body = ENUMERATION(comment = SOME(COMMENT(SOME(ANNOTATION(annlst)),_)))),_,_)
     5040    case (Absyn.CLASS(body = Absyn.ENUMERATION(comment = SOME(Absyn.COMMENT(SOME(Absyn.ANNOTATION(annlst)),_)))),_,_)
    50415041      equation
    50425042        SOME(res) = getNamedAnnotationStr(annlst,id,f);
     
    50445044        SOME(res);
    50455045
    5046     case (CLASS(body = OVERLOAD(comment = SOME(COMMENT(SOME(ANNOTATION(annlst)),_)))),_,_)
     5046    case (Absyn.CLASS(body = Absyn.OVERLOAD(comment = SOME(Absyn.COMMENT(SOME(Absyn.ANNOTATION(annlst)),_)))),_,_)
    50475047      equation
    50485048        SOME(res) = getNamedAnnotationStr(annlst,id,f);
     
    50575057protected function getNamedAnnotationStr
    50585058"Helper function to getNamedAnnotationInElementitemlist."
    5059   input list<ElementArg> inAbsynElementArgLst;
    5060   input Path id;
     5059  input list<Absyn.ElementArg> inAbsynElementArgLst;
     5060  input Absyn.Path id;
    50615061  input ModFunc f;
    50625062  output Option<TypeA> outString;
    50635063  partial function ModFunc
    5064     input Option<Modification> mod;
     5064    input Option<Absyn.Modification> mod;
    50655065    output TypeA docStr;
    50665066  end ModFunc;
     
    50695069    local
    50705070      TypeA str;
    5071       ElementArg ann;
    5072       Option<Modification> mod;
    5073       list<ElementArg> xs;
    5074       Ident id1,id2;
    5075       Path rest;
    5076 
    5077     case (((MODIFICATION(path = IDENT(name = id1),modification = mod)) :: _),IDENT(id2),_)
     5071      Absyn.ElementArg ann;
     5072      Option<Absyn.Modification> mod;
     5073      list<Absyn.ElementArg> xs;
     5074      Absyn.Ident id1,id2;
     5075      Absyn.Path rest;
     5076
     5077    case (((Absyn.MODIFICATION(path = Absyn.IDENT(name = id1),modification = mod)) :: _),Absyn.IDENT(id2),_)
    50785078      equation
    50795079        true = stringEq(id1, id2);
     
    50825082        SOME(str);
    50835083
    5084     case (((MODIFICATION(path = IDENT(name = id1),modification = SOME(CLASSMOD(elementArgLst=xs)))) :: _),QUALIFIED(name=id2,path=rest),_)
     5084    case (((Absyn.MODIFICATION(path = Absyn.IDENT(name = id1),modification = SOME(Absyn.CLASSMOD(elementArgLst=xs)))) :: _),Absyn.QUALIFIED(name=id2,path=rest),_)
    50855085      equation
    50865086        true = stringEq(id1, id2);
     
    50945094  "This function splits each part of a cref into CREF_IDENTs and applies the
    50955095   given function to each part. If the given cref is a qualified cref then the
    5096    map function is expected to also return CREF_IDENT, so that the split cref
     5096   map function is expected to also return Absyn.CREF_IDENT, so that the split cref
    50975097   can be reconstructed. Otherwise the map function is free to return whatever
    50985098   it wants."
    5099   input ComponentRef inCref;
     5099  input Absyn.ComponentRef inCref;
    51005100  input MapFunc inMapFunc;
    5101   output ComponentRef outCref;
     5101  output Absyn.ComponentRef outCref;
    51025102
    51035103  partial function MapFunc
    5104     input ComponentRef inCref;
    5105     output ComponentRef outCref;
     5104    input Absyn.ComponentRef inCref;
     5105    output Absyn.ComponentRef outCref;
    51065106  end MapFunc;
    51075107algorithm
    51085108  outCref := match(inCref, inMapFunc)
    51095109    local
    5110       Ident name;
    5111       list<Subscript> subs;
    5112       ComponentRef rest_cref;
    5113       ComponentRef cref;
    5114 
    5115     case (CREF_QUAL(name, subs, rest_cref), _)
    5116       equation
    5117         cref = CREF_IDENT(name, subs);
    5118         CREF_IDENT(name, subs) = inMapFunc(cref);
     5110      Absyn.Ident name;
     5111      list<Absyn.Subscript> subs;
     5112      Absyn.ComponentRef rest_cref;
     5113      Absyn.ComponentRef cref;
     5114
     5115    case (Absyn.CREF_QUAL(name, subs, rest_cref), _)
     5116      equation
     5117        cref = Absyn.CREF_IDENT(name, subs);
     5118        Absyn.CREF_IDENT(name, subs) = inMapFunc(cref);
    51195119        rest_cref = mapCrefParts(rest_cref, inMapFunc);
    51205120      then
    5121         CREF_QUAL(name, subs, rest_cref);
    5122 
    5123     case (CREF_FULLYQUALIFIED(cref), _)
     5121        Absyn.CREF_QUAL(name, subs, rest_cref);
     5122
     5123    case (Absyn.CREF_FULLYQUALIFIED(cref), _)
    51245124      equation
    51255125        cref = mapCrefParts(cref, inMapFunc);
    51265126      then
    5127         CREF_FULLYQUALIFIED(cref);
     5127        Absyn.CREF_FULLYQUALIFIED(cref);
    51285128
    51295129    else
     
    51375137
    51385138public function opEqual
    5139  input Operator op1;
    5140  input Operator op2;
     5139 input Absyn.Operator op1;
     5140 input Absyn.Operator op2;
    51415141 output Boolean isEqual;
    51425142algorithm
     
    51455145
    51465146public function opIsElementWise
    5147  input Operator op;
     5147 input Absyn.Operator op;
    51485148 output Boolean isElementWise;
    51495149algorithm
    51505150  isElementWise := match op
    5151     case ADD_EW() then true;
    5152     case SUB_EW() then true;
    5153     case MUL_EW() then true;
    5154     case DIV_EW() then true;
    5155     case POW_EW() then true;
    5156     case UPLUS_EW() then true;
    5157     case UMINUS_EW() then true;
     5151    case Absyn.ADD_EW() then true;
     5152    case Absyn.SUB_EW() then true;
     5153    case Absyn.MUL_EW() then true;
     5154    case Absyn.DIV_EW() then true;
     5155    case Absyn.POW_EW() then true;
     5156    case Absyn.UPLUS_EW() then true;
     5157    case Absyn.UMINUS_EW() then true;
    51585158    else false;
    51595159  end match;
     
    51615161
    51625162protected function dummyTraverseExp
    5163   input Exp inExp;
     5163  input Absyn.Exp inExp;
    51645164  input Arg inArg;
    5165   output Exp outExp;
     5165  output Absyn.Exp outExp;
    51665166  output Arg outArg;
    51675167algorithm
     
    51715171
    51725172public function getDefineUnitsInElements "retrives defineunit definitions in elements"
    5173   input list<ElementItem> elts;
    5174   output list<Element> outElts;
     5173  input list<Absyn.ElementItem> elts;
     5174  output list<Absyn.Element> outElts;
    51755175algorithm
    51765176  outElts := matchcontinue(elts)
    51775177    local
    5178       Element e;
    5179       list<ElementItem> rest;
     5178      Absyn.Element e;
     5179      list<Absyn.ElementItem> rest;
    51805180    case {} then {};
    5181     case (ELEMENTITEM(e as DEFINEUNIT())::rest)
     5181    case (Absyn.ELEMENTITEM(e as Absyn.DEFINEUNIT())::rest)
    51825182      equation
    51835183        outElts = getDefineUnitsInElements(rest);
     
    51905190public function getElementItemsInClass
    51915191  "Returns the public and protected elements in a class."
    5192   input Class inClass;
    5193   output list<ElementItem> outElements;
     5192  input Absyn.Class inClass;
     5193  output list<Absyn.ElementItem> outElements;
    51945194algorithm
    51955195  outElements := match(inClass)
    51965196    local
    5197       list<ClassPart> parts;
    5198 
    5199     case CLASS(body = PARTS(classParts = parts))
     5197      list<Absyn.ClassPart> parts;
     5198
     5199    case Absyn.CLASS(body = Absyn.PARTS(classParts = parts))
    52005200      then List.mapFlat(parts, getElementItemsInClassPart);
    52015201
    5202     case CLASS(body = CLASS_EXTENDS(parts = parts))
     5202    case Absyn.CLASS(body = Absyn.CLASS_EXTENDS(parts = parts))
    52035203      then List.mapFlat(parts, getElementItemsInClassPart);
    52045204
     
    52105210public function getElementItemsInClassPart
    52115211  "Returns the public and protected elements in a class part."
    5212   input ClassPart inClassPart;
    5213   output list<ElementItem> outElements;
     5212  input Absyn.ClassPart inClassPart;
     5213  output list<Absyn.ElementItem> outElements;
    52145214algorithm
    52155215  outElements := match(inClassPart)
    52165216    local
    5217       list<ElementItem> elts;
    5218 
    5219     case PUBLIC(contents = elts) then elts;
    5220     case PROTECTED(contents = elts) then elts;
     5217      list<Absyn.ElementItem> elts;
     5218
     5219    case Absyn.PUBLIC(contents = elts) then elts;
     5220    case Absyn.PROTECTED(contents = elts) then elts;
    52215221    else {};
    52225222  end match;
     
    52245224
    52255225public function traverseClassComponents<ArgT>
    5226   input Class inClass;
     5226  input Absyn.Class inClass;
    52275227  input FuncType inFunc;
    52285228  input ArgT inArg;
    5229   output Class outClass = inClass;
     5229  output Absyn.Class outClass = inClass;
    52305230  output ArgT outArg;
    52315231
    52325232  partial function FuncType
    5233     input list<ComponentItem> inComponents;
     5233    input list<Absyn.ComponentItem> inComponents;
    52345234    input ArgT inArg;
    5235     output list<ComponentItem> outComponents;
     5235    output list<Absyn.ComponentItem> outComponents;
    52365236    output ArgT outArg;
    52375237    output Boolean outContinue;
     
    52405240  outClass := match(outClass)
    52415241    local
    5242       ClassDef body;
    5243 
    5244     case CLASS()
     5242      Absyn.ClassDef body;
     5243
     5244    case Absyn.CLASS()
    52455245      algorithm
    52465246        (body, outArg) := traverseClassDef(outClass.body,
     
    52905290
    52915291protected function traverseClassPartComponents<ArgT>
    5292   input ClassPart inClassPart;
     5292  input Absyn.ClassPart inClassPart;
    52935293  input FuncType inFunc;
    52945294  input ArgT inArg;
    5295   output ClassPart outClassPart = inClassPart;
     5295  output Absyn.ClassPart outClassPart = inClassPart;
    52965296  output ArgT outArg = inArg;
    52975297  output Boolean outContinue = true;
    52985298
    52995299  partial function FuncType
    5300     input list<ComponentItem> inComponents;
     5300    input list<Absyn.ComponentItem> inComponents;
    53015301    input ArgT inArg;
    5302     output list<ComponentItem> outComponents;
     5302    output list<Absyn.ComponentItem> outComponents;
    53035303    output ArgT outArg;
    53045304    output Boolean outContinue;
     
    53075307  _ := match(outClassPart)
    53085308    local
    5309       list<ElementItem> items;
    5310 
    5311     case PUBLIC()
     5309      list<Absyn.ElementItem> items;
     5310
     5311    case Absyn.PUBLIC()
    53125312      algorithm
    53135313        (items, outArg, outContinue) :=
     
    53185318        ();
    53195319
    5320     case PROTECTED()
     5320    case Absyn.PROTECTED()
    53215321      algorithm
    53225322        (items, outArg, outContinue) :=
     
    53325332
    53335333protected function traverseElementItemComponents<ArgT>
    5334   input ElementItem inItem;
     5334  input Absyn.ElementItem inItem;
    53355335  input FuncType inFunc;
    53365336  input ArgT inArg;
    5337   output ElementItem outItem;
     5337  output Absyn.ElementItem outItem;
    53385338  output ArgT outArg;
    53395339  output Boolean outContinue;
    53405340
    53415341  partial function FuncType
    5342     input list<ComponentItem> inComponents;
     5342    input list<Absyn.ComponentItem> inComponents;
    53435343    input ArgT inArg;
    5344     output list<ComponentItem> outComponents;
     5344    output list<Absyn.ComponentItem> outComponents;
    53455345    output ArgT outArg;
    53465346    output Boolean outContinue;
     
    53495349  (outItem, outArg, outContinue) := match(inItem)
    53505350    local
    5351       Element elem;
    5352 
    5353     case ELEMENTITEM()
     5351      Absyn.Element elem;
     5352
     5353    case Absyn.ELEMENTITEM()
    53545354      algorithm
    53555355        (elem, outArg, outContinue) := traverseElementComponents(inItem.element,
    53565356          inFunc, inArg);
    5357         outItem := if referenceEq(elem, inItem.element) then inItem else ELEMENTITEM(elem);
     5357        outItem := if referenceEq(elem, inItem.element) then inItem else Absyn.ELEMENTITEM(elem);
    53585358      then
    53595359        (outItem, outArg, outContinue);
     
    53645364
    53655365protected function traverseElementComponents<ArgT>
    5366   input Element inElement;
     5366  input Absyn.Element inElement;
    53675367  input FuncType inFunc;
    53685368  input ArgT inArg;
    5369   output Element outElement = inElement;
     5369  output Absyn.Element outElement = inElement;
    53705370  output ArgT outArg;
    53715371  output Boolean outContinue;
    53725372
    53735373  partial function FuncType
    5374     input list<ComponentItem> inComponents;
     5374    input list<Absyn.ComponentItem> inComponents;
    53755375    input ArgT inArg;
    5376     output list<ComponentItem> outComponents;
     5376    output list<Absyn.ComponentItem> outComponents;
    53775377    output ArgT outArg;
    53785378    output Boolean outContinue;
     
    53815381  (outElement, outArg, outContinue) := match(outElement)
    53825382    local
    5383       ElementSpec spec;
    5384 
    5385     case ELEMENT()
     5383      Absyn.ElementSpec spec;
     5384
     5385    case Absyn.ELEMENT()
    53865386      algorithm
    53875387        (spec, outArg, outContinue) := traverseElementSpecComponents(
     
    53995399
    54005400protected function traverseElementSpecComponents<ArgT>
    5401   input ElementSpec inSpec;
     5401  input Absyn.ElementSpec inSpec;
    54025402  input FuncType inFunc;
    54035403  input ArgT inArg;
    5404   output ElementSpec outSpec = inSpec;
     5404  output Absyn.ElementSpec outSpec = inSpec;
    54055405  output ArgT outArg;
    54065406  output Boolean outContinue;
    54075407
    54085408  partial function FuncType
    5409     input list<ComponentItem> inComponents;
     5409    input list<Absyn.ComponentItem> inComponents;
    54105410    input ArgT inArg;
    5411     output list<ComponentItem> outComponents;
     5411    output list<Absyn.ComponentItem> outComponents;
    54125412    output ArgT outArg;
    54135413    output Boolean outContinue;
     
    54165416  (outSpec, outArg, outContinue) := match(outSpec)
    54175417    local
    5418       Class cls;
    5419       list<ComponentItem> comps;
    5420 
    5421     case COMPONENTS()
     5418      Absyn.Class cls;
     5419      list<Absyn.ComponentItem> comps;
     5420
     5421    case Absyn.COMPONENTS()
    54225422      algorithm
    54235423        (comps, outArg, outContinue) := inFunc(outSpec.components, inArg);
     
    54335433
    54345434protected function traverseClassDef<ArgT>
    5435   input ClassDef inClassDef;
     5435  input Absyn.ClassDef inClassDef;
    54365436  input FuncType inFunc;
    54375437  input ArgT inArg;
    5438   output ClassDef outClassDef = inClassDef;
     5438  output Absyn.ClassDef outClassDef = inClassDef;
    54395439  output ArgT outArg = inArg;
    54405440  output Boolean outContinue = true;
    54415441
    54425442  partial function FuncType
    5443     input ClassPart inPart;
     5443    input Absyn.ClassPart inPart;
    54445444    input ArgT inArg;
    5445     output ClassPart outPart;
     5445    output Absyn.ClassPart outPart;
    54465446    output ArgT outArg;
    54475447    output Boolean outContinue;
     
    54505450  _ := match(outClassDef)
    54515451    local
    5452       list<ClassPart> parts;
    5453 
    5454     case PARTS()
     5452      list<Absyn.ClassPart> parts;
     5453
     5454    case Absyn.PARTS()
    54555455      algorithm
    54565456        (parts, outArg, outContinue) :=
     
    54605460        ();
    54615461
    5462     case CLASS_EXTENDS()
     5462    case Absyn.CLASS_EXTENDS()
    54635463      algorithm
    54645464        (parts, outArg, outContinue) :=
     
    54735473
    54745474public function isEmptyMod
    5475   input Modification inMod;
     5475  input Absyn.Modification inMod;
    54765476  output Boolean outIsEmpty;
    54775477algorithm
    54785478  outIsEmpty := match inMod
    5479     case CLASSMOD({}, NOMOD()) then true;
    5480     case CLASSMOD({}, EQMOD(exp = TUPLE(expressions = {}))) then true;
     5479    case Absyn.CLASSMOD({}, Absyn.NOMOD()) then true;
     5480    case Absyn.CLASSMOD({}, Absyn.EQMOD(exp = Absyn.TUPLE(expressions = {}))) then true;
    54815481    else false;
    54825482  end match;
     
    54845484
    54855485public function isEmptySubMod
    5486   input ElementArg inSubMod;
     5486  input Absyn.ElementArg inSubMod;
    54875487  output Boolean outIsEmpty;
    54885488algorithm
    54895489  outIsEmpty := match inSubMod
    54905490    local
    5491       Modification mod;
    5492 
    5493     case MODIFICATION(modification = NONE()) then true;
    5494     case MODIFICATION(modification = SOME(mod)) then isEmptyMod(mod);
     5491      Absyn.Modification mod;
     5492
     5493    case Absyn.MODIFICATION(modification = NONE()) then true;
     5494    case Absyn.MODIFICATION(modification = SOME(mod)) then isEmptyMod(mod);
    54955495  end match;
    54965496end isEmptySubMod;
    54975497
    54985498public function elementArgName
    5499   input ElementArg inArg;
    5500   output Path outName;
     5499  input Absyn.ElementArg inArg;
     5500  output Absyn.Path outName;
    55015501algorithm
    55025502  outName := match(inArg)
    55035503    local
    5504       ElementSpec e;
    5505     case MODIFICATION(path = outName) then outName;
    5506     case REDECLARATION(elementSpec = e) then makeIdentPathFromString(elementSpecName(e));
     5504      Absyn.ElementSpec e;
     5505    case Absyn.MODIFICATION(path = outName) then outName;
     5506    case Absyn.REDECLARATION(elementSpec = e) then makeIdentPathFromString(elementSpecName(e));
    55075507  end match;
    55085508end elementArgName;
    55095509
    55105510public function elementArgEqualName
    5511   input ElementArg inArg1;
    5512   input ElementArg inArg2;
     5511  input Absyn.ElementArg inArg1;
     5512  input Absyn.ElementArg inArg2;
    55135513  output Boolean outEqual;
    55145514protected
    5515   Path name1, name2;
     5515  Absyn.Path name1, name2;
    55165516algorithm
    55175517  outEqual := match(inArg1, inArg2)
    5518     case (MODIFICATION(path = name1), MODIFICATION(path = name2))
     5518    case (Absyn.MODIFICATION(path = name1), Absyn.MODIFICATION(path = name2))
    55195519      then pathEqual(name1, name2);
    55205520
     
    55245524
    55255525public function optMsg
    5526   "Creates a Msg based on a boolean value."
     5526  "Creates a Absyn.Msg based on a boolean value."
    55275527  input Boolean inShowMessage;
    55285528  input SourceInfo inInfo;
    5529   output Msg outMsg;
    5530 algorithm
    5531   outMsg := if inShowMessage then MSG(inInfo) else NO_MSG();
     5529  output Absyn.Msg outMsg;
     5530algorithm
     5531  outMsg := if inShowMessage then Absyn.MSG(inInfo) else Absyn.NO_MSG();
    55325532  annotation(__OpenModelica_EarlyInline = true);
    55335533end optMsg;
    55345534
    55355535public function makeSubscript
    5536   input Exp inExp;
    5537   output Subscript outSubscript;
    5538 algorithm
    5539   outSubscript := SUBSCRIPT(inExp);
     5536  input Absyn.Exp inExp;
     5537  output Absyn.Subscript outSubscript;
     5538algorithm
     5539  outSubscript := Absyn.SUBSCRIPT(inExp);
    55405540end makeSubscript;
    55415541
    55425542public function crefExplode
    55435543  "Splits a cref into parts."
    5544   input ComponentRef inCref;
    5545   input list<ComponentRef> inAccum = {};
    5546   output list<ComponentRef> outCrefParts;
     5544  input Absyn.ComponentRef inCref;
     5545  input list<Absyn.ComponentRef> inAccum = {};
     5546  output list<Absyn.ComponentRef> outCrefParts;
    55475547algorithm
    55485548  outCrefParts := match inCref
    5549     case CREF_QUAL() then crefExplode(inCref.componentRef, crefFirstCref(inCref) :: inAccum);
    5550     case CREF_FULLYQUALIFIED() then crefExplode(inCref.componentRef, inAccum);
     5549    case Absyn.CREF_QUAL() then crefExplode(inCref.componentRef, crefFirstCref(inCref) :: inAccum);
     5550    case Absyn.CREF_FULLYQUALIFIED() then crefExplode(inCref.componentRef, inAccum);
    55515551    else listReverse(inCref :: inAccum);
    55525552  end match;
     
    55565556  "Calls the given function on each subexpression (non-recursively) of the given
    55575557   expression, sending in the extra argument to each call."
    5558   input Exp inExp;
     5558  input Absyn.Exp inExp;
    55595559  input ArgT inArg;
    55605560  input FuncT inFunc;
    5561   output Exp outExp = inExp;
     5561  output Absyn.Exp outExp = inExp;
    55625562
    55635563  partial function FuncT
    5564     input Exp inExp;
     5564    input Absyn.Exp inExp;
    55655565    input ArgT inArg;
    5566     output Exp outExp;
     5566    output Absyn.Exp outExp;
    55675567  end FuncT;
    55685568algorithm
    55695569  _ := match outExp
    55705570    local
    5571       Exp e1, e2;
    5572 
    5573     case BINARY()
     5571      Absyn.Exp e1, e2;
     5572
     5573    case Absyn.BINARY()
    55745574      algorithm
    55755575        outExp.exp1 := inFunc(outExp.exp1, inArg);
     
    55785578        ();
    55795579
    5580     case UNARY()
     5580    case Absyn.UNARY()
    55815581      algorithm
    55825582        outExp.exp := inFunc(outExp.exp, inArg);
     
    55845584        ();
    55855585
    5586     case LBINARY()
     5586    case Absyn.LBINARY()
    55875587      algorithm
    55885588        outExp.exp1 := inFunc(outExp.exp1, inArg);
     
    55915591        ();
    55925592
    5593     case LUNARY()
     5593    case Absyn.LUNARY()
    55945594      algorithm
    55955595        outExp.exp := inFunc(outExp.exp, inArg);
     
    55975597        ();
    55985598
    5599     case RELATION()
     5599    case Absyn.RELATION()
    56005600      algorithm
    56015601        outExp.exp1 := inFunc(outExp.exp1, inArg);
     
    56045604        ();
    56055605
    5606     case IFEXP()
     5606    case Absyn.IFEXP()
    56075607      algorithm
    56085608        outExp.ifExp := inFunc(outExp.ifExp, inArg);
     
    56145614        ();
    56155615
    5616     case CALL()
     5616    case Absyn.CALL()
    56175617      algorithm
    56185618        outExp.functionArgs := traverseExpShallowFuncArgs(outExp.functionArgs,
     
    56215621        ();
    56225622
    5623     case PARTEVALFUNCTION()
     5623    case Absyn.PARTEVALFUNCTION()
    56245624      algorithm
    56255625        outExp.functionArgs := traverseExpShallowFuncArgs(outExp.functionArgs,
     
    56285628        ();
    56295629
    5630     case ARRAY()
     5630    case Absyn.ARRAY()
    56315631      algorithm
    56325632        outExp.arrayExp := list(inFunc(e, inArg) for e in outExp.arrayExp);
     
    56345634        ();
    56355635
    5636     case MATRIX()
     5636    case Absyn.MATRIX()
    56375637      algorithm
    56385638        outExp.matrix := list(list(inFunc(e, inArg) for e in lst) for lst in
     
    56415641        ();
    56425642
    5643     case RANGE()
     5643    case Absyn.RANGE()
    56445644      algorithm
    56455645        outExp.start := inFunc(outExp.start, inArg);
     
    56495649        ();
    56505650
    5651     case TUPLE()
     5651    case Absyn.TUPLE()
    56525652      algorithm
    56535653        outExp.expressions := list(inFunc(e, inArg) for e in outExp.expressions);
     
    56555655        ();
    56565656
    5657     case AS()
     5657    case Absyn.AS()
    56585658      algorithm
    56595659        outExp.exp := inFunc(outExp.exp, inArg);
     
    56615661        ();
    56625662
    5663     case CONS()
     5663    case Absyn.CONS()
    56645664      algorithm
    56655665        outExp.head := inFunc(outExp.head, inArg);
     
    56685668        ();
    56695669
    5670     case LIST()
     5670    case Absyn.LIST()
    56715671      algorithm
    56725672        outExp.exps := list(inFunc(e, inArg) for e in outExp.exps);
     
    56745674        ();
    56755675
    5676     case DOT()
     5676    case Absyn.DOT()
    56775677      algorithm
    56785678        outExp.exp := inFunc(outExp.exp, inArg);
     
    56865686
    56875687protected function traverseExpShallowFuncArgs<ArgT>
    5688   input FunctionArgs inArgs;
     5688  input Absyn.FunctionArgs inArgs;
    56895689  input ArgT inArg;
    56905690  input FuncT inFunc;
    5691   output FunctionArgs outArgs = inArgs;
     5691  output Absyn.FunctionArgs outArgs = inArgs;
    56925692
    56935693  partial function FuncT
    5694     input Exp inExp;
     5694    input Absyn.Exp inExp;
    56955695    input ArgT inArg;
    5696     output Exp outExp;
     5696    output Absyn.Exp outExp;
    56975697  end FuncT;
    56985698algorithm
    56995699  outArgs := match outArgs
    5700     case FUNCTIONARGS()
     5700    case Absyn.FUNCTIONARGS()
    57015701      algorithm
    57025702        outArgs.args := list(inFunc(arg, inArg) for arg in outArgs.args);
     
    57045704        outArgs;
    57055705
    5706     case FOR_ITER_FARG()
     5706    case Absyn.FOR_ITER_FARG()
    57075707      algorithm
    57085708        outArgs.exp := inFunc(outArgs.exp, inArg);
     
    57165716
    57175717protected function traverseExpShallowIterator<ArgT>
    5718   input ForIterator inIterator;
     5718  input Absyn.ForIterator inIterator;
    57195719  input ArgT inArg;
    57205720  input FuncT inFunc;
    5721   output ForIterator outIterator;
     5721  output Absyn.ForIterator outIterator;
    57225722
    57235723  partial function FuncT
    5724     input Exp inExp;
     5724    input Absyn.Exp inExp;
    57255725    input ArgT inArg;
    5726     output Exp outExp;
     5726    output Absyn.Exp outExp;
    57275727  end FuncT;
    57285728protected
    57295729  String name;
    5730   Option<Exp> guard_exp, range_exp;
    5731 algorithm
    5732   ITERATOR(name, guard_exp, range_exp) := inIterator;
     5730  Option<Absyn.Exp> guard_exp, range_exp;
     5731algorithm
     5732  Absyn.ITERATOR(name, guard_exp, range_exp) := inIterator;
    57335733  guard_exp := Util.applyOption1(guard_exp, inFunc, inArg);
    57345734  range_exp := Util.applyOption1(range_exp, inFunc, inArg);
    5735   outIterator := ITERATOR(name, guard_exp, range_exp);
     5735  outIterator := Absyn.ITERATOR(name, guard_exp, range_exp);
    57365736end traverseExpShallowIterator;
    57375737
    57385738public function isElementItemClass
    5739   input ElementItem inElement;
     5739  input Absyn.ElementItem inElement;
    57405740  output Boolean outIsClass;
    57415741algorithm
    57425742  outIsClass := match inElement
    5743     case ELEMENTITEM(element = ELEMENT(specification = CLASSDEF())) then true;
     5743    case Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF())) then true;
    57445744    else false;
    57455745  end match;
     
    57475747
    57485748public function isElementItem
    5749   input ElementItem inElement;
     5749  input Absyn.ElementItem inElement;
    57505750  output Boolean outIsClass;
    57515751algorithm
    57525752  outIsClass := match inElement
    5753     case ELEMENTITEM() then true;
     5753    case Absyn.ELEMENTITEM() then true;
    57545754    else false;
    57555755  end match;
     
    57575757
    57585758public function isAlgorithmItem
    5759   input AlgorithmItem inAlg;
     5759  input Absyn.AlgorithmItem inAlg;
    57605760  output Boolean outIsClass;
    57615761algorithm
    57625762  outIsClass := match inAlg
    5763     case ALGORITHMITEM() then true;
     5763    case Absyn.ALGORITHMITEM() then true;
    57645764    else false;
    57655765  end match;
     
    57685768public function isElementItemClassNamed
    57695769  input String inName;
    5770   input ElementItem inElement;
     5770  input Absyn.ElementItem inElement;
    57715771  output Boolean outIsNamed;
    57725772algorithm
     
    57755775      String name;
    57765776
    5777     case ELEMENTITEM(element = ELEMENT(specification = CLASSDEF(
    5778       class_ = CLASS(name = name)))) then name == inName;
     5777    case Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(
     5778      class_ = Absyn.CLASS(name = name)))) then name == inName;
    57795779    else false;
    57805780  end match;
     
    57825782
    57835783public function isEmptyClassPart
    5784   input ClassPart inClassPart;
     5784  input Absyn.ClassPart inClassPart;
    57855785  output Boolean outIsEmpty;
    57865786algorithm
    57875787  outIsEmpty := match inClassPart
    5788     case PUBLIC(contents = {}) then true;
    5789     case PROTECTED(contents = {}) then true;
    5790     case CONSTRAINTS(contents = {}) then true;
    5791     case EQUATIONS(contents = {}) then true;
    5792     case INITIALEQUATIONS(contents = {}) then true;
    5793     case ALGORITHMS(contents = {}) then true;
    5794     case INITIALALGORITHMS(contents = {}) then true;
     5788    case Absyn.PUBLIC(contents = {}) then true;
     5789    case Absyn.PROTECTED(contents = {}) then true;
     5790    case Absyn.CONSTRAINTS(contents = {}) then true;
     5791    case Absyn.EQUATIONS(contents = {}) then true;
     5792    case Absyn.INITIALEQUATIONS(contents = {}) then true;
     5793    case Absyn.ALGORITHMS(contents = {}) then true;
     5794    case Absyn.INITIALALGORITHMS(contents = {}) then true;
    57955795    else false;
    57965796  end match;
     
    58055805  end if;
    58065806  b := match e
    5807     case INTEGER() then true;
    5808     case REAL() then true;
    5809     case STRING() then true;
    5810     case BOOL() then true;
    5811     case BINARY() then true;
    5812     case UNARY() then true;
    5813     case LBINARY() then true;
    5814     case LUNARY() then true;
    5815     case RELATION() then true;
    5816     case IFEXP() then true;
    5817     // case CREF(CREF_FULLYQUALIFIED()) then true;
    5818     case CALL(function_=CREF_FULLYQUALIFIED()) then true;
    5819     case PARTEVALFUNCTION(function_=CREF_FULLYQUALIFIED()) then true;
    5820     case ARRAY() then true;
    5821     case MATRIX() then true;
    5822     case RANGE() then true;
    5823     case CONS() then true;
    5824     case LIST() then true;
     5807    case Absyn.INTEGER() then true;
     5808    case Absyn.REAL() then true;
     5809    case Absyn.STRING() then true;
     5810    case Absyn.BOOL() then true;
     5811    case Absyn.BINARY() then true;
     5812    case Absyn.UNARY() then true;
     5813    case Absyn.LBINARY() then true;
     5814    case Absyn.LUNARY() then true;
     5815    case Absyn.RELATION() then true;
     5816    case Absyn.IFEXP() then true;
     5817    // case Absyn.CREF(Absyn.CREF_FULLYQUALIFIED()) then true;
     5818    case Absyn.CALL(function_=Absyn.CREF_FULLYQUALIFIED()) then true;
     5819    case Absyn.PARTEVALFUNCTION(function_=Absyn.CREF_FULLYQUALIFIED()) then true;
     5820    case Absyn.ARRAY() then true;
     5821    case Absyn.MATRIX() then true;
     5822    case Absyn.RANGE() then true;
     5823    case Absyn.CONS() then true;
     5824    case Absyn.LIST() then true;
    58255825    else false;
    58265826  end match;
     
    58295829function pathPartCount
    58305830  "Returns the number of parts a path consists of, e.g. A.B.C gives 3."
    5831   input Path path;
     5831  input Absyn.Path path;
    58325832  input Integer partsAccum = 0;
    58335833  output Integer parts;
    58345834algorithm
    58355835  parts := match path
    5836     case Path.IDENT() then partsAccum + 1;
    5837     case Path.QUALIFIED() then pathPartCount(path.path, partsAccum + 1);
    5838     case Path.FULLYQUALIFIED() then pathPartCount(path.path, partsAccum);
     5836    case Absyn.IDENT() then partsAccum + 1;
     5837    case Absyn.QUALIFIED() then pathPartCount(path.path, partsAccum + 1);
     5838    case Absyn.FULLYQUALIFIED() then pathPartCount(path.path, partsAccum);
    58395839  end match;
    58405840end pathPartCount;
    58415841
    58425842public function getAnnotationsFromConstraintClass
    5843   input Option<ConstrainClass> inCC;
    5844   output list<ElementArg> outElArgLst;
     5843  input Option<Absyn.ConstrainClass> inCC;
     5844  output list<Absyn.ElementArg> outElArgLst;
    58455845algorithm
    58465846  outElArgLst := match(inCC)
    5847     local list<ElementArg> elementArgs;
    5848     case SOME(CONSTRAINCLASS(comment = SOME(COMMENT(annotation_ = SOME(ANNOTATION(elementArgs))))))
     5847    local list<Absyn.ElementArg> elementArgs;
     5848    case SOME(Absyn.CONSTRAINCLASS(comment = SOME(Absyn.COMMENT(annotation_ = SOME(Absyn.ANNOTATION(elementArgs))))))
    58495849      then elementArgs;
    58505850    else {};
     
    58535853
    58545854public function getAnnotationsFromItems
    5855   input list<ComponentItem> inComponentItems;
    5856   input list<ElementArg> ccAnnotations;
    5857   output list<list<ElementArg>> outLst = {};
     5855  input list<Absyn.ComponentItem> inComponentItems;
     5856  input list<Absyn.ElementArg> ccAnnotations;
     5857  output list<list<Absyn.ElementArg>> outLst = {};
    58585858protected
    58595859  list<Absyn.ElementArg> annotations;
     
    58745874
    58755875public function stripGraphicsAndInteractionModification
    5876 " This function strips out the `graphics\' modification from an ElementArg
     5876" This function strips out the `graphics\' modification from an Absyn.ElementArg
    58775877   list and return two lists, one with the other modifications and the
    58785878   second with the `graphics\' modification"
     
    63416341public function getTypeSpecFromElementItemOpt
    63426342"@auhtor: johti
    6343  Get the typespec path in an ElementItem if it has one"
     6343 Get the typespec path in an Absyn.ElementItem if it has one"
    63446344  input Absyn.ElementItem inElementItem;
    63456345  output Option<Absyn.TypeSpec> outTypeSpec;
     
    63626362public function getElementSpecificationFromElementItemOpt
    63636363  "@auhtor: johti
    6364      Get a ComponentItem from an ElementItem if it has one"
     6364     Get a Absyn.ComponentItem from an Absyn.ElementItem if it has one"
    63656365  input Absyn.ElementItem inElementItem;
    63666366  output Option<Absyn.ElementSpec> outSpec;
     
    64066406public function getDirection
    64076407"@author johti
    6408   Get the direction if one exists otherwise returns BIDIR()"
     6408  Get the direction if one exists otherwise returns Absyn.BIDIR()"
    64096409  input Absyn.ElementItem elementItem;
    6410   output Direction oDirection;
     6410  output Absyn.Direction oDirection;
    64116411algorithm
    64126412  oDirection:= matchcontinue elementItem
    6413     local Element element;
    6414     case ELEMENTITEM(element = element) then match element
    6415       local ElementSpec specification;
    6416       case ELEMENT(specification=specification) then match specification
    6417         local ElementAttributes attributes;
    6418         case COMPONENTS(attributes=attributes) then match attributes
    6419           local Direction direction;
    6420           case ATTR(direction=direction) then direction;
     6413    local Absyn.Element element;
     6414    case Absyn.ELEMENTITEM(element = element) then match element
     6415      local Absyn.ElementSpec specification;
     6416      case Absyn.ELEMENT(specification=specification) then match specification
     6417        local Absyn.ElementAttributes attributes;
     6418        case Absyn.COMPONENTS(attributes=attributes) then match attributes
     6419          local Absyn.Direction direction;
     6420          case Absyn.ATTR(direction=direction) then direction;
    64216421        end match;
    64226422      end match;
    64236423    end match;
    6424     else BIDIR();
     6424    else Absyn.BIDIR();
    64256425  end matchcontinue;
    64266426end getDirection;
     
    64326432algorithm
    64336433  res := match path
    6434     case IDENT() then path.name == name;
     6434    case Absyn.IDENT() then path.name == name;
    64356435    else false;
    64366436  end match;
     
    64446444algorithm
    64456445  b := match cls.restriction
    6446     case R_UNIONTYPE(__) then true;
     6446    case Absyn.R_UNIONTYPE(__) then true;
    64476447    else false;
    64486448 end match;
     
    64506450
    64516451public function traverseClassElements<ArgT>
    6452   input Class inClass;
     6452  input Absyn.Class inClass;
    64536453  input FuncType inFunc;
    64546454  input ArgT inArg;
    6455   output Class outClass = inClass;
     6455  output Absyn.Class outClass = inClass;
    64566456  output ArgT outArg;
    64576457
    64586458  partial function FuncType
    6459     input Element inElement;
     6459    input Absyn.Element inElement;
    64606460    input ArgT inArg;
    6461     output Element outElement;
     6461    output Absyn.Element outElement;
    64626462    output ArgT outArg;
    64636463    output Boolean outContinue;
     
    64666466  outClass := match(outClass)
    64676467    local
    6468       ClassDef body;
    6469 
    6470     case CLASS()
     6468      Absyn.ClassDef body;
     6469
     6470    case Absyn.CLASS()
    64716471      algorithm
    64726472        (body, outArg) := traverseClassDef(outClass.body,
     
    64806480
    64816481protected function traverseClassPartElements<ArgT>
    6482   input ClassPart inClassPart;
     6482  input Absyn.ClassPart inClassPart;
    64836483  input FuncType inFunc;
    64846484  input ArgT inArg;
    6485   output ClassPart outClassPart = inClassPart;
     6485  output Absyn.ClassPart outClassPart = inClassPart;
    64866486  output ArgT outArg = inArg;
    64876487  output Boolean outContinue = true;
    64886488
    64896489  partial function FuncType
    6490     input Element inElement;
     6490    input Absyn.Element inElement;
    64916491    input ArgT inArg;
    6492     output Element outElement;
     6492    output Absyn.Element outElement;
    64936493    output ArgT outArg;
    64946494    output Boolean outContinue;
     
    64976497  _ := match(outClassPart)
    64986498    local
    6499       list<ElementItem> items;
    6500 
    6501     case PUBLIC()
     6499      list<Absyn.ElementItem> items;
     6500
     6501    case Absyn.PUBLIC()
    65026502      algorithm
    65036503        (items, outArg, outContinue) :=
     
    65086508        ();
    65096509
    6510     case PROTECTED()
     6510    case Absyn.PROTECTED()
    65116511      algorithm
    65126512        (items, outArg, outContinue) :=
     
    65226522
    65236523protected function traverseElementItem<ArgT>
    6524   input ElementItem inItem;
     6524  input Absyn.ElementItem inItem;
    65256525  input FuncType inFunc;
    65266526  input ArgT inArg;
    6527   output ElementItem outItem;
     6527  output Absyn.ElementItem outItem;
    65286528  output ArgT outArg;
    65296529  output Boolean outContinue;
    65306530
    65316531  partial function FuncType
    6532     input Element inElement;
     6532    input Absyn.Element inElement;
    65336533    input ArgT inArg;
    6534     output Element outElement;
     6534    output Absyn.Element outElement;
    65356535    output ArgT outArg;
    65366536    output Boolean outContinue;
     
    65396539  (outItem, outArg, outContinue) := match(inItem)
    65406540    local
    6541       Element elem;
    6542 
    6543     case ELEMENTITEM()
     6541      Absyn.Element elem;
     6542
     6543    case Absyn.ELEMENTITEM()
    65446544      algorithm
    65456545        (elem, outArg, outContinue) := inFunc(inItem.element, inArg);
    6546         outItem := if referenceEq(elem, inItem.element) then inItem else ELEMENTITEM(elem);
     6546        outItem := if referenceEq(elem, inItem.element) then inItem else Absyn.ELEMENTITEM(elem);
    65476547      then
    65486548        (outItem, outArg, outContinue);
     
    65536553
    65546554public function elementSpec
    6555   input Element el;
    6556   output ElementSpec elSpec;
    6557 algorithm
    6558   ELEMENT(specification = elSpec) := el;
     6555  input Absyn.Element el;
     6556  output Absyn.ElementSpec elSpec;
     6557algorithm
     6558  Absyn.ELEMENT(specification = elSpec) := el;
    65596559end elementSpec;
    65606560
    65616561public function isClassOrComponentElementSpec
    6562   "The ElementSpec type contains the name of the element, and this function
     6562  "The Absyn.ElementSpec type contains the name of the element, and this function
    65636563   extracts this name."
    6564   input ElementSpec inElementSpec;
     6564  input Absyn.ElementSpec inElementSpec;
    65656565  output Boolean yes = false;
    65666566algorithm
    65676567  yes := match (inElementSpec)
    6568     case CLASSDEF(class_ = CLASS()) then true;
    6569     case COMPONENTS(components = {COMPONENTITEM()}) then true;
     6568    case Absyn.CLASSDEF(class_ = Absyn.CLASS()) then true;
     6569    case Absyn.COMPONENTS(components = {Absyn.COMPONENTITEM()}) then true;
    65706570    else false;
    65716571  end match;
Note: See TracChangeset for help on using the changeset viewer.