Skip to content

Commit

Permalink
Fixed bugs in get/set XXX ModifierValue.
Browse files Browse the repository at this point in the history
Implemented get/setSourceFile.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1786 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed May 16, 2005
1 parent 1039852 commit 4321edd
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 190 deletions.
36 changes: 33 additions & 3 deletions Compiler/Absyn.rml
Expand Up @@ -115,7 +115,7 @@
** for printing the AST.
**
** absyn.rml's constructors are primarily used by the walker
** (Compiler/absyn_builder/walker.g) which takes an ANTLR internal syntax tree and
** (modeq/absyn_builder/walker.g) which takes an ANTLR internal syntax tree and
** converts it into an RML abstract syntax tree.
**
** When the AST has been built, it is normaly used by explode.rml in order to
Expand Down Expand Up @@ -165,6 +165,7 @@ module Absyn:
* bool (* Encapsulated *)
* Restriction (* Restricion *)
* ClassDef (* Body *)
* string (* File name class is defined in*)


(** The `ClassDef' type contains the definition part of a class *)
Expand Down Expand Up @@ -467,6 +468,8 @@ module Absyn:
relation cref_equal: (ComponentRef, ComponentRef) => bool
relation print_absyn_exp : Exp => ()
relation last_classname: Program => Path
relation class_filename: Class => string
relation set_class_filename: (Class,string) => Class
end


Expand All @@ -485,7 +488,7 @@ with "Print.rml"
**)
relation element_spec_name : ElementSpec => Ident =

axiom element_spec_name CLASSDEF(_,CLASS(n,_,_,_,_,_)) => n
axiom element_spec_name CLASSDEF(_,CLASS(n,_,_,_,_,_,_)) => n

axiom element_spec_name COMPONENTS(_,_,[COMPONENTITEM(COMPONENT(n,_,_),_)]) => n

Expand Down Expand Up @@ -798,11 +801,38 @@ end
**)
relation last_classname: Program => Path =

rule Util.list_last(lst) => CLASS(id,_,_,_,_,_)
rule Util.list_last(lst) => CLASS(id,_,_,_,_,_,_)
-------------------------
last_classname(PROGRAM(lst,_)) => IDENT(id)
end

(** relation class_filename
** author: PA
**
** Retrieves the filename where the class is stored.
**)

relation class_filename: Class => string =

axiom class_filename (CLASS(_,_,_,_,_,_,filename)) => filename
end

(** relation class_filename
** author: PA
**
** Sets the filename where the class is stored.
**)

relation set_class_filename: (Class,string) => Class =


axiom set_class_filename(CLASS(n,p,f,e,r,body,_),filename)
=> CLASS(n,p,f,e,r,body,filename)
end




(** relation: print_absyn_exp
**
** Prints an Exp
Expand Down
37 changes: 35 additions & 2 deletions Compiler/DAELow.rml
Expand Up @@ -312,6 +312,8 @@ datatype EquationArray = EQUATION_ARRAY of int * (* no. elements *)
relation is_non_state: VarKind => ()
relation is_var_known : (Var list, Exp.ComponentRef) => bool
relation is_param: (Var ) => bool
relation is_output: (Var) => bool
relation is_input: (Var) => bool

relation get_all_exps : DAELow => Exp.Exp list

Expand Down Expand Up @@ -5296,10 +5298,41 @@ relation get_all_exps_eqn : Equation => Exp.Exp list =
end


relation is_param: (Var ) => bool =
(** relation: is_param
**
** Return true if variable is a parameter.
**)

relation is_param: (Var ) => bool =

axiom is_param(VAR(_,PARAM,_,_,_,_,_,_,_,_,_,_,_)) => true
axiom is_param(_) => false
end
end

(** relation: is_output
**
** Return true if variable is declared as output. Note that the output
** attribute sticks with a variable even if it is originating from a sub
** component, which is not the case for Dymola.
**)

relation is_output: (Var) => bool =

axiom is_output( VAR(_,_,DAE.OUTPUT,_,_,_,_,_,_,_,_,_,_)) => true
axiom is_output(_) => false
end

(** relation: is_input
**
** Returns true if variable is declared as input.
** See also is_ouput above
**)

relation is_input: (Var) => bool =

axiom is_input( VAR(_,_,DAE.INPUT,_,_,_,_,_,_,_,_,_,_)) => true

axiom is_input(_) => false
end


12 changes: 6 additions & 6 deletions Compiler/Dump.rml
Expand Up @@ -240,7 +240,7 @@ relation unparse_class_str: (int, Absyn.Class,string,string,string) => string =
unparse_string_comment_option(optcmt) => s5 &
Util.string_append_list([is, s2', s1, s2, re, io, s3, " ", n, s5, "\n", s4, is, "end ", n]) => str
-----------------------------
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,optcmt)),fi,re,io) => str
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,optcmt),_),fi,re,io) => str

rule indent_str(indent) => is &
select_string(p, "partial ", "") => s1 &
Expand All @@ -256,7 +256,7 @@ relation unparse_class_str: (int, Absyn.Class,string,string,string) => string =
Util.string_append_list([is,s2',s1,s2,re,io,s3," ",n,"= ",s4,s5,s6,s7,s8,s9])
=> str
------------------------------
unparse_class_str(indent,Absyn.CLASS(n,p,f,e,r,Absyn.DERIVED(i,dim,attr,m,optcmt)),fi,re,io) => str
unparse_class_str(indent,Absyn.CLASS(n,p,f,e,r,Absyn.DERIVED(i,dim,attr,m,optcmt),_),fi,re,io) => str

rule indent_str(i) => is &
select_string(p, "partial ", "") => s1 &
Expand All @@ -267,7 +267,7 @@ relation unparse_class_str: (int, Absyn.Class,string,string,string) => string =
unparse_comment_option(cmt) => s5 &
Util.string_append_list([is,s2',s1,s2,re,io,s3," ",n,"= enumeration(",s4,")",s5]) => str
-------------------------------
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,cmt)),fi,re,io) => str
unparse_class_str(i, Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,cmt),_),fi,re,io) => str

end

Expand Down Expand Up @@ -357,21 +357,21 @@ relation print_class: Absyn.Class => () =
Print.print_buf n & Print.print_buf "," & print_select(p,"PARTIAL,","") &
print_list_debug("print_class1",parts,print_class_part,",") & Print.print_buf ")"
----------------------------------------
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,_))) => ()
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,_),_)) => ()

rule print_class_restriction(r) & Print.print_buf "(" &
Print.print_buf n & Print.print_buf "," & print_select(p,"PARTIAL,","") &
Print.print_buf ") = " & print_path(i) &
print_class_modification(m)
----------------------------------------
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.DERIVED(i,_,_,m,_))) => ()
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.DERIVED(i,_,_,m,_),_)) => ()

rule print_class_restriction(r) & Print.print_buf "(" &
Print.print_buf n & Print.print_buf "," &
print_select(p,"PARTIAL,","") &
Print.print_buf "ENUMERATION(...)\n"
----------
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,_))) => ()
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.ENUMERATION(l,_),_)) => ()
end

(**)
Expand Down
2 changes: 1 addition & 1 deletion Compiler/DumpGraphviz.rml
Expand Up @@ -184,7 +184,7 @@ relation print_class: Absyn.Class => Node =
print_parts parts => nl
(* & print "> End of rule print_class\n" *)
-----------------------
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,_))) => Graphviz.NODE(rs,[],nl)
print_class(Absyn.CLASS(n,p,f,e,r,Absyn.PARTS(parts,_),_)) => Graphviz.NODE(rs,[],nl)

end

Expand Down

0 comments on commit 4321edd

Please sign in to comment.