Skip to content

Commit

Permalink
Added a Absyn function to strip last cref of a qualified cref
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5012 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Björn Zachrisson committed Feb 23, 2010
1 parent 118e693 commit c380238
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions Compiler/Absyn.mo
Expand Up @@ -2764,6 +2764,29 @@ algorithm
end matchcontinue;
end stripLast;

public function stripLastCref "function: stripLast
Returns the path given as argument to
the function minus the last ident."
input ComponentRef inPath;
output ComponentRef outPath;
algorithm
outPath:=
matchcontinue (inPath)
local
Ident str;
ComponentRef p_1,p;
list<Subscript> subs;
case (CREF_IDENT(name = _)) then fail();
case (CREF_QUAL(name = str,subScripts = subs, componentRef = CREF_IDENT(name = _))) then CREF_IDENT(str,subs);
case (CREF_QUAL(name = str,subScripts = subs,componentRef = p))
equation
p_1 = stripLastCref(p);
then
CREF_QUAL(str,subs,p_1);
end matchcontinue;
end stripLastCref;


public function splitQualAndIdentPath "
Author BZ 2008-04
Function for splitting Absynpath into two parts,
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Util.mo
Expand Up @@ -4180,8 +4180,8 @@ algorithm
*/
end stringAppendList;

public function stringAppendList_tail
"@author adrpo
public function stringAppendList_tail "
@author adrpo
tail recursive implmentation for stringAppendList"
input list<String> inStringLst;
input String accumulator;
Expand Down

0 comments on commit c380238

Please sign in to comment.