| /******************************************************************************* |
| * Copyright (c) 2011 E.D.Willink and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| grammar org.eclipse.qvtd.xtext.qvtimperative.QVTimperative with org.eclipse.qvtd.xtext.qvtcorebase.QVTcoreBase |
| |
| import "http://www.eclipse.org/emf/2002/Ecore" as ecore |
| import "platform:/resource/org.eclipse.ocl.pivot/model/Pivot.ecore" as pivot |
| import "platform:/resource/org.eclipse.ocl.xtext.base/model/BaseCS.ecore" as base |
| import "platform:/resource/org.eclipse.ocl.xtext.essentialocl/model/EssentialOCLCS.ecore" as essentialocl |
| import "platform:/resource/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore" as qvtbase |
| import "platform:/resource/org.eclipse.qvtd.pivot.qvtcorebase/model/QVTcoreBase.ecore" as qvtcorebase |
| import "platform:/resource/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ecore" as qvtimperative |
| import "platform:/resource/org.eclipse.qvtd.xtext.qvtcorebase/model/QVTcoreBaseCS.ecore" as qvtcorebasecs |
| import "platform:/resource/org.eclipse.qvtd.xtext.qvtimperative/model/QVTimperativeCS.ecore" |
| |
| TopLevelCS: |
| ownedImports+=ImportCS* |
| (ownedTransformations+=TransformationCS | ownedMappings+=MappingCS | ownedQueries+=QueryCS)* |
| ; |
| |
| ConnectionStatementCS: targetVariable=[pivot::Variable|UnrestrictedName] '+=' ownedExpression=ExpCS ';'; |
| |
| DirectionCS returns qvtcorebasecs::DirectionCS : {qvtcorebasecs::DirectionCS} name=UnrestrictedName |
| ('imports' imports+=[pivot::Package|UnrestrictedName] (',' imports+=[pivot::Package|UnrestrictedName])*)? |
| ('uses' uses+=[qvtcorebase::CoreDomain|UnrestrictedName] (',' uses+=[qvtcorebase::CoreDomain|UnrestrictedName])*)? |
| ; |
| |
| MappingCS: {MappingCS} isDefault?='default'? 'map' name=UnrestrictedName ('in' ownedInPathName=PathNameCS)? |
| ('uses' ownedUsesPathNames+=PathNameCS (',' ownedUsesPathNames+=PathNameCS)*)? ('key' ownedKeyExpression=ExpCS ';')? |
| '{' ownedDomains+=(SourceDomainCS | TargetDomainCS)* ('where' ownedMiddle=MiddleDomainCS)? ownedMappingSequence=MappingSequenceCS? '}'; |
| |
| MappingCallCS: {MappingCallCS} isInfinite?='infinite'? 'call' ownedPathName=PathNameCS |
| '{' ownedBindings+=MappingCallBindingCS* '}'; |
| |
| MappingCallBindingCS: referredVariable=[pivot::Variable|UnrestrictedName] (':='|isPolled?='?=') ownedValue=ExpCS ';'; |
| |
| MappingLoopCS: 'for' ownedIterator=MappingIteratorCS 'in' ownedInExpression=ExpCS '{' ownedMappingSequence=MappingSequenceCS '}'; |
| |
| MappingIteratorCS returns essentialocl::VariableCS: name=UnrestrictedName (':' ownedType=TypeExpCS)?; |
| |
| MappingSequenceCS: ownedMappingStatements+=MappingStatementCS+; |
| |
| MappingStatementCS: ConnectionStatementCS | MappingCallCS | MappingLoopCS; |
| |
| ImperativePredicateOrAssignmentCS: isDefault?='default'? ownedTarget=ExpCS ((':='|isAccumulate?='+=') ownedInitExpression=ExpCS)? ';'; |
| |
| RealizedVariableCS returns ImperativeRealizedVariableCS: |
| 'realize' name=UnrestrictedName ':' ownedType=TypeExpCS (':=' ownedInitExpression=ExpCS)? |
| ; |
| |
| SourceDomainCS returns ImperativeDomainCS: isCheck?='check' direction=[qvtbase::TypedModel|UnrestrictedName] |
| ('{' ('check' checkedProperties+=PathNameCS (',' checkedProperties+=PathNameCS)*)? |
| ('enforce' enforcedProperties+=PathNameCS (',' enforcedProperties+=PathNameCS)*)? '}')? |
| ownedGuardPattern=SourceGuardPatternCS ownedBottomPattern=SourceBottomPatternCS |
| ; |
| |
| SourceBottomPatternCS returns qvtcorebasecs::BottomPatternCS: |
| {qvtcorebasecs::BottomPatternCS} '{' (ownedUnrealizedVariables+=UnrealizedVariableCS |
| (',' ownedUnrealizedVariables+=UnrealizedVariableCS)*)? |
| '}' |
| ; |
| |
| SourceGuardPatternCS returns qvtcorebasecs::GuardPatternCS: |
| {qvtcorebasecs::GuardPatternCS} '(' (ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)*)? ')' |
| ; |
| |
| MiddleDomainCS returns ImperativeDomainCS: |
| ('{' ('check' checkedProperties+=PathNameCS (',' checkedProperties+=PathNameCS)*)? |
| ('enforce' enforcedProperties+=PathNameCS (',' enforcedProperties+=PathNameCS)*)? '}')? |
| ownedGuardPattern=MiddleGuardPatternCS ownedBottomPattern=MiddleBottomPatternCS |
| ; |
| |
| MiddleBottomPatternCS returns qvtcorebasecs::BottomPatternCS: // Bug 466385 explains the redundancy below |
| ( |
| '{' ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)* |
| '|' ownedConstraints+=ImperativePredicateOrAssignmentCS* '}' |
| ) | ( |
| '{' ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)* '}' |
| ) | ( |
| '{' ownedConstraints+=ImperativePredicateOrAssignmentCS+ '}' |
| ) | ( |
| {qvtcorebasecs::BottomPatternCS} '{' '}' |
| ) |
| ; |
| |
| MiddleGuardPatternCS returns qvtcorebasecs::GuardPatternCS: GuardPatternCS |
| ; |
| |
| TargetDomainCS returns ImperativeDomainCS: isEnforce?='enforce' direction=[qvtbase::TypedModel|UnrestrictedName] |
| ('{' ('check' checkedProperties+=PathNameCS (',' checkedProperties+=PathNameCS)*)? |
| ('enforce' enforcedProperties+=PathNameCS (',' enforcedProperties+=PathNameCS)*)? '}')? |
| ownedGuardPattern=TargetGuardPatternCS ownedBottomPattern=TargetBottomPatternCS |
| ; |
| |
| TargetBottomPatternCS returns qvtcorebasecs::BottomPatternCS: |
| {qvtcorebasecs::BottomPatternCS} '{' ((ownedRealizedVariables+=RealizedVariableCS | ownedUnrealizedVariables+=UnrealizedVariableCS) |
| (',' (ownedRealizedVariables+=RealizedVariableCS | ownedUnrealizedVariables+=UnrealizedVariableCS))*)? |
| '}' |
| ; |
| |
| TargetGuardPatternCS returns qvtcorebasecs::GuardPatternCS: |
| {qvtcorebasecs::GuardPatternCS} '(' (ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)*)? ')' |
| ; |