-- Haskel data types for the abstract syntax. -- Generated by the BNF converter. {-# LANGUAGE GeneralizedNewtypeDeriving #-} -- | The abstract syntax of language OCL. module AbsOCL where import qualified Prelude as T (Double, Integer, String) import qualified Prelude as C (Eq, Ord, Show, Read) import Data.String data OCLfile = OCLf [OCLPackage] -- ^ OCLfile ::= OCLPackage deriving (C.Eq, C.Ord, C.Show, C.Read) data OCLPackage = Pack PackageName OCLExpressions -- ^ OCLPackage ::= "package" PackageName OCLExpressions "endpackage" deriving (C.Eq, C.Ord, C.Show, C.Read) data PackageName = PackName PathName -- ^ PackageName ::= PathName deriving (C.Eq, C.Ord, C.Show, C.Read) data OCLExpressions = Constraints [Constrnt] -- ^ OCLExpressions ::= Constrnt deriving (C.Eq, C.Ord, C.Show, C.Read) data Constrnt = Constr ContextDeclaration [ConstrBody] -- ^ Constrnt ::= ContextDeclaration ConstrBody deriving (C.Eq, C.Ord, C.Show, C.Read) data ConstrBody = CB Stereotype OCLExpression -- ^ ConstrBody ::= Stereotype ":" OCLExpression | CBDef [LetExpression] -- ^ ConstrBody ::= "def" ":" LetExpression | CBDefNamed Ident [LetExpression] -- ^ ConstrBody ::= "def" Ident ":" LetExpression | CBNamed Stereotype Ident OCLExpression -- ^ ConstrBody ::= Stereotype Ident ":" OCLExpression deriving (C.Eq, C.Ord, C.Show, C.Read) data ContextDeclaration = CDClassif ClassifierContext -- ^ ContextDeclaration ::= "context" ClassifierContext | CDOper OperationContext -- ^ ContextDeclaration ::= "context" OperationContext deriving (C.Eq, C.Ord, C.Show, C.Read) data ClassifierContext = CC Ident -- ^ ClassifierContext ::= Ident | CCType Ident Ident -- ^ ClassifierContext ::= Ident ":" Ident deriving (C.Eq, C.Ord, C.Show, C.Read) data OperationContext = OpC Ident OperationName [FormalParameter] -- ^ OperationContext ::= Ident "::" OperationName "(" FormalParameter ")" | OpCRT Ident OperationName [FormalParameter] ReturnType -- ^ OperationContext ::= Ident "::" OperationName "(" FormalParameter ")" ":" ReturnType deriving (C.Eq, C.Ord, C.Show, C.Read) data Stereotype = Inv -- ^ Stereotype ::= "inv" | Post -- ^ Stereotype ::= "post" | Pre -- ^ Stereotype ::= "pre" deriving (C.Eq, C.Ord, C.Show, C.Read) data OperationName = Add -- ^ OperationName ::= "+" | And -- ^ OperationName ::= "and" | Div -- ^ OperationName ::= "/" | Eq -- ^ OperationName ::= "=" | GRT -- ^ OperationName ::= ">" | GRTE -- ^ OperationName ::= ">=" | Impl -- ^ OperationName ::= "implies" | LST -- ^ OperationName ::= "<" | LSTE -- ^ OperationName ::= "<=" | Mult -- ^ OperationName ::= "*" | NEq -- ^ OperationName ::= "<>" | Not -- ^ OperationName ::= "not" | OpName Ident -- ^ OperationName ::= Ident | Or -- ^ OperationName ::= "or" | Sub -- ^ OperationName ::= "-" | Xor -- ^ OperationName ::= "xor" deriving (C.Eq, C.Ord, C.Show, C.Read) data FormalParameter = FP Ident TypeSpecifier -- ^ FormalParameter ::= Ident ":" TypeSpecifier deriving (C.Eq, C.Ord, C.Show, C.Read) data TypeSpecifier = TScoll CollectionType -- ^ TypeSpecifier ::= CollectionType | TSsimple SimpleTypeSpecifier -- ^ TypeSpecifier ::= SimpleTypeSpecifier deriving (C.Eq, C.Ord, C.Show, C.Read) data CollectionType = CT CollectionKind SimpleTypeSpecifier -- ^ CollectionType ::= CollectionKind "(" SimpleTypeSpecifier ")" deriving (C.Eq, C.Ord, C.Show, C.Read) data ReturnType = RT TypeSpecifier -- ^ ReturnType ::= TypeSpecifier deriving (C.Eq, C.Ord, C.Show, C.Read) data OCLExpression = OCLExp Expression -- ^ OCLExpression ::= Expression | OCLExpLet [LetExpression] Expression -- ^ OCLExpression ::= LetExpression "in" Expression deriving (C.Eq, C.Ord, C.Show, C.Read) data LetExpression = LE Ident [FormalParameter] Expression -- ^ LetExpression ::= "let" Ident "(" FormalParameter ")" "=" Expression | LENoParam Ident Expression -- ^ LetExpression ::= "let" Ident "=" Expression | LENoParamType Ident TypeSpecifier Expression -- ^ LetExpression ::= "let" Ident ":" TypeSpecifier "=" Expression | LEType Ident [FormalParameter] TypeSpecifier Expression -- ^ LetExpression ::= "let" Ident "(" FormalParameter ")" ":" TypeSpecifier "=" Expression deriving (C.Eq, C.Ord, C.Show, C.Read) data IfExpression = IfExp Expression Expression Expression -- ^ IfExpression ::= "if" Expression "then" Expression "else" Expression "endif" deriving (C.Eq, C.Ord, C.Show, C.Read) data Expression = EExplPropCall Expression PostfixOperator PropertyCall -- ^ Expression ::= Expression7 PostfixOperator PropertyCall | EIfExp IfExpression -- ^ Expression ::= IfExpression | EImplPropCall PropertyCall -- ^ Expression ::= PropertyCall | ELit OCLLiteral -- ^ Expression ::= OCLLiteral | ELitColl LiteralCollection -- ^ Expression ::= LiteralCollection | EMessage Expression PathName [MessageArg] -- ^ Expression ::= Expression7 "^" PathName "(" MessageArg ")" | ENull -- ^ Expression ::= "null" | EOpAdd Expression AddOperator Expression -- ^ Expression ::= Expression4 AddOperator Expression5 | EOpEq Expression EqualityOperator Expression -- ^ Expression ::= Expression2 EqualityOperator Expression3 | EOpImpl Expression Expression -- ^ Expression ::= Expression "implies" Expression1 | EOpLog Expression LogicalOperator Expression -- ^ Expression ::= Expression1 LogicalOperator Expression2 | EOpMul Expression MultiplyOperator Expression -- ^ Expression ::= Expression5 MultiplyOperator Expression6 | EOpRel Expression RelationalOperator Expression -- ^ Expression ::= Expression3 RelationalOperator Expression4 | EOpUn UnaryOperator Expression -- ^ Expression ::= UnaryOperator Expression7 deriving (C.Eq, C.Ord, C.Show, C.Read) data MessageArg = MAExpr Expression -- ^ MessageArg ::= Expression | MAUnspec -- ^ MessageArg ::= "?" | MAUnspecTyped TypeSpecifier -- ^ MessageArg ::= "?" ":" TypeSpecifier deriving (C.Eq, C.Ord, C.Show, C.Read) data PropertyCall = PCall PathName PossTimeExpression PossQualifiers PossPropCallParam -- ^ PropertyCall ::= PathName PossTimeExpression PossQualifiers PossPropCallParam deriving (C.Eq, C.Ord, C.Show, C.Read) data PathName = PathN [PName] -- ^ PathName ::= PName deriving (C.Eq, C.Ord, C.Show, C.Read) data PName = PN Ident -- ^ PName ::= Ident deriving (C.Eq, C.Ord, C.Show, C.Read) data PossQualifiers = NoQual -- ^ PossQualifiers ::= | Qual Qualifiers -- ^ PossQualifiers ::= Qualifiers deriving (C.Eq, C.Ord, C.Show, C.Read) data Qualifiers = Quals [Expression] -- ^ Qualifiers ::= "[" Expression "]" deriving (C.Eq, C.Ord, C.Show, C.Read) data PossTimeExpression = AtPre -- ^ PossTimeExpression ::= "@" "pre" | NoTE -- ^ PossTimeExpression ::= deriving (C.Eq, C.Ord, C.Show, C.Read) data PossPropCallParam = NoPCP -- ^ PossPropCallParam ::= | PCPs PropertyCallParameters -- ^ PossPropCallParam ::= PropertyCallParameters deriving (C.Eq, C.Ord, C.Show, C.Read) data Declarator = Decl DeclaratorVarList -- ^ Declarator ::= DeclaratorVarList "|" | DeclAcc DeclaratorVarList Ident TypeSpecifier Expression -- ^ Declarator ::= DeclaratorVarList ";" Ident ":" TypeSpecifier "=" Expression "|" deriving (C.Eq, C.Ord, C.Show, C.Read) data DeclaratorVarList = DVL [Ident] -- ^ DeclaratorVarList ::= Ident | DVLType [Ident] SimpleTypeSpecifier -- ^ DeclaratorVarList ::= Ident ":" SimpleTypeSpecifier deriving (C.Eq, C.Ord, C.Show, C.Read) data PropertyCallParameters = PCP [Expression] -- ^ PropertyCallParameters ::= "(" Expression ")" | PCPConcrete Expression [PCPHelper] -- ^ PropertyCallParameters ::= "(" Expression PCPHelper ")" | PCPDecl Declarator [Expression] -- ^ PropertyCallParameters ::= "(" Declarator Expression ")" | PCPNoDeclNoParam -- ^ PropertyCallParameters ::= "(" ")" deriving (C.Eq, C.Ord, C.Show, C.Read) data PCPHelper = PCPBar Expression -- ^ PCPHelper ::= "|" Expression | PCPColon SimpleTypeSpecifier -- ^ PCPHelper ::= ":" SimpleTypeSpecifier | PCPComma Expression -- ^ PCPHelper ::= "," Expression | PCPIterate Ident TypeSpecifier Expression -- ^ PCPHelper ::= ";" Ident ":" TypeSpecifier "=" Expression deriving (C.Eq, C.Ord, C.Show, C.Read) data OCLLiteral = LitBoolFalse -- ^ OCLLiteral ::= "false" | LitBoolTrue -- ^ OCLLiteral ::= "true" | LitNum OCLNumber -- ^ OCLLiteral ::= OCLNumber | LitStr T.String -- ^ OCLLiteral ::= String deriving (C.Eq, C.Ord, C.Show, C.Read) data SimpleTypeSpecifier = STSpec PathName -- ^ SimpleTypeSpecifier ::= PathName deriving (C.Eq, C.Ord, C.Show, C.Read) data LiteralCollection = LCollection CollectionKind [CollectionItem] -- ^ LiteralCollection ::= CollectionKind "{" CollectionItem "}" | LCollectionEmpty CollectionKind -- ^ LiteralCollection ::= CollectionKind "{" "}" deriving (C.Eq, C.Ord, C.Show, C.Read) data CollectionItem = CI Expression -- ^ CollectionItem ::= Expression | CIRange Expression Expression -- ^ CollectionItem ::= Expression ".." Expression deriving (C.Eq, C.Ord, C.Show, C.Read) data OCLNumber = NumDouble T.Double -- ^ OCLNumber ::= Double | NumInt T.Integer -- ^ OCLNumber ::= Integer deriving (C.Eq, C.Ord, C.Show, C.Read) data LogicalOperator = LAnd -- ^ LogicalOperator ::= "and" | LOr -- ^ LogicalOperator ::= "or" | LXor -- ^ LogicalOperator ::= "xor" deriving (C.Eq, C.Ord, C.Show, C.Read) data CollectionKind = Bag -- ^ CollectionKind ::= "Bag" | Collection -- ^ CollectionKind ::= "Collection" | Sequence -- ^ CollectionKind ::= "Sequence" | Set -- ^ CollectionKind ::= "Set" deriving (C.Eq, C.Ord, C.Show, C.Read) data EqualityOperator = EEq -- ^ EqualityOperator ::= "=" | ENEq -- ^ EqualityOperator ::= "<>" deriving (C.Eq, C.Ord, C.Show, C.Read) data RelationalOperator = RGT -- ^ RelationalOperator ::= ">" | RGTE -- ^ RelationalOperator ::= ">=" | RLT -- ^ RelationalOperator ::= "<" | RLTE -- ^ RelationalOperator ::= "<=" deriving (C.Eq, C.Ord, C.Show, C.Read) data AddOperator = AAdd -- ^ AddOperator ::= "+" | ASub -- ^ AddOperator ::= "-" deriving (C.Eq, C.Ord, C.Show, C.Read) data MultiplyOperator = MDiv -- ^ MultiplyOperator ::= "/" | MMult -- ^ MultiplyOperator ::= "*" deriving (C.Eq, C.Ord, C.Show, C.Read) data UnaryOperator = UMin -- ^ UnaryOperator ::= "-" | UNot -- ^ UnaryOperator ::= "not" deriving (C.Eq, C.Ord, C.Show, C.Read) data PostfixOperator = PArrow -- ^ PostfixOperator ::= "->" | PDot -- ^ PostfixOperator ::= "." deriving (C.Eq, C.Ord, C.Show, C.Read) newtype Ident = Ident T.String deriving (C.Eq, C.Ord, C.Show, C.Read, Data.String.IsString)