allow OCL expressions in transition guards
git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@4319 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
parent
08d30e9545
commit
71c7e39694
|
@ -250,10 +250,12 @@ fun transform_guard t (XMI.mk_Guard g) =
|
|||
let val self_type = Rep_OclType.DummyT (* FIX *)
|
||||
val package_path = nil (* FIX *)
|
||||
in
|
||||
Rep_OclTerm.OperationCall ( Rep_OclTerm.Variable ("self",self_type),
|
||||
case #expression g of
|
||||
NONE => Rep_OclTerm.OperationCall ( Rep_OclTerm.Variable ("self",self_type),
|
||||
self_type,
|
||||
List.concat [package_path,[#body g]],nil,
|
||||
List.concat [package_path,[Option.valOf(#body g)]],nil,
|
||||
Rep_OclType.Boolean )
|
||||
| SOME exp => transform_expression t exp
|
||||
end
|
||||
|
||||
fun transform_event t (XMI.CallEvent ev) =
|
||||
|
@ -408,12 +410,12 @@ fun transformXMI ({classifiers,constraints,packages,
|
|||
handle Empty => raise Option
|
||||
|
||||
fun readXMI f = (transformXMI o ParseXMI.readFile) f
|
||||
(* handle ParseXMI.IllFormed msg => (print ("Warning: in Xmi2Mdr.readXMI: could not parse file "^f^":\n"^msg^"\n");
|
||||
handle ParseXMI.IllFormed msg => (print ("Warning: in Xmi2Mdr.readXMI: could not parse file "^f^":\n"^msg^"\n");
|
||||
nil)
|
||||
| Option => (print ("Warning: in Xmi2Mdr.readXMI: could not parse file "^f^"\n");
|
||||
nil)
|
||||
| IllFormed msg => (print ("Warning: in Xmi2Mdr.readXMI: could not parse file "^f^": "^msg^"\n");
|
||||
nil)*)
|
||||
nil)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ datatype Guard = mk_Guard of {xmiid : string,
|
|||
name : string,
|
||||
visibility : VisibilityKind,
|
||||
language : string,
|
||||
body : string,
|
||||
expression : string list}
|
||||
body : string option,
|
||||
expression : XMI_OCL.OCLExpression option}
|
||||
|
||||
datatype Event = SignalEvent of Parameter list
|
||||
| CallEvent of { xmiid : string,
|
||||
|
|
|
@ -616,16 +616,25 @@ fun mkProcedure tree =
|
|||
*)
|
||||
|
||||
fun mkGuard tree =
|
||||
let val getExpr = XmlTree.attributes_of o (XmlTree.find "UML:BooleanExpression") o
|
||||
let val getExpr = XmlTree.node_children_of o (XmlTree.find "UML:Guard.expression")
|
||||
val getBoolExpr = XmlTree.attributes_of o (XmlTree.find "UML:BooleanExpression") o
|
||||
XmlTree.node_children_of o (XmlTree.find "UML:Guard.expression")
|
||||
val getOclExpr = (XmlTree.find "UML:ExpressionInOcl") o
|
||||
XmlTree.node_children_of o (XmlTree.find "UML:Guard.expression")
|
||||
fun f atts trees = XMI.mk_Guard{
|
||||
xmiid = getXmiId atts,
|
||||
name = getMaybeEmptyName atts,
|
||||
isSpecification = getBoolAtt "isSpecification" atts,
|
||||
visibility = getVisibility atts,
|
||||
language = getLang(getExpr trees),
|
||||
body = getBody(getExpr trees),
|
||||
expression = nil}
|
||||
language = if XmlTree.exists "UML:ExpressionInOCL" (getExpr trees)
|
||||
then getLang(XmlTree.attributes_of (getOclExpr trees))
|
||||
else getLang(getBoolExpr trees),
|
||||
body = if XmlTree.exists "UML:ExpressionInOCL" (getExpr trees)
|
||||
then NONE
|
||||
else SOME (getBody (getBoolExpr trees)) ,
|
||||
expression = if XmlTree.exists "UML:ExpressionInOCL" (getExpr trees)
|
||||
then SOME (mkOCLExpression (getOclExpr trees))
|
||||
else NONE}
|
||||
in XmlTree.apply_on "UML:Guard" f tree
|
||||
handle XmlTree.IllFormed msg => raise IllFormed ("in mkGuard: "^msg)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue