Преглед на файлове

removed contextPredicateProvider from STextProposalProvider
Used GlobalURIScopeProvider

Andreas Muelder преди 8 години
родител
ревизия
173462c578

+ 8 - 21
plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/STextProposalProvider.java

@@ -33,11 +33,9 @@ import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
 import org.eclipse.xtext.ui.editor.contentassist.ContentProposalLabelProvider;
 import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
-import org.yakindu.base.expressions.expressions.ExpressionsPackage;
 import org.yakindu.base.expressions.expressions.FeatureCall;
 import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.Type;
-import org.yakindu.base.types.TypesPackage;
 import org.yakindu.sct.model.stext.services.STextGrammarAccess;
 import org.yakindu.sct.model.stext.stext.InterfaceScope;
 import org.yakindu.sct.model.stext.stext.InternalScope;
@@ -45,10 +43,8 @@ import org.yakindu.sct.model.stext.stext.SimpleScope;
 import org.yakindu.sct.model.stext.stext.StatechartSpecification;
 import org.yakindu.sct.model.stext.stext.TransitionSpecification;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
-import org.yakindu.sct.model.stext.validation.ContextPredicateProvider;
 
 import com.google.common.base.Function;
-import com.google.common.base.Predicate;
 import com.google.inject.Inject;
 
 /**
@@ -192,31 +188,22 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		};
 	}
 
-	@Inject
-	protected ContextPredicateProvider contextProvider;
-
 	@Override
 	public void completeElementReferenceExpression_Reference(EObject model, Assignment assignment,
 			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
-		Predicate<IEObjectDescription> predicate = contextProvider.calculateFilterPredicate(context.getCurrentModel(),
-				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE);
-		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor, predicate);
+		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor);
 	}
-	
+
 	@Override
 	public void completeSimpleElementReferenceExpression_Reference(EObject model, Assignment assignment,
 			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
-		Predicate<IEObjectDescription> predicate = contextProvider.calculateFilterPredicate(context.getCurrentModel(),
-				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE);
-		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor, predicate);
+		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor);
 	}
-		
-	@Override	
-	public void completeTypeSpecifier_Type(EObject model, Assignment assignment,
-			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
-		Predicate<IEObjectDescription> predicate = contextProvider.calculateFilterPredicate(context.getCurrentModel(),
-				TypesPackage.Literals.TYPE_SPECIFIER__TYPE);
-		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor, predicate);
+
+	@Override
+	public void completeTypeSpecifier_Type(EObject model, Assignment assignment, ContentAssistContext context,
+			ICompletionProposalAcceptor acceptor) {
+		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor);
 	}
 
 	@Override

+ 1 - 6
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/ContextPredicateProvider.java

@@ -8,7 +8,7 @@
  * Contributors:
  *     committers of YAKINDU - initial API and implementation
  */
-package org.yakindu.sct.model.stext.validation;
+package org.yakindu.sct.model.stext.scoping;
 
 import static org.yakindu.base.expressions.expressions.ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION;
 import static org.yakindu.base.expressions.expressions.ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION__EXPRESSION;
@@ -37,7 +37,6 @@ import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.TRANSITION
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.TRANSITION_SPECIFICATION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.VARIABLE_DEFINITION;
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -47,13 +46,9 @@ import org.eclipse.emf.ecore.EReference;
 import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.util.Pair;
 import org.eclipse.xtext.util.Tuples;
-import org.yakindu.base.types.Type;
 import org.yakindu.base.types.TypesPackage;
 import org.yakindu.base.types.resource.TypedResourceDescriptionStrategy;
-import org.yakindu.base.types.typesystem.GenericTypeValueProvider;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.stext.stext.StextPackage;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;

+ 73 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextGlobalScopeProvider.java

@@ -10,6 +10,11 @@
  */
 package org.yakindu.sct.model.stext.scoping;
 
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+
+import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.resource.Resource;
@@ -20,29 +25,49 @@ import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.scoping.IScope;
 import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider;
 import org.eclipse.xtext.scoping.impl.FilteringScope;
+import org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider;
+import org.eclipse.xtext.util.IAcceptor;
+import org.eclipse.xtext.util.IResourceScopeCache;
+import org.yakindu.base.types.Package;
+import org.yakindu.base.types.TypesPackage;
 import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.domain.extension.DomainRegistry;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.util.ContextElementAdapter;
+import org.yakindu.sct.model.stext.stext.ImportScope;
+import org.yakindu.sct.model.stext.stext.StatechartSpecification;
+import org.yakindu.sct.model.stext.stext.StextPackage;
 
 import com.google.common.base.Predicate;
 import com.google.inject.Inject;
+import com.google.inject.Provider;
 
 /**
  * @author andreas muelder - Initial contribution and API
  * 
  */
-public class STextGlobalScopeProvider extends DefaultGlobalScopeProvider {
+public class STextGlobalScopeProvider extends ImportUriGlobalScopeProvider {
 
 	@Inject
 	private ITypeSystem typeSystem;
 	@Inject
 	private IQualifiedNameProvider qualifiedNameProvider;
+	@Inject
+	private IResourceScopeCache cache;
+	@Inject
+	private DefaultGlobalScopeProvider delegate;
+
+	public void setCache(IResourceScopeCache cache) {
+		this.cache = cache;
+	}
 
 	public static final String FILE_EXTENSION = "sct";
 
 	public IScope getScope(Resource context, EReference reference, Predicate<IEObjectDescription> filter) {
+		if (reference.getEReferenceType() == TypesPackage.Literals.PACKAGE) {
+			return delegate.getScope(context, reference, filter);
+		}
 		IScope parentScope = super.getScope(context, reference, filter);
 		parentScope = filterExternalDeclarations(context, parentScope);
 		final Statechart statechart = getStatechart(context);
@@ -54,15 +79,61 @@ public class STextGlobalScopeProvider extends DefaultGlobalScopeProvider {
 				String userData = input.getUserData(DomainRegistry.DOMAIN_ID);
 				if (userData == null)
 					return true;
+
 				return statechart.getDomainID().equals(userData);
 			}
 		});
 	}
 
+	@Override
+	public IScope getScope(Resource resource, EReference reference) {
+		if (reference.getEReferenceType() == TypesPackage.Literals.PACKAGE) {
+			return delegate.getScope(resource, reference);
+		}
+		return super.getScope(resource, reference);
+	}
+
+	protected LinkedHashSet<URI> getImportedUris(final Resource resource) {
+		return cache.get(ImportUriGlobalScopeProvider.class.getName(), resource, new Provider<LinkedHashSet<URI>>() {
+			@Override
+			public LinkedHashSet<URI> get() {
+				final LinkedHashSet<URI> uniqueImportURIs = new LinkedHashSet<URI>(5);
+				IAcceptor<String> collector = createURICollector(resource, uniqueImportURIs);
+				Collection<ImportScope> importScopes = getImportScopes(resource);
+				for (ImportScope object : importScopes) {
+					EList<Package> imports = object.getImports();
+					for (Package package1 : imports) {
+						EcoreUtil.resolveAll(package1);
+						if (package1.eIsProxy())
+							continue;
+						collector.accept(EcoreUtil.getURI(package1).trimFragment().toString());
+					}
+				}
+				Iterator<URI> uriIter = uniqueImportURIs.iterator();
+				while (uriIter.hasNext()) {
+					if (!EcoreUtil2.isValidUri(resource, uriIter.next()))
+						uriIter.remove();
+				}
+				System.out.println(uniqueImportURIs);
+				return uniqueImportURIs;
+			}
+
+			private Collection<ImportScope> getImportScopes(final Resource resource) {
+				StatechartSpecification specification = (StatechartSpecification) EcoreUtil
+						.getObjectByType(resource.getContents(), StextPackage.Literals.STATECHART_SPECIFICATION);
+				if (specification != null) {
+					return EcoreUtil.getObjectsByType(specification.getScopes(), StextPackage.Literals.IMPORT_SCOPE);
+				} else {
+					Statechart statechart = getStatechart(resource);
+					return EcoreUtil.getObjectsByType(statechart.getScopes(), StextPackage.Literals.IMPORT_SCOPE);
+				}
+			}
+		});
+	}
+
 	private Statechart getStatechart(Resource context) {
 		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(context,
 				ContextElementAdapter.class);
-
 		if (provider == null) {
 			return (Statechart) EcoreUtil2.getObjectByType(context.getContents(), SGraphPackage.Literals.STATECHART);
 		} else {

+ 68 - 19
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -20,9 +20,12 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.xtext.EcoreUtil2;
+import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.scoping.IScope;
 import org.eclipse.xtext.scoping.Scopes;
 import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
+import org.eclipse.xtext.scoping.impl.FilteringScope;
+import org.eclipse.xtext.scoping.impl.SimpleScope;
 import org.eclipse.xtext.util.PolymorphicDispatcher.ErrorHandler;
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
 import org.yakindu.base.expressions.expressions.Expression;
@@ -37,9 +40,12 @@ import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.util.ContextElementAdapter;
+import org.yakindu.sct.model.stext.scoping.ContextPredicateProvider.EmptyPredicate;
 import org.yakindu.sct.model.stext.stext.InterfaceScope;
 import org.yakindu.sct.model.stext.stext.InternalScope;
 
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.inject.Inject;
 
@@ -54,9 +60,9 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 
 	@Inject
 	private ITypeSystemInferrer typeInferrer;
-	@Inject
+	@Inject 
 	private ITypeSystem typeSystem;
-
+	
 	private static class ErrorHandlerDelegate<T> implements ErrorHandler<T> {
 
 		private ErrorHandler<T> delegate;
@@ -77,7 +83,7 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 
 	}
-
+	
 	@Override
 	public IScope getScope(EObject context, EReference reference) {
 		try {
@@ -92,17 +98,31 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 	}
 
+	@Inject
+	private ContextPredicateProvider predicateProvider;
+
+	/**
+	 * Scoping for types and taking imported namespaces into account e.g. in
+	 * variable declarations.
+	 */
 	public IScope scope_TypeSpecifier_type(final EObject context, EReference reference) {
-		return getDelegate().getScope(context, reference);
+		IScope scope = getDelegate().getScope(context, reference);
+		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
+		return new FilteringScope(scope, predicate);
 	}
 
 	public IScope scope_ElementReferenceExpression_reference(final EObject context, EReference reference) {
-		IScope scope = getUnnamedTopLevelScope(context, reference);
-		scope = getNamedTopLevelScope(context, reference, scope);
-		return scope;
+		IScope namdScope = getNamedTopLevelScope(context, reference);
+		IScope unnamedScope = getUnnamedTopLevelScope(context, reference);
+		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
+		unnamedScope = new FilteringScope(unnamedScope, predicate);
+		return new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements()));
 	}
 
 	public IScope scope_FeatureCall_feature(final FeatureCall context, EReference reference) {
+
+		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
+
 		Expression owner = context.getOwner();
 		EObject element = null;
 		if (owner instanceof ElementReferenceExpression) {
@@ -118,30 +138,53 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		Type ownerType = result != null ? result.getType() : null;
 
 		if (element instanceof Scope) {
-			return Scopes.scopeFor(((Scope) element).getDeclarations());
-		} else if (ownerType != null) {
+			scope = Scopes.scopeFor(((Scope) element).getDeclarations());
+			return new FilteringScope(scope, predicate);
+		}else if(ownerType != null){
 			scope = Scopes.scopeFor(typeSystem.getPropertyExtensions(ownerType));
-			scope = Scopes.scopeFor(typeSystem.getOperationExtensions(ownerType), scope);
+			scope = Scopes.scopeFor(typeSystem.getOperationExtensions(ownerType),scope);
 		}
-
+		
 		if (ownerType instanceof ComplexType) {
-			return addScopeForComplexType((ComplexType) ownerType, scope);
+			return addScopeForComplexType((ComplexType) ownerType, scope, predicate);
 		}
 		if (ownerType instanceof EnumerationType) {
-			return addScopeForEnumType((EnumerationType) ownerType, scope);
+			return addScopeForEnumType((EnumerationType) ownerType, scope, predicate);
 		}
 		return scope;
 	}
 
-	protected IScope addScopeForEnumType(EnumerationType element, IScope scope) {
-		return Scopes.scopeFor((element).getEnumerator(), scope);
+	protected IScope addScopeForEnumType(EnumerationType element, IScope scope, final Predicate<IEObjectDescription> predicate) {
+		scope = Scopes.scopeFor((element).getEnumerator(), scope);
+		scope = new FilteringScope(scope, predicate);
+		return scope;
+	}
+
+	protected IScope addScopeForComplexType(final ComplexType type, IScope scope, final Predicate<IEObjectDescription> predicate) {
+		scope = Scopes.scopeFor(type.getAllFeatures(), scope);
+		scope = new FilteringScope(scope, predicate);
+		return scope;
 	}
 
-	protected IScope addScopeForComplexType(final ComplexType type, IScope scope) {
-		return Scopes.scopeFor(type.getAllFeatures(), scope);
+	private Predicate<IEObjectDescription> calculateFilterPredicate(final EObject context, final EReference reference) {
+		Predicate<IEObjectDescription> predicate = null;
+		EObject container = context;
+		EReference ref = reference;
+		while (container != null) {
+			predicate = predicateProvider.getPredicate(container.eClass(), ref);
+			if (!(predicate instanceof EmptyPredicate)) {
+				break;
+			}
+			ref = (EReference) container.eContainingFeature();
+			container = container.eContainer();
+		}
+		return predicate;
 	}
 
-	protected IScope getNamedTopLevelScope(final EObject context, EReference reference, IScope outer) {
+	/**
+	 * Returns the toplevel scope
+	 */
+	protected IScope getNamedTopLevelScope(final EObject context, EReference reference) {
 		List<EObject> scopeCandidates = Lists.newArrayList();
 		Statechart statechart = getStatechart(context);
 		if (statechart == null)
@@ -155,9 +198,12 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 				}
 			}
 		}
-		return Scopes.scopeFor(scopeCandidates, outer);
+		return Scopes.scopeFor(scopeCandidates);
 	}
 
+	/**
+	 * Returns a scope with all toplevel declarations of unnamed scope
+	 */
 	protected IScope getUnnamedTopLevelScope(final EObject context, EReference reference) {
 		List<EObject> scopeCandidates = Lists.newArrayList();
 		Statechart statechart = getStatechart(context);
@@ -180,6 +226,9 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		return Scopes.scopeFor(scopeCandidates, scope);
 	}
 
+	/**
+	 * Returns the {@link Statechart} for a context element
+	 */
 	protected Statechart getStatechart(EObject context) {
 		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(context.eResource(),
 				ContextElementAdapter.class);

+ 17 - 64
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -33,12 +33,7 @@ import org.eclipse.xtext.naming.QualifiedName;
 import org.eclipse.xtext.nodemodel.ICompositeNode;
 import org.eclipse.xtext.nodemodel.INode;
 import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
-import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
-import org.eclipse.xtext.resource.IEObjectDescription;
-import org.eclipse.xtext.resource.IResourceDescriptions;
 import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
-import org.eclipse.xtext.util.IAcceptor;
 import org.eclipse.xtext.validation.Check;
 import org.eclipse.xtext.validation.CheckType;
 import org.eclipse.xtext.validation.ComposedChecks;
@@ -130,43 +125,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 	@Inject(optional = true)
 	@Named(DomainRegistry.DOMAIN_ID)
 	private String domainID = BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID.getDefaultValueLiteral();
-	@Inject
-	private ContextPredicateProvider contextPredicateProvider;
-	@Inject
-	private IResourceDescriptions index;
-	@Inject
-	private IDefaultResourceDescriptionStrategy strategy;
-
-	@Check(CheckType.FAST)
-	public void checkContextElement(final ElementReferenceExpression expression) {
-		Iterable<IEObjectDescription> description = null;
-		QualifiedName fqn = nameProvider.getFullyQualifiedName(expression.getReference());
-		if (index instanceof ResourceSetBasedResourceDescriptions) {
-			//This is the fallback for headless execution
-			description = createEObjectDescription(expression);
-		} else {
-			description = index.getExportedObjects(expression.getReference().eClass(), fqn, false);
-		}
-		final Predicate<IEObjectDescription> predicate = contextPredicateProvider.calculateFilterPredicate(expression,
-				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE);
-		for (IEObjectDescription desc : description) {
-			if (!predicate.apply(desc)) {
-				String name = expression.getReference().eClass().getName();
-				error(String.format(ERROR_WRONG_CONTEXT_ELEMENT_MSG, name), null, -1, ERROR_WRONG_CONTEXT_ELEMENT_CODE);
-			}
-		}
-	}
-
-	protected List<IEObjectDescription> createEObjectDescription(final ElementReferenceExpression expression) {
-		final List<IEObjectDescription> result = Lists.newArrayList();
-		strategy.createEObjectDescriptions(expression.getReference(),new IAcceptor<IEObjectDescription>() {
-			@Override
-			public void accept(IEObjectDescription t) {
-				result.add(t);
-			}
-		} );
-		return result;
-	}
 
 	@Check(CheckType.FAST)
 	public void checkExpression(VariableDefinition expression) {
@@ -366,31 +324,28 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 
 	}
 
-	
 	@Check(CheckType.FAST)
-	public void checkValueOfNoEvent(EventValueReferenceExpression exp){
-		
+	public void checkValueOfNoEvent(EventValueReferenceExpression exp) {
+
 		Expression eventExpr = exp.getValue();
-		
+
 		EObject element = null;
 		if (eventExpr instanceof ElementReferenceExpression) {
-			element =  ((ElementReferenceExpression) eventExpr).getReference();
+			element = ((ElementReferenceExpression) eventExpr).getReference();
 		} else if (eventExpr instanceof FeatureCall) {
 			element = ((FeatureCall) eventExpr).getFeature();
 		}
-		
-		if (element != null && (! (element instanceof Event))) {
+
+		if (element != null && (!(element instanceof Event))) {
 			String elementName = "";
-			if ( element instanceof NamedElement ) {
-				elementName = "'" + ((NamedElement) element).getName() +"' ";
+			if (element instanceof NamedElement) {
+				elementName = "'" + ((NamedElement) element).getName() + "' ";
 			}
-			error( elementName + "is no event.",
-					StextPackage.Literals.EVENT_VALUE_REFERENCE_EXPRESSION__VALUE, 0,
+			error(elementName + "is no event.", StextPackage.Literals.EVENT_VALUE_REFERENCE_EXPRESSION__VALUE, 0,
 					VALUE_OF_REQUIRES_EVENT);
 		}
 	}
 
-	
 	@Check(CheckType.NORMAL)
 	public void checkValueReferenedBeforeDefined(Scope scope) {
 		EList<Declaration> declarations = scope.getDeclarations();
@@ -668,32 +623,30 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 
 	@Check(CheckType.FAST)
 	public void checkReactionTriggerRegularEvent(ReactionTrigger reactionTrigger) {
-		for (int i=0; i<reactionTrigger.getTriggers().size(); i++) {
+		for (int i = 0; i < reactionTrigger.getTriggers().size(); i++) {
 			EventSpec eventSpec = reactionTrigger.getTriggers().get(i);
 			if (eventSpec instanceof RegularEventSpec) {
 
 				Expression eventExpression = ((RegularEventSpec) eventSpec).getEvent();
 				EObject element = null;
 				if (eventExpression instanceof ElementReferenceExpression) {
-					element =  ((ElementReferenceExpression) eventExpression).getReference();
+					element = ((ElementReferenceExpression) eventExpression).getReference();
 				} else if (eventExpression instanceof FeatureCall) {
 					element = ((FeatureCall) eventExpression).getFeature();
 				}
-				
-				if (element != null && (! (element instanceof Event))) {
+
+				if (element != null && (!(element instanceof Event))) {
 					String elementName = "";
-					if ( element instanceof NamedElement ) {
-						elementName = "'" + ((NamedElement) element).getName() +"' ";
+					if (element instanceof NamedElement) {
+						elementName = "'" + ((NamedElement) element).getName() + "' ";
 					}
-					error("Trigger " + elementName + "is no event.",
-							StextPackage.Literals.REACTION_TRIGGER__TRIGGERS, i,
-							TRIGGER_IS_NO_EVENT);
+					error("Trigger " + elementName + "is no event.", StextPackage.Literals.REACTION_TRIGGER__TRIGGERS,
+							i, TRIGGER_IS_NO_EVENT);
 				}
 			}
 		}
 	}
 
-	
 	/**
 	 * Only Expressions that produce an effect should be used as actions.
 	 * 

+ 0 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java

@@ -54,8 +54,6 @@ public interface STextValidationMessages {
 	public static final String INTERNAL_DECLARATION_UNUSED = "Internal declaration is not used in statechart.";
 	public static final String ERROR_WRONG_ANNOTATION_TARGET_CODE = "WrongAnnotationTarget";
 	public static final String ERROR_WRONG_ANNOTATION_TARGET_MSG = "Annotation '%s' can not be applied on %s ";
-	public static final String ERROR_WRONG_CONTEXT_ELEMENT_MSG = "Element of type '%s' is not allowed in this context.";
-	public static final String ERROR_WRONG_CONTEXT_ELEMENT_CODE = "ElementNotAllowedInContext";
 	
 	public static final String VALUE_OF_REQUIRES_EVENT = "valueof() expression requires event as argument.";
 

+ 1 - 1
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/AllTests.java

@@ -24,7 +24,7 @@ import org.yakindu.sct.model.stext.test.validation.TransitionsWithNoTriggerTest;
 @RunWith(value = Suite.class)
 @SuiteClasses(value = { TypeInferrerTest.class, StextParserRuleTest.class, TestModelsContainErrorsTest.class,
 		SCTUnitClassifierTest.class, STextJavaValidatorTest.class, TransitionsWithNoTriggerTest.class,
-		ContextPredicateProviderTest.class })
+		STextScopeProviderTest.class })
 
 public class AllTests {
 }

+ 0 - 245
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/ContextPredicateProviderTest.java

@@ -1,245 +0,0 @@
-/** 
- * Copyright (c) 2015 committers of YAKINDU 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:
- * committers of YAKINDU - initial API and implementation
- *
-*/
-package org.yakindu.sct.model.stext.test;
-
-import java.util.Arrays;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit4.validation.AssertableDiagnostics;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.ReactionEffect;
-import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
-import org.yakindu.sct.model.stext.test.validation.AbstractSTextValidationTest;
-import org.yakindu.sct.model.stext.validation.ContextPredicateProvider;
-import org.yakindu.sct.model.stext.validation.STextValidationMessages;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * @author Johannes Dicks - Add tests covering {@link ContextPredicateProvider}
- */
-@RunWith(Parameterized.class)
-public class ContextPredicateProviderTest extends AbstractSTextValidationTest {
-
-	public static final String INTERNAL_SCOPE = "" + //
-			"internal: " + //
-			"	in event e1 : void" + //
-			"	in event e2 : void" + //
-			"	var myInt : integer" + //
-			"	var myBool : boolean" + //
-			"	operation myOpp(param1 : integer) : void" + //
-			"	operation myOpp3() : integer" + //
-			"	operation myOpp4() : boolean" + //
-			"	operation myOpp5() : integer";
-
-	public static final String INTERFACE_SCOPE = "" + //
-			"interface Interface1:" + //
-			"	in event e3 : void" + //
-			"	in event e4 : void" + //
-			"	var myInt2 : integer" + //
-			"	var myBool2 : boolean" + //
-			"	operation myOpp2(param1 : integer) : void";
-
-	public static final String INTERFACE_SCOPE_AND_INTERNAL_SCOPE = INTERNAL_SCOPE + "\n" + INTERFACE_SCOPE;
-
-	private String statement;
-	private String ruleName;
-	private String scopes;
-	private boolean valid;
-
-	public ContextPredicateProviderTest(String statement, String ruleName, String scopes, Boolean isLinkable) {
-		this.statement = statement;
-		this.ruleName = ruleName;
-		this.scopes = scopes;
-		this.valid = isLinkable;
-
-		STextInjectorProvider provider = new STextInjectorProvider();
-		provider.getInjector().injectMembers(this);
-	}
-
-	@Test
-	public void test() {
-		EObject expression = parseExpression(statement, ruleName, scopes);
-		AssertableDiagnostics validationResult = tester.validate(expression);
-		if (!valid) {
-			validationResult.assertAny(AssertableDiagnostics.errorCode(STextValidationMessages.ERROR_WRONG_CONTEXT_ELEMENT_CODE));
-		} else {
-			validationResult.assertOK();
-		}
-	}
-
-	/**
-	 * @see {@link ContextPredicateProvider#filter}
-	 */
-	@Parameters(name = "{index}: {0} in rule {1} expected to be invalid = {3}")
-	public static Iterable<Object[]> data1() {
-		return Arrays.asList(new Object[][] { //
-				/* testGuardScopingSuccess */
-				{ "[e1]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "[Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true }, //
-				{ "[e1 && e2]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "[e1 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "[Interface1.e4 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true }, //
-				/*
-				 * filter.put(key(ASSIGNMENT_EXPRESSION),
-				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-				 */
-				{ "myInt = 0", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt = Interface1.myInt2", ReactionEffect.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt = myOpp3()", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myBool = e1", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/*
-				 * filter.put(key(CONDITIONAL_EXPRESSION),
-				 * VARIABLES_AND_OPERATIONS)
-				 */
-				{ "myBool ? myOpp(1) : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myOpp4() ? myInt : myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-				{ "myBool ? e1 : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(LOGICAL_OR_EXPRESSION),
-				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-				 */
-				{ "myBool || Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myBool || myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myBool || e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/*
-				 * filter.put(key(LOGICAL_AND_EXPRESSION),
-				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-				 */
-				{ "myBool && Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myBool && myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myBool && e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/*
-				 * filter.put(key(BITWISE_XOR_EXPRESSION), VARIABLES)
-				 */
-				{ "myInt ^ Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "e1 ^ e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "myOpp(1) ^ myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(BITWISE_OR_EXPRESSION), VARIABLES)
-				 */
-				{ "myInt | Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "e1 | e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "myOpp(1) | myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(BITWISE_AND_EXPRESSION), VARIABLES)
-				 */
-				{ "myInt & Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "e1 & e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "myOpp(1) & myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(SHIFT_EXPRESSION), VARIABLES)
-				 */
-				{ "myInt << Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt >> Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "myOpp(1) >> myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "myOpp(1) << myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(LOGICAL_NOT_EXPRESSION),
-				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-				 */
-				{ "!Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true }, //
-				{ "!myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "!e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/*
-				 * filter.put(key(LOGICAL_RELATION_EXPRESSION),
-				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-				 */
-				{ "myInt < Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt < myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt > Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt > myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt <= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt <= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt >= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt >= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt == Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt == myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt != Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt != myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/*
-				 * filter.put(key(NUMERICAL_ADD_SUBTRACT_EXPRESSION),
-				 * VARIABLES_AND_OPERATIONS)
-				 */
-				{ "myInt + Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt - Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt - myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myOpp3() - myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "e1 + e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "e1 - e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION),
-				 * VARIABLES_AND_OPERATIONS)
-				 */
-				{ "myInt * Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myInt / Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
-						true }, //
-				{ "myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myInt / myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "e1 * e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "e1 / e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(NUMERICAL_UNARY_EXPRESSION),
-				 * VARIABLES_AND_OPERATIONS)
-				 */
-				{ "-myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "+myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "-myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "+myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				{ "-e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				{ "+e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
-				/*
-				 * filter.put(key(EVENT_VALUE_REFERENCE_EXPRESSION), EVENTS)
-				 */
-				{ "valueof(e2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				// { "valueof(myInt)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, // context predicates can't validate this expression. This will be done in the SText validation instead.
-				// { "valueof(myOpp3())", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, // context predicates can't validate this expression. This will be done in the SText validation instead.
-				/*
-				 * filter.put(key(VARIABLE_DEFINITION, TYPED_ELEMENT__TYPE),
-				 * TYPES)
-				 */
-				{ "var x : integer", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				/* filter.put(key(REGULAR_EVENT_SPEC), EVENTS) */
-				{ "e1 / myInt = 0", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true }, //
-				//{ "myOpp(4) / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true }, // context predicates can't validate this expression. This will be done in the SText validation instead.
-				//{ "myInt / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true }, // context predicates can't validate this expression. This will be done in the SText validation instead.
-		});
-	}
-}

+ 237 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextScopeProviderTest.java

@@ -0,0 +1,237 @@
+/** 
+ * Copyright (c) 2015 committers of YAKINDU 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:
+ * committers of YAKINDU - initial API and implementation
+ *
+*/
+package org.yakindu.sct.model.stext.test;
+
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.yakindu.base.expressions.expressions.Expression;
+import org.yakindu.sct.model.stext.expressions.STextExpressionParser.LinkingException;
+import org.yakindu.sct.model.stext.scoping.ContextPredicateProvider;
+import org.yakindu.sct.model.stext.stext.LocalReaction;
+import org.yakindu.sct.model.stext.stext.ReactionEffect;
+import org.yakindu.sct.model.stext.stext.ReactionTrigger;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
+import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * @author Johannes Dicks - Add tests covering {@link ContextPredicateProvider}
+ */
+@RunWith(Parameterized.class)
+public class STextScopeProviderTest extends AbstractSTextTest {
+
+	public static final String INTERNAL_SCOPE = "" + //
+			"internal: " + //
+			"	in event e1 : void" + //
+			"	in event e2 : void" + //
+			"	var myInt : integer" + //
+			"	var myBool : boolean" + //
+			"	operation myOpp(param1 : integer) : void" + //
+			"	operation myOpp3() : integer" + //
+			"	operation myOpp4() : boolean" + //
+			"	operation myOpp5() : integer";
+
+	public static final String INTERFACE_SCOPE = "" + //
+			"interface Interface1:" + //
+			"	in event e3 : void" + //
+			"	in event e4 : void" + //
+			"	var myInt2 : integer" + //
+			"	var myBool2 : boolean" + //
+			"	operation myOpp2(param1 : integer) : void";
+
+	public static final String INTERFACE_SCOPE_AND_INTERNAL_SCOPE = INTERNAL_SCOPE + "\n" + INTERFACE_SCOPE;
+
+	private String statement;
+	private String ruleName;
+	private String scopes;
+	private boolean isLinkable;
+	
+	public STextScopeProviderTest(String statement, String ruleName, String scopes, Boolean isLinkable) {
+		this.statement = statement;
+		this.ruleName = ruleName;
+		this.scopes = scopes;
+		this.isLinkable = isLinkable;
+
+		STextInjectorProvider provider = new STextInjectorProvider();
+		provider.getInjector().injectMembers(this);
+	}
+
+	@Test
+	public void test() {
+		try {
+			parseExpression(statement, ruleName, scopes);
+			if (!isLinkable)
+				fail(String.format(
+						"Expected not to be linkable [parse '%s' in rule '%s' for scope '%s' expected linkable = '%s']",
+						statement, ruleName, scopes, isLinkable));
+		} catch (LinkingException e) {
+			if (isLinkable)
+				throw new RuntimeException("Expected linkable but : "+e.getMessage(),e);
+		}
+	}
+
+	/**
+	 * @see {@link ContextPredicateProvider#filter}
+	 */
+	@Parameters(name = "{index}: parse {0} in rule {1} expected linkable = {3}")
+	public static Iterable<Object[]> data1() {
+		return Arrays
+				.asList(new Object[][]{//
+						/* testGuardScopingSuccess */
+						{"[e1]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"[Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true}, //
+						{"[e1 && e2]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"[e1 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"[Interface1.e4 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true}, //
+						/*
+						 * filter.put(key(ASSIGNMENT_EXPRESSION),
+						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+						 */
+						{"myInt = 0", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt = Interface1.myInt2", ReactionEffect.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt = myOpp3()", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myBool = e1", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						/*
+						 * filter.put(key(CONDITIONAL_EXPRESSION),
+						 * VARIABLES_AND_OPERATIONS)
+						 */
+						{"myBool ? myOpp(1) : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myOpp4() ? myInt : myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myBool ? e1 : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(LOGICAL_OR_EXPRESSION),
+						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+						 */
+						{"myInt || Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt || myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt || e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						/*
+						 * filter.put(key(LOGICAL_AND_EXPRESSION),
+						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+						 */
+						{"myInt && Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt && myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt && e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						/*
+						 * filter.put(key(BITWISE_XOR_EXPRESSION), VARIABLES)
+						 */
+						{"myInt ^ Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"e1 ^ e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myOpp1(1) ^ myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(BITWISE_OR_EXPRESSION), VARIABLES)
+						 */
+						{"myInt | Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"e1 | e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myOpp1(1) | myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(BITWISE_AND_EXPRESSION), VARIABLES)
+						 */
+						{"myInt & Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"e1 & e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myOpp1(1) & myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(SHIFT_EXPRESSION), VARIABLES)
+						 */
+						{"myInt << Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt >> Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myOpp1(1) >> myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myOpp1(1) << myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(LOGICAL_NOT_EXPRESSION),
+						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+						 */
+						{"!Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"!myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"!e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						/*
+						 * filter.put(key(LOGICAL_RELATION_EXPRESSION),
+						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+						 */
+						{"myInt < Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt < myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt < e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt > Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt > myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt > e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt <= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt <= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt <= e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt >= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt >= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt >= e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt == Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt == myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt == e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt != Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt != myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt != e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						/*
+						 * filter.put(key(NUMERICAL_ADD_SUBTRACT_EXPRESSION),
+						 * VARIABLES_AND_OPERATIONS)
+						 */
+						{"myInt + Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt - Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt - myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myOpp3() - myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"e1 + e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"e1 - e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION),
+						 * VARIABLES_AND_OPERATIONS)
+						 */
+						{"myInt * Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myInt / Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
+						{"myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myInt / myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"e1 * e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"e1 / e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(NUMERICAL_UNARY_EXPRESSION),
+						 * VARIABLES_AND_OPERATIONS)
+						 */
+						{"-myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"+myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"-myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"+myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"-e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"+e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(EVENT_VALUE_REFERENCE_EXPRESSION), EVENTS)
+						 */
+						{"valueof(e2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"valueof(myInt)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"valueof(myOpp3())", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/*
+						 * filter.put(key(VARIABLE_DEFINITION, TYPED_ELEMENT__TYPE),
+						 * TYPES)
+						 */
+						{"var x : integer", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"var x : e1", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						/* filter.put(key(REGULAR_EVENT_SPEC), EVENTS) */
+						{"e1 / myInt = 0", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+						{"myOpp(4) / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+						{"myInt / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false}, //
+		});
+	}
+}