@@ -6969,7 +6969,7 @@ algorithm
69696969end getDymolaStateAnnotation;
69706970
69716971protected function getDymolaStateAnnotationModStr
6972- "Extractor function for getDocumentationClassAnnotation "
6972+ "Extractor function for getDymolaStateAnnotation "
69736973 input Option < Absyn . Modification > mod;
69746974 output String stateStr;
69756975algorithm
@@ -6987,6 +6987,69 @@ algorithm
69876987 end matchcontinue;
69886988end getDymolaStateAnnotationModStr;
69896989
6990+ protected function getAccessAnnotation
6991+ "Returns the Protection(access=) annotation of a class.
6992+ This is annotated with the annotation:
6993+ annotation(Protection(access = Access.documentation)); in the class definition"
6994+ input Absyn . Path className;
6995+ input Absyn . Program p;
6996+ output String access;
6997+ algorithm
6998+ access := match(className,p)
6999+ local
7000+ String accessStr;
7001+ case (_,_)
7002+ equation
7003+ accessStr = Interactive . getNamedAnnotation(className, p, Absyn . IDENT ("Protection" ), SOME ("" ), getAccessAnnotationString);
7004+ then
7005+ accessStr;
7006+ else "" ;
7007+ end match;
7008+ end getAccessAnnotation;
7009+
7010+ protected function getAccessAnnotationString
7011+ "Extractor function for getAccessAnnotation"
7012+ input Option < Absyn . Modification > mod;
7013+ output String access;
7014+ algorithm
7015+ access := match (mod)
7016+ local
7017+ list< Absyn . ElementArg > arglst;
7018+
7019+ case (SOME (Absyn . CLASSMOD (elementArgLst = arglst)))
7020+ then getAccessAnnotationString2(arglst);
7021+
7022+ end match;
7023+ end getAccessAnnotationString;
7024+
7025+ protected function getAccessAnnotationString2
7026+ "Extractor function for getAccessAnnotation"
7027+ input list< Absyn . ElementArg > eltArgs;
7028+ output String access;
7029+ algorithm
7030+ access := match eltArgs
7031+ local
7032+ list< Absyn . ElementArg > xs;
7033+ Absyn . ComponentRef cref;
7034+ String name;
7035+ Absyn . Info info;
7036+
7037+ case ({}) then "" ;
7038+
7039+ case (Absyn . MODIFICATION (path = Absyn . IDENT (name= "access" ),
7040+ modification = SOME (Absyn . CLASSMOD (eqMod= Absyn . EQMOD (exp= Absyn . CREF (cref)))))::xs)
7041+ equation
7042+ name = Dump . printComponentRefStr(cref);
7043+ then name;
7044+
7045+ case (_::xs)
7046+ equation
7047+ name = getAccessAnnotationString2(xs);
7048+ then name;
7049+
7050+ end match;
7051+ end getAccessAnnotationString2;
7052+
69907053protected function getClassInformation
69917054"author: PA
69927055 Returns all the possible class information.
@@ -6999,7 +7062,7 @@ protected function getClassInformation
69997062 input Absyn . Program p;
70007063 output Values . Value res_1;
70017064protected
7002- String name,file,strPartial,strFinal,strEncapsulated,res,cmt,str_readonly,str_sline,str_scol,str_eline,str_ecol,version,preferredView;
7065+ String name,file,strPartial,strFinal,strEncapsulated,res,cmt,str_readonly,str_sline,str_scol,str_eline,str_ecol,version,preferredView,access ;
70037066 String dim_str,lastIdent;
70047067 Boolean partialPrefix,finalPrefix,encapsulatedPrefix,isReadOnly,isProtectedClass,isDocClass,isState;
70057068 Absyn . Restriction restr;
@@ -7022,6 +7085,7 @@ algorithm
70227085 version := CevalScript . getPackageVersion(path, p);
70237086 Absyn . STRING (preferredView) := Interactive . getNamedAnnotation(path, p, Absyn . IDENT ("preferredView" ), SOME (Absyn . STRING ("" )), Interactive . getAnnotationExp);
70247087 isState := getDymolaStateAnnotation(path, p);
7088+ access := getAccessAnnotation(path, p);
70257089 res_1 := Values . TUPLE ({
70267090 Values . STRING (res),
70277091 Values . STRING (cmt),
@@ -7039,7 +7103,8 @@ algorithm
70397103 Values . BOOL (isDocClass),
70407104 Values . STRING (version),
70417105 Values . STRING (preferredView),
7042- Values . BOOL (isState)
7106+ Values . BOOL (isState),
7107+ Values . STRING (access)
70437108 });
70447109end getClassInformation;
70457110
0 commit comments