| /******************************************************************************* |
| * 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 "http://www.eclipse.org/ocl/2015/BaseCS" as base |
| import "http://www.eclipse.org/ocl/2015/EssentialOCLCS" as essentialocl |
| import "http://www.eclipse.org/ocl/2015/Pivot" as pivot |
| import "http://www.eclipse.org/qvt/2015/QVTbase" as qvtbase |
| import "http://www.eclipse.org/qvt/2015/QVTcoreBase" as qvtcorebase |
| import "http://www.eclipse.org/qvt/2015/QVTimperative" as qvtimperative |
| import "http://www.eclipse.org/qvt/2015/QVTcoreBaseCS" as qvtcorebasecs |
| import "http://www.eclipse.org/qvt/2015/QVTimperativeCS" |
| |
| TopLevelCS: |
| (ownedImports+=ImportCS | /*ownedInclude+=IncludeCS |*/ ownedLibraries+=LibraryCS)* |
| (ownedTransformations+=TransformationCS | ownedMappings+=MappingCS | ownedQueries+=QueryCS)* |
| ; |
| |
| 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} 'map' name=UnrestrictedName ('in' in=[qvtbase::Transformation|UnrestrictedName])? |
| '{' ownedDomains+=(SourceDomainCS | TargetDomainCS)* ('where' ownedMiddle=MiddleDomainCS)? ownedMappingSequence=MappingSequenceCS? '}'; |
| |
| MappingCallCS: {MappingCallCS} 'call' referredMapping=[qvtimperative::Mapping|UnrestrictedName] |
| '{' ownedBindings+=MappingCallBindingCS* '}'; |
| |
| MappingCallBindingCS: referredVariable=[pivot::Variable|UnrestrictedName] ':=' ownedValue=ExpCS ';'; |
| |
| MappingLoopCS: 'for' ownedIterator=MappingIteratorCS 'in' ownedInExpression=ExpCS '{' ownedMappingSequence=MappingSequenceCS '}'; |
| |
| MappingIteratorCS returns essentialocl::VariableCS: name=UnrestrictedName (':' ownedType=TypeExpCS)?; |
| |
| MappingSequenceCS: ownedMappingStatements+=MappingStatementCS+; |
| |
| MappingStatementCS: MappingCallCS | MappingLoopCS; |
| |
| SourceDomainCS returns qvtcorebasecs::DomainCS: isCheck?='check' direction=[qvtbase::TypedModel|UnrestrictedName] |
| ownedGuardPattern=SourceGuardPatternCS ownedBottomPattern=SourceBottomPatternCS |
| ; |
| |
| SourceBottomPatternCS returns qvtcorebasecs::BottomPatternCS: |
| {qvtcorebasecs::BottomPatternCS} '{''}' |
| ; |
| |
| SourceGuardPatternCS returns qvtcorebasecs::GuardPatternCS: |
| {qvtcorebasecs::GuardPatternCS} '(' (ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)*)? ')' |
| ; |
| |
| MiddleDomainCS returns qvtcorebasecs::DomainCS: {qvtcorebasecs::DomainCS} ownedGuardPattern=MiddleGuardPatternCS ownedBottomPattern=MiddleBottomPatternCS; |
| |
| MiddleBottomPatternCS returns qvtcorebasecs::BottomPatternCS: |
| {qvtcorebasecs::BottomPatternCS} '{' ownedConstraints+=PredicateOrAssignmentCS* '}' |
| ; |
| |
| MiddleGuardPatternCS returns qvtcorebasecs::GuardPatternCS: |
| {qvtcorebasecs::GuardPatternCS} '(' ownedPredicates+=PredicateCS* ')' |
| ; |
| |
| TargetDomainCS returns qvtcorebasecs::DomainCS: isEnforce?='enforce' direction=[qvtbase::TypedModel|UnrestrictedName] |
| ownedGuardPattern=TargetGuardPatternCS ownedBottomPattern=TargetBottomPatternCS |
| ; |
| |
| TargetBottomPatternCS returns qvtcorebasecs::BottomPatternCS: |
| {qvtcorebasecs::BottomPatternCS} '{' ((ownedUnrealizedVariables+=UnrealizedVariableCS | ownedRealizedVariables+=RealizedVariableCS) |
| (',' (ownedUnrealizedVariables+=UnrealizedVariableCS | ownedRealizedVariables+=RealizedVariableCS))*)? |
| '}' |
| ; |
| |
| TargetGuardPatternCS returns qvtcorebasecs::GuardPatternCS: |
| {qvtcorebasecs::GuardPatternCS} '(' (ownedUnrealizedVariables+=UnrealizedVariableCS (',' ownedUnrealizedVariables+=UnrealizedVariableCS)*)? ')' |
| ; |