Skip to content

Commit

Permalink
Implemented getClassRestriction in Interactive.rml, returns a string …
Browse files Browse the repository at this point in the history
…with the class restriction.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1946 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Nov 4, 2005
1 parent bc5b1bd commit 5878923
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Compiler/Dump.rml
Expand Up @@ -104,8 +104,9 @@ module Dump:
relation unparse_algorithm_str: (int, Absyn.AlgorithmItem) => string
relation variability_symbol: Absyn.Variability => string
relation unparse_modification_str: Absyn.Modification => string

relation unparse_restriction_str : Absyn.Restriction => string
relation unparse_comment_option: (Absyn.Comment option) => string

end


Expand Down
27 changes: 27 additions & 0 deletions Compiler/Interactive.rml
Expand Up @@ -1011,6 +1011,16 @@ with "Ceval.rml"
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => ("true",st)

rule get_class_restriction(cr,p) => resstr
-----------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getClassRestriction",_),
Absyn.FUNCTIONARGS([Absyn.CREF(cr)],_)))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)


rule is_primitive(cr,p) => b1 &
Util.bool_string(b1) => resstr
-----------------------
Expand Down Expand Up @@ -2883,6 +2893,23 @@ end
delete_class_from_list(cdef as Absyn.CLASS(name,_,_,_,_,_,_), x::xs) => x::res
end

(** relation: get_class_restriction
** author: PA
**
** Returns the class restriction of a class as a string.
**)

relation get_class_restriction:(Absyn.ComponentRef,
Absyn.Program) => string =

rule Absyn.cref_to_path(cr) => path &
get_pathed_class_in_program(path,p) => Absyn.CLASS(_,_,_,_,restr,_,_) &
Dump.unparse_restriction_str(restr) => res &
Util.string_append_list(["\"",res,"\""]) => res'
----------------------------
get_class_restriction(cr,p) => res'
end

(** relation: is_type
**
** This relation takes a component reference and a program.
Expand Down

0 comments on commit 5878923

Please sign in to comment.