parse _empty_ CollectionLiterals (again, a change to OclTerm was necessary, so please check)

git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@3331 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
Jürgen Doser 2005-11-09 18:37:10 +00:00
parent 06871fd6ee
commit c9ac1a7af2
4 changed files with 21 additions and 0 deletions

View File

@ -44,6 +44,7 @@ include REP_OCL_TYPE
datatype OclTerm =
Literal of string * OclType (* Literal with type *)
| CollectionLiteral of CollectionPart list * OclType (* content with type *)
| If of OclTerm * OclType (* condition *)
* OclTerm * OclType (* then *)
* OclTerm * OclType (* else *)
@ -75,4 +76,8 @@ datatype OclTerm =
* OclTerm * OclType (* source *)
* OclTerm * OclType (* iterator-body *)
* OclType (* result type *)
and CollectionPart = CollectionItem of OclTerm * OclType
| CollectionRange of OclTerm (* first *)
* OclTerm (* last *)
* OclType
end

View File

@ -62,6 +62,7 @@ open Rep_OclType
datatype OclTerm =
Literal of string * OclType (* Literal with type *)
| CollectionLiteral of CollectionPart list * OclType (* content with type *)
| If of OclTerm * OclType (* condition *)
* OclTerm * OclType (* then *)
* OclTerm * OclType (* else *)
@ -93,5 +94,9 @@ datatype OclTerm =
* OclTerm * OclType (* source *)
* OclTerm * OclType (* iterator-body *)
* OclType (* result type *)
and CollectionPart = CollectionItem of OclTerm * OclType
| CollectionRange of OclTerm (* first *)
* OclTerm (* last *)
* OclType
end

View File

@ -45,6 +45,9 @@ val triv_expr = Rep_OclTerm.Literal ("true",Rep_OclType.Boolean)
fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
Rep_OclTerm.Literal (symbol,find_classifier_type t expression_type)
| transform_expression t (XMI.CollectionLiteralExp {parts,expression_type}) =
Rep_OclTerm.CollectionLiteral (map (transform_collection_part t) parts,
find_classifier_type t expression_type)
| transform_expression t (XMI.IfExp {condition,thenExpression,
elseExpression,expression_type}) =
Rep_OclTerm.If (transform_expression t condition,
@ -114,6 +117,13 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
)
end
| transform_expression t _ = raise NotYetImplemented
and transform_collection_part t (XMI.CollectionItem {item,expression_type}) =
Rep_OclTerm.CollectionItem (transform_expression t item,
find_classifier_type t expression_type)
| transform_collection_part t (XMI.CollectionRange {first,last,expression_type}) =
Rep_OclTerm.CollectionRange (transform_expression t first,
transform_expression t last,
find_classifier_type t expression_type)
fun transform_constraint t ({xmiid,name,body,...}:XMI.Constraint) =

View File

@ -94,6 +94,7 @@ withtype VariableDeclaration = { xmiid: string,
fun expression_type_of (LiteralExp{expression_type,...}) = expression_type
| expression_type_of (CollectionLiteralExp{expression_type,...}) = expression_type
| expression_type_of (IfExp{expression_type,...}) = expression_type
| expression_type_of (AssociationEndCallExp{expression_type,...}) = expression_type
| expression_type_of (AssociationClassCallExp{expression_type,...}) = expression_type