<commit_before>/*
 * generated by Xtext 2.10.0
 */
package org.eclipse.cmf.occi.core.xtext.scoping

import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EReference
import org.eclipse.cmf.occi.core.ArrayType
import org.eclipse.cmf.occi.core.Kind
import org.eclipse.cmf.occi.core.Extension
import org.eclipse.emf.common.util.EList
import org.eclipse.xtext.scoping.IScope
import org.eclipse.xtext.resource.IEObjectDescription
import java.util.ArrayList
import org.eclipse.xtext.resource.EObjectDescription
import org.eclipse.xtext.naming.QualifiedName
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.xtext.scoping.impl.SimpleScope
import org.eclipse.cmf.occi.core.DataType
import org.eclipse.cmf.occi.core.Mixin
import org.eclipse.cmf.occi.core.Attribute
import org.eclipse.cmf.occi.core.Type
import org.eclipse.cmf.occi.core.Action
import org.eclipse.cmf.occi.core.FSM
import org.eclipse.cmf.occi.core.State
import org.eclipse.cmf.occi.core.EnumerationType
import org.eclipse.cmf.occi.core.Transition
import org.eclipse.cmf.occi.core.OCCIPackage
import org.eclipse.cmf.occi.core.RecordType
import org.eclipse.cmf.occi.core.Configuration
import org.eclipse.cmf.occi.core.Resource
import org.eclipse.cmf.occi.core.MixinBase
import org.eclipse.cmf.occi.core.Entity
import org.eclipse.cmf.occi.core.Link

/**
 * This class contains custom scoping description.
 * 
 * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
 * on how and when to use it.
 */
class OCCIScopeProvider extends AbstractOCCIScopeProvider {

	override getScope(EObject object, EReference ref) {
		// Configuration : ('use' '(' use+=[Extension|STRING] ( "," use+=[Extension|STRING])* ')' )?
		if (object instanceof Configuration) {
			return scope_Configuration_use(object as Configuration, ref)
		}
		// Resource: kind=[Kind|QualifiedID]
		if (object instanceof Resource) {
			return scope_Resource_kind(object as Resource, ref)
		}
		if (object instanceof Link) {
			// Link: kind=[Kind|QualifiedID]
			if (ref == OCCIPackage.Literals.ENTITY__KIND) {
				return scope_Link_kind(object as Link, ref)
			}
			// Link: target=[Resource|STRING]
			if (ref == OCCIPackage.Literals.LINK__TARGET) {
				return scope_Link_target(object as Link, ref)
			}
		}
		// MixinBase: mixin=[Mixin|QualifiedID]
		if (object instanceof MixinBase) {
			return scope_MixinBase_mixin(object as MixinBase, ref)
		}
		// Extension: ^import+=[Extension|STRING]
		if (object instanceof Extension) {
			return scope_Extension_import(object as Extension, ref)
		}
		// Kind: parent=[Kind|QualifiedID]
		// Kind: source=[Kind|QualifiedID]
		// Kind: target=[Kind|QualifiedID]
		if (object instanceof Kind) {
			return scopeForKind(object as Kind, ref)
		}
		if (object instanceof Mixin) {
			// Mixin: depends+=[Mixin|QualifiedID]
			if (ref == OCCIPackage.Literals.MIXIN__DEPENDS) {
				return scope_Mixin_depends(object as Mixin, ref)
			}
			// Mixin: applies+=[Kind|QualifiedID]
			if (ref == OCCIPackage.Literals.MIXIN__APPLIES) {
				return scope_Mixin_applies(object as Mixin, ref)
			}
		}
		// Attribute: type=[DataType|QualifiedID]
		// RecordField : type=[DataType|QualifiedID]
		if (object instanceof Attribute) {
			return scope_Attribute_type(object as Attribute, ref)
		}
		// FSM: attribute=[Attribute|QualifiedID]
		if (object instanceof FSM) {
			return scope_FSM_attribute(object as FSM, ref)
		}
		// State: literal=[EnumerationLiteral|QualifiedID]
		if (object instanceof State) {
			return scope_State_literal(object as State, ref)
		}
		if (object instanceof Transition) {
			// Transition: action=[Action|QualifiedID]
			if (ref == OCCIPackage.Literals.TRANSITION__TARGET) {
				return scope_Transition_target(object as Transition, ref)
			}
			// Transition: target=[State|QualifiedID]
			if (ref == OCCIPackage.Literals.TRANSITION__ACTION) {
				return scope_Transition_action(object as Transition, ref)
			}
		}
		// ArrayType: type=[DataType|QualifiedID]
		if (object instanceof ArrayType) {
			return scope_ArrayType_type(object as ArrayType, ref)
		}
		super.getScope(object, ref)
	}

	def scope_Link_target(Link link, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = (link.eContainer as Resource).eContainer as Configuration
		for (Resource resource : ext.resources) {
			res.add(EObjectDescription.create(resource.id, resource));
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Link_kind(Link link, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = (link.eContainer as Resource).eContainer as Configuration
		for (Extension importExtension : ext.use) {
			for (Kind k : importExtension.getKinds()) {
				res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_MixinBase_mixin(MixinBase base, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration config = (base.eContainer as Entity).eContainer as Configuration
		for (Mixin k : config.mixins) {
			res.add(EObjectDescription.create(k.name, k));
		}
		for (Extension useExtension : config.use) {
			for (Mixin kind : useExtension.mixins) {
				res.add(EObjectDescription.create(QualifiedName.create(useExtension.name, kind.name), kind));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Resource_kind(Resource resource, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = resource.eContainer as Configuration
		for (Extension importExtension : ext.use) {
			for (Kind k : importExtension.getKinds()) {
				res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Transition_action(Transition transition, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var State s = transition.eContainer as State
		var FSM fsm = s.eContainer as FSM
		var Kind k = fsm.eContainer as Kind
		for (action : k.actions) {
			res.add(EObjectDescription.create(QualifiedName.create(action.name), action))
		}
		return new SimpleScope(IScope.NULLSCOPE, res)
	}

	def scope_Transition_target(Transition transition, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var State s = transition.eContainer as State
		var FSM fsm = s.eContainer as FSM
		for (state : fsm.ownedState) {
			res.add(
				EObjectDescription.create(
					QualifiedName.create((state.literal.eContainer as EnumerationType).name, state.literal.name),
					state))
				}
				new SimpleScope(IScope.NULLSCOPE, res)
			}

			def scope_State_literal(State state, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var FSM fsm = state.eContainer as FSM
				var Kind kind = fsm.eContainer as Kind
				var Extension ext = kind.eContainer as Extension
				for (type : ext.types.filter[t|t instanceof EnumerationType]) {
					for (literal : (type as EnumerationType).literals) {
						res.add(EObjectDescription.create(QualifiedName.create(type.name, literal.name), literal));
					}

				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_FSM_attribute(FSM fsm, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Kind kind = fsm.eContainer as Kind
				for (attribute : kind.attributes) {
					res.add(EObjectDescription.create(QualifiedName.create(attribute.name.split("\\.")), attribute));
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_Mixin_applies(Mixin mixin, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = mixin.eContainer as Extension
				for (Kind k : ext.getKinds()) {
					res.add(EObjectDescription.create(QualifiedName.create(ext.name, k.name), k));
				}
				for (Extension importExtension : ext.getImport()) {
					for (Kind kind : importExtension.getKinds()) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.name, kind.name), kind));
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_Mixin_depends(Mixin mixin, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = mixin.eContainer as Extension
				for (Mixin k : ext.mixins) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k));
				}
				for (Extension importExtension : ext.getImport()) {
					for (Mixin k : importExtension.mixins) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def IScope scope_Configuration_use(Configuration config, EReference ref) {
				scopeForExtensions(config.use);
			}

			def IScope scope_Extension_import(Extension ext, EReference ref) {
				scopeForExtensions(ext.getImport());
			}

			def IScope scopeForExtensions(EList<Extension> extensions) {
				var ArrayList<IEObjectDescription> result = new ArrayList<IEObjectDescription>

				for (exte : extensions) {
					result.add(EObjectDescription.create(QualifiedName.create(EcoreUtil.getURI(exte).toString()), exte))
				}
				new SimpleScope(IScope.NULLSCOPE, result)
			}

			def IScope scopeForKind(Kind kind, EReference ref) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = kind.eContainer as Extension
				for (Kind k : ext.getKinds()) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (Kind k : importExtension.getKinds()) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.name, k.name), k))
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res)
			}

			def IScope scope_ArrayType_type(ArrayType arrayType, EReference ref) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = arrayType.eContainer as Extension
				for (DataType k : ext.types) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (DataType k : importExtension.types) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k))
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def IScope scope_Attribute_type(Attribute attribute, EReference ref) {
				if (attribute.eContainer instanceof Type) {
					new SimpleScope(IScope.NULLSCOPE, getTypes((attribute.eContainer as Type).eContainer as Extension));
				} else {
					if (attribute.eContainer instanceof Action) {
						new SimpleScope(IScope.NULLSCOPE,
							getTypes(((attribute.eContainer as Action).eContainer as Type).eContainer as Extension));
					} else {
						new SimpleScope(IScope.NULLSCOPE,
							getTypes((attribute.eContainer as RecordType).eContainer as Extension));
					}
				}

			}

			def ArrayList<IEObjectDescription> getTypes(Extension ext) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				for (DataType k : ext.types) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (DataType k : importExtension.types) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k))
					}
				}
				res
			}

		}
		<commit_msg>Fix mixinBase_mixin scopeprovider.<commit_after>/*
 * generated by Xtext 2.10.0
 */
package org.eclipse.cmf.occi.core.xtext.scoping

import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EReference
import org.eclipse.cmf.occi.core.ArrayType
import org.eclipse.cmf.occi.core.Kind
import org.eclipse.cmf.occi.core.Extension
import org.eclipse.emf.common.util.EList
import org.eclipse.xtext.scoping.IScope
import org.eclipse.xtext.resource.IEObjectDescription
import java.util.ArrayList
import org.eclipse.xtext.resource.EObjectDescription
import org.eclipse.xtext.naming.QualifiedName
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.xtext.scoping.impl.SimpleScope
import org.eclipse.cmf.occi.core.DataType
import org.eclipse.cmf.occi.core.Mixin
import org.eclipse.cmf.occi.core.Attribute
import org.eclipse.cmf.occi.core.Type
import org.eclipse.cmf.occi.core.Action
import org.eclipse.cmf.occi.core.FSM
import org.eclipse.cmf.occi.core.State
import org.eclipse.cmf.occi.core.EnumerationType
import org.eclipse.cmf.occi.core.Transition
import org.eclipse.cmf.occi.core.OCCIPackage
import org.eclipse.cmf.occi.core.RecordType
import org.eclipse.cmf.occi.core.Configuration
import org.eclipse.cmf.occi.core.Resource
import org.eclipse.cmf.occi.core.MixinBase
import org.eclipse.cmf.occi.core.Entity
import org.eclipse.cmf.occi.core.Link

/**
 * This class contains custom scoping description.
 * 
 * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
 * on how and when to use it.
 */
class OCCIScopeProvider extends AbstractOCCIScopeProvider {

	override getScope(EObject object, EReference ref) {
		// Configuration : ('use' '(' use+=[Extension|STRING] ( "," use+=[Extension|STRING])* ')' )?
		if (object instanceof Configuration) {
			return scope_Configuration_use(object as Configuration, ref)
		}
		// Resource: kind=[Kind|QualifiedID]
		if (object instanceof Resource) {
			return scope_Resource_kind(object as Resource, ref)
		}
		if (object instanceof Link) {
			// Link: kind=[Kind|QualifiedID]
			if (ref == OCCIPackage.Literals.ENTITY__KIND) {
				return scope_Link_kind(object as Link, ref)
			}
			// Link: target=[Resource|STRING]
			if (ref == OCCIPackage.Literals.LINK__TARGET) {
				return scope_Link_target(object as Link, ref)
			}
		}
		// MixinBase: mixin=[Mixin|QualifiedID]
		if (object instanceof MixinBase) {
			return scope_MixinBase_mixin(object as MixinBase, ref)
		}
		// Extension: ^import+=[Extension|STRING]
		if (object instanceof Extension) {
			return scope_Extension_import(object as Extension, ref)
		}
		// Kind: parent=[Kind|QualifiedID]
		// Kind: source=[Kind|QualifiedID]
		// Kind: target=[Kind|QualifiedID]
		if (object instanceof Kind) {
			return scopeForKind(object as Kind, ref)
		}
		if (object instanceof Mixin) {
			// Mixin: depends+=[Mixin|QualifiedID]
			if (ref == OCCIPackage.Literals.MIXIN__DEPENDS) {
				return scope_Mixin_depends(object as Mixin, ref)
			}
			// Mixin: applies+=[Kind|QualifiedID]
			if (ref == OCCIPackage.Literals.MIXIN__APPLIES) {
				return scope_Mixin_applies(object as Mixin, ref)
			}
		}
		// Attribute: type=[DataType|QualifiedID]
		// RecordField : type=[DataType|QualifiedID]
		if (object instanceof Attribute) {
			return scope_Attribute_type(object as Attribute, ref)
		}
		// FSM: attribute=[Attribute|QualifiedID]
		if (object instanceof FSM) {
			return scope_FSM_attribute(object as FSM, ref)
		}
		// State: literal=[EnumerationLiteral|QualifiedID]
		if (object instanceof State) {
			return scope_State_literal(object as State, ref)
		}
		if (object instanceof Transition) {
			// Transition: action=[Action|QualifiedID]
			if (ref == OCCIPackage.Literals.TRANSITION__TARGET) {
				return scope_Transition_target(object as Transition, ref)
			}
			// Transition: target=[State|QualifiedID]
			if (ref == OCCIPackage.Literals.TRANSITION__ACTION) {
				return scope_Transition_action(object as Transition, ref)
			}
		}
		// ArrayType: type=[DataType|QualifiedID]
		if (object instanceof ArrayType) {
			return scope_ArrayType_type(object as ArrayType, ref)
		}
		super.getScope(object, ref)
	}

	def scope_Link_target(Link link, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = (link.eContainer as Resource).eContainer as Configuration
		for (Resource resource : ext.resources) {
			res.add(EObjectDescription.create(resource.id, resource));
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Link_kind(Link link, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = (link.eContainer as Resource).eContainer as Configuration
		for (Extension importExtension : ext.use) {
			for (Kind k : importExtension.getKinds()) {
				res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_MixinBase_mixin(MixinBase base, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration config
		if((base.eContainer as Entity).eContainer instanceof Configuration){
			config = (base.eContainer as Entity).eContainer as Configuration 
		}
		else{
			config = ((base.eContainer as Entity).eContainer as Resource).eContainer as Configuration
		}
		for (Mixin k : config.mixins) {
			res.add(EObjectDescription.create(k.name, k));
		}
		for (Extension useExtension : config.use) {
			for (Mixin kind : useExtension.mixins) {
				res.add(EObjectDescription.create(QualifiedName.create(useExtension.name, kind.name), kind));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Resource_kind(Resource resource, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var Configuration ext = resource.eContainer as Configuration
		for (Extension importExtension : ext.use) {
			for (Kind k : importExtension.getKinds()) {
				res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
			}
		}
		new SimpleScope(IScope.NULLSCOPE, res);
	}

	def scope_Transition_action(Transition transition, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var State s = transition.eContainer as State
		var FSM fsm = s.eContainer as FSM
		var Kind k = fsm.eContainer as Kind
		for (action : k.actions) {
			res.add(EObjectDescription.create(QualifiedName.create(action.name), action))
		}
		return new SimpleScope(IScope.NULLSCOPE, res)
	}

	def scope_Transition_target(Transition transition, EReference reference) {
		var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
		var State s = transition.eContainer as State
		var FSM fsm = s.eContainer as FSM
		for (state : fsm.ownedState) {
			res.add(
				EObjectDescription.create(
					QualifiedName.create((state.literal.eContainer as EnumerationType).name, state.literal.name),
					state))
				}
				new SimpleScope(IScope.NULLSCOPE, res)
			}

			def scope_State_literal(State state, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var FSM fsm = state.eContainer as FSM
				var Kind kind = fsm.eContainer as Kind
				var Extension ext = kind.eContainer as Extension
				for (type : ext.types.filter[t|t instanceof EnumerationType]) {
					for (literal : (type as EnumerationType).literals) {
						res.add(EObjectDescription.create(QualifiedName.create(type.name, literal.name), literal));
					}

				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_FSM_attribute(FSM fsm, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Kind kind = fsm.eContainer as Kind
				for (attribute : kind.attributes) {
					res.add(EObjectDescription.create(QualifiedName.create(attribute.name.split("\\.")), attribute));
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_Mixin_applies(Mixin mixin, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = mixin.eContainer as Extension
				for (Kind k : ext.getKinds()) {
					res.add(EObjectDescription.create(QualifiedName.create(ext.name, k.name), k));
				}
				for (Extension importExtension : ext.getImport()) {
					for (Kind kind : importExtension.getKinds()) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.name, kind.name), kind));
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def scope_Mixin_depends(Mixin mixin, EReference reference) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = mixin.eContainer as Extension
				for (Mixin k : ext.mixins) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k));
				}
				for (Extension importExtension : ext.getImport()) {
					for (Mixin k : importExtension.mixins) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k));
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def IScope scope_Configuration_use(Configuration config, EReference ref) {
				scopeForExtensions(config.use);
			}

			def IScope scope_Extension_import(Extension ext, EReference ref) {
				scopeForExtensions(ext.getImport());
			}

			def IScope scopeForExtensions(EList<Extension> extensions) {
				var ArrayList<IEObjectDescription> result = new ArrayList<IEObjectDescription>

				for (exte : extensions) {
					result.add(EObjectDescription.create(QualifiedName.create(EcoreUtil.getURI(exte).toString()), exte))
				}
				new SimpleScope(IScope.NULLSCOPE, result)
			}

			def IScope scopeForKind(Kind kind, EReference ref) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = kind.eContainer as Extension
				for (Kind k : ext.getKinds()) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (Kind k : importExtension.getKinds()) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.name, k.name), k))
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res)
			}

			def IScope scope_ArrayType_type(ArrayType arrayType, EReference ref) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				var Extension ext = arrayType.eContainer as Extension
				for (DataType k : ext.types) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (DataType k : importExtension.types) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k))
					}
				}
				new SimpleScope(IScope.NULLSCOPE, res);
			}

			def IScope scope_Attribute_type(Attribute attribute, EReference ref) {
				if (attribute.eContainer instanceof Type) {
					new SimpleScope(IScope.NULLSCOPE, getTypes((attribute.eContainer as Type).eContainer as Extension));
				} else {
					if (attribute.eContainer instanceof Action) {
						new SimpleScope(IScope.NULLSCOPE,
							getTypes(((attribute.eContainer as Action).eContainer as Type).eContainer as Extension));
					} else {
						new SimpleScope(IScope.NULLSCOPE,
							getTypes((attribute.eContainer as RecordType).eContainer as Extension));
					}
				}

			}

			def ArrayList<IEObjectDescription> getTypes(Extension ext) {
				var ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>
				for (DataType k : ext.types) {
					res.add(EObjectDescription.create(QualifiedName.create(k.name), k))
				}
				for (Extension importExtension : ext.getImport()) {
					for (DataType k : importExtension.types) {
						res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k.name), k))
					}
				}
				res
			}

		}
		
{'fraction_non_alphanumeric': 0.10742661202642803, 'fraction_numerical': 0.0005854311282094171, 'mean_word_length': 4.326280623608018, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5716509', 'n_tokens_mistral': 8538, 'n_tokens_neox': 7371, 'n_words': 1579}