Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-ocl.dev] Xtext OCL editors progress

Hi

I think that the CompleteOCL and OCLinEcore editors are now useful and probably won't let users down badly. I've used them extensively without crashes. The CompleteOCL editor has found at least 100 bugs in the OCL 2.1 spec after cutting and pasting sections of the OCL spec; and that's just with syntactic checking. Semantic checking soon. There are some background NPEs and console noise to sort out, seemingly in the scope resolution area that I must look at to support semantics properly.

The OCLinEcore now uses an OMG specification-style encapsulation for its OCL, rather than Emfatic which is philosophically inconsistent: "ordered type[*] name" rather than "name : type[*] {ordered}", and even heavier with @annotation prefixes. You can 'successfully' Open With->OCLinEcore Editor on Ecore.ecore or OCL.ecore, and if you want there is currently a Save As OCLinEcore on the top level DocumentCS outline context menu. Otherwise OCLinEcore saves back where it loaded from in XMI or text as appropriate. The auto-pretty-printed Ecore.oclinecore attached to show the principle. [Now is a good time to revise the syntax.]

The ANTLr grammars are huge, 3.4MB for one Java file, and three rules blew their 65536 character limit when all non-reserved words were declared. I hope this problem will go away when semantics are correctly exploited.

With a little over 2 weeks to go to M7, it seems better to incorporate the examples editors into the build now so that build ripples are resolved well before M7. The fixes to support semantic assistance should not impact on the build.

Any objections to extending the build?

    Regards

        Ed Willink
import ecore : "http://www.eclipse.org/emf/2002/Ecore";;
package ecore : ecore = "http://www.eclipse.org/emf/2002/Ecore";
{
  class EAttribute extends EStructuralFeature
  {
    invariant ConsistentTransient:;
    attribute iD : EBoolean[?];
    property eAttributeType : EDataType[1] {readonly,derived,transient,volatile};
  }
  class EAnnotation extends EModelElement
  {
    invariant WellFormedSourceURI:;
    attribute source : EString[?];
    property details : EStringToStringMapEntry[*] {composes,!resolve};
    property eModelElement#eAnnotations : EModelElement[?] {transient,!resolve};
    property contents : EObject[*] {composes,!resolve};
    property references : EObject[*];
  }
  class EClass extends EClassifier
  {
    invariant InterfaceIsAbstract:;
    invariant AtMostOneID:;
    invariant UniqueFeatureNames:;
    invariant UniqueOperationSignatures:;
    invariant NoCircularSuperTypes:;
    invariant WellFormedMapEntryClass:;
    invariant ConsistentSuperTypes:;
    invariant DisjointFeatureAndOperationSignatures:;
    attribute abstract : EBoolean[?];
    attribute interface : EBoolean[?];
    property eSuperTypes : EClass[*] {unsettable}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    property eOperations#eContainingClass : EOperation[*] {composes,!resolve};
    property eAllAttributes : EAttribute[*] {readonly,derived,transient,volatile};
    property eAllReferences : EReference[*] {readonly,derived,transient,volatile};
    property eReferences : EReference[*] {readonly,derived,transient,volatile};
    property eAttributes : EAttribute[*] {readonly,derived,transient,volatile};
    property eAllContainments : EReference[*] {readonly,derived,transient,volatile};
    property eAllOperations : EOperation[*] {readonly,derived,transient,volatile};
    property eAllStructuralFeatures : EStructuralFeature[*] {readonly,derived,transient,volatile};
    property eAllSuperTypes : EClass[*] {readonly,derived,transient,volatile};
    property eIDAttribute : EAttribute[?] {readonly,derived,transient,volatile,!resolve};
    property eStructuralFeatures#eContainingClass : EStructuralFeature[*] {composes,!resolve};
    property eGenericSuperTypes : EGenericType[*] {unsettable,composes,!resolve}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    property eAllGenericSuperTypes : EGenericType[*] {readonly,derived,transient,volatile};
    operation isSuperTypeOf(someClass : EClass[?]) : EBoolean[?];
    operation getFeatureCount() : EInt[?];
    operation getEStructuralFeature(featureID : EInt[?]) : EStructuralFeature[?];
    operation getFeatureID(feature : EStructuralFeature[?]) : EInt[?];
    operation getEStructuralFeature(featureName : EString[?]) : EStructuralFeature[?];
    operation getOperationCount() : EInt[?];
    operation getEOperation(operationID : EInt[?]) : EOperation[?];
    operation getOperationID(operation : EOperation[?]) : EInt[?];
    operation getOverride(operation : EOperation[?]) : EOperation[?];
  }
  class EClassifier extends ENamedElement {abstract}
  {
    invariant WellFormedInstanceTypeName:;
    invariant UniqueTypeParameterNames:;
    attribute instanceClassName : EString[?] {unsettable,volatile}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    attribute instanceClass : EJavaClass<?>[?] {readonly,derived,transient,volatile};
    attribute defaultValue : EJavaObject[?] {readonly,derived,transient,volatile};
    attribute instanceTypeName : EString[?] {unsettable,volatile}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    property ePackage#eClassifiers : EPackage[?] {readonly,transient};
    property eTypeParameters : ETypeParameter[*] {composes};
    operation isInstance(object : EJavaObject[?]) : EBoolean[?];
    operation getClassifierID() : EInt[?];
  }
  class EDataType extends EClassifier
  {
    attribute serializable : EBoolean[?] = "true";
  }
  class EEnum extends EDataType
  {
    invariant UniqueEnumeratorNames:;
    invariant UniqueEnumeratorLiterals:;
    property eLiterals#eEnum : EEnumLiteral[*] {composes,!resolve};
    operation getEEnumLiteral(name : EString[?]) : EEnumLiteral[?];
    operation getEEnumLiteral(value : EInt[?]) : EEnumLiteral[?];
    operation getEEnumLiteralByLiteral(literal : EString[?]) : EEnumLiteral[?];
  }
  class EEnumLiteral extends ENamedElement
  {
    attribute value : EInt[?];
    attribute instance : EEnumerator[?] {transient};
    attribute literal : EString[?];
    property eEnum#eLiterals : EEnum[?] {readonly,transient,!resolve};
  }
  class EFactory extends EModelElement
  {
    property ePackage#eFactoryInstance : EPackage[1] {transient,!resolve};
    operation create(eClass : EClass[?]) : EObject[?];
    operation createFromString(eDataType : EDataType[?], literalValue : EString[?]) : EJavaObject[?];
    operation convertToString(eDataType : EDataType[?], instanceValue : EJavaObject[?]) : EString[?];
  }
  class EModelElement {abstract}
  {
    property eAnnotations#eModelElement : EAnnotation[*] {composes,!resolve};
    operation getEAnnotation(source : EString[?]) : EAnnotation[?];
  }
  class ENamedElement extends EModelElement {abstract}
  {
    invariant WellFormedName:;
    attribute name : EString[?];
  }
  class EObject
  {
    operation eClass() : EClass[?];
    operation eIsProxy() : EBoolean[?];
    operation eResource() : EResource[?];
    operation eContainer() : EObject[?];
    operation eContainingFeature() : EStructuralFeature[?];
    operation eContainmentFeature() : EReference[?];
    operation eContents() : EEList<EObject>[?];
    operation eAllContents() : ETreeIterator<EObject>[?];
    operation eCrossReferences() : EEList<EObject>[?];
    operation eGet(feature : EStructuralFeature[?]) : EJavaObject[?];
    operation eGet(feature : EStructuralFeature[?], resolve : EBoolean[?]) : EJavaObject[?];
    operation eSet(feature : EStructuralFeature[?], newValue : EJavaObject[?]) :[?];
    operation eIsSet(feature : EStructuralFeature[?]) : EBoolean[?];
    operation eUnset(feature : EStructuralFeature[?]) :[?];
    operation eInvoke(operation : EOperation[?], arguments : ecore::EEList<?>[?]) : EJavaObject[?] throws EInvocationTargetException;
  }
  class EOperation extends ETypedElement
  {
    invariant UniqueParameterNames:;
    invariant UniqueTypeParameterNames:;
    invariant NoRepeatingVoid:;
    property eContainingClass#eOperations : EClass[?] {readonly,transient,!resolve};
    property eTypeParameters : ETypeParameter[*] {composes};
    property eParameters#eOperation : EParameter[*] {composes,!resolve};
    property eExceptions : EClassifier[*] {unsettable}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    property eGenericExceptions : EGenericType[*] {unsettable,composes,!resolve}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    operation getOperationID() : EInt[?];
    operation isOverrideOf(someOperation : EOperation[?]) : EBoolean[?];
  }
  class EPackage extends ENamedElement
  {
    invariant WellFormedNsURI:;
    invariant WellFormedNsPrefix:;
    invariant UniqueSubpackageNames:;
    invariant UniqueClassifierNames:;
    invariant UniqueNsURIs:;
    attribute nsURI : EString[?];
    attribute nsPrefix : EString[?];
    property eFactoryInstance#ePackage : EFactory[1] {transient,!resolve};
    property eClassifiers#ePackage : EClassifier[*] {composes};
    property eSubpackages#eSuperPackage : EPackage[*] {composes};
    property eSuperPackage#eSubpackages : EPackage[?] {readonly,transient};
    operation getEClassifier(name : EString[?]) : EClassifier[?];
  }
  class EParameter extends ETypedElement
  {
    property eOperation#eParameters : EOperation[?] {readonly,transient,!resolve};
  }
  class EReference extends EStructuralFeature
  {
    invariant ConsistentOpposite:;
    invariant SingleContainer:;
    invariant ConsistentKeys:;
    invariant ConsistentUnique:;
    attribute containment : EBoolean[?];
    attribute container : EBoolean[?] {readonly,derived,transient,volatile};
    attribute resolveProxies : EBoolean[?] = "true";
    property eOpposite : EReference[?];
    property eReferenceType : EClass[1] {readonly,derived,transient,volatile};
    property eKeys : EAttribute[*];
  }
  class EStructuralFeature extends ETypedElement {abstract}
  {
    invariant ValidDefaultValueLiteral:;
    attribute changeable : EBoolean[?] = "true";
    attribute volatile : EBoolean[?];
    attribute transient : EBoolean[?];
    attribute defaultValueLiteral : EString[?];
    attribute defaultValue : EJavaObject[?] {readonly,derived,transient,volatile};
    attribute unsettable : EBoolean[?];
    attribute derived : EBoolean[?];
    property eContainingClass#eStructuralFeatures : EClass[?] {readonly,transient,!resolve};
    operation getFeatureID() : EInt[?];
    operation getContainerClass() : EJavaClass<?>[?];
  }
  class ETypedElement extends ENamedElement {abstract}
  {
    invariant ValidLowerBound:;
    invariant ValidUpperBound:;
    invariant ConsistentBounds:;
    invariant ValidType:;
    attribute ordered : EBoolean[?] = "true";
    attribute unique : EBoolean[?] = "true";
    attribute lowerBound : EInt[?];
    attribute upperBound : EInt[?] = "1";
    attribute many : EBoolean[?] {readonly,derived,transient,volatile};
    attribute required : EBoolean[?] {readonly,derived,transient,volatile};
    property eType : EClassifier[?] {unsettable,volatile}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
    property eGenericType : EGenericType[?] {unsettable,volatile,composes,!resolve}
    {
      documentation(suppressedIsSetVisibility = 'true' , suppressedUnsetVisibility = 'true');
    }
  }
  datatype EBigDecimal : "java.math.BigDecimal"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#decimal');
  }
  datatype EBigInteger : "java.math.BigInteger"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#integer');
  }
  datatype EBoolean : "boolean"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#boolean');
  }
  datatype EBooleanObject : "java.lang.Boolean"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EBoolean', name = 'EBoolean:Object');
  }
  datatype EByte : "byte"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#byte');
  }
  datatype EByteArray : "byte[]"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#hexBinary');
  }
  datatype EByteObject : "java.lang.Byte"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EByte', name = 'EByte:Object');
  }
  datatype EChar : "char";
  datatype ECharacterObject : "java.lang.Character"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EChar', name = 'EChar:Object');
  }
  datatype EDate : "java.util.Date";
  datatype EDiagnosticChain : "org.eclipse.emf.common.util.DiagnosticChain" {!serializable};
  datatype EDouble : "double"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#double');
  }
  datatype EDoubleObject : "java.lang.Double"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EDouble', name = 'EDouble:Object');
  }
  datatype EEList<E> : "org.eclipse.emf.common.util.EList" {!serializable};
  datatype EEnumerator : "org.eclipse.emf.common.util.Enumerator" {!serializable};
  datatype EFeatureMap : "org.eclipse.emf.ecore.util.FeatureMap" {!serializable};
  datatype EFeatureMapEntry : "org.eclipse.emf.ecore.util.FeatureMap$Entry" {!serializable};
  datatype EFloat : "float"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#float');
  }
  datatype EFloatObject : "java.lang.Float"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EFloat', name = 'EFloat:Object');
  }
  datatype EInt : "int"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#int');
  }
  datatype EIntegerObject : "java.lang.Integer"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EInt', name = 'EInt:Object');
  }
  datatype EJavaClass<T> : "java.lang.Class";
  datatype EJavaObject : "java.lang.Object";
  datatype ELong : "long"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#long');
  }
  datatype ELongObject : "java.lang.Long"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'ELong', name = 'ELong:Object');
  }
  datatype EMap<K, V> : "java.util.Map" {!serializable};
  datatype EResource : "org.eclipse.emf.ecore.resource.Resource" {!serializable};
  datatype EResourceSet : "org.eclipse.emf.ecore.resource.ResourceSet" {!serializable};
  datatype EShort : "short"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#short');
  }
  datatype EShortObject : "java.lang.Short"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'EShort', name = 'EShort:Object');
  }
  datatype EString : "java.lang.String"
  {
    annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";(baseType = 'http://www.w3.org/2001/XMLSchema#string');
  }
  class EStringToStringMapEntry : "java.util.Map$Entry"
  {
    attribute key : EString[?];
    attribute value : EString[?];
  }
  datatype ETreeIterator<E> : "org.eclipse.emf.common.util.TreeIterator" {!serializable};
  class EGenericType
  {
    invariant ConsistentType:;
    invariant ConsistentBounds:;
    invariant ConsistentArguments:;
    property eUpperBound : EGenericType[?] {composes,!resolve};
    property eTypeArguments : EGenericType[*] {composes,!resolve};
    property eRawType : EClassifier[1] {readonly,derived,transient};
    property eLowerBound : EGenericType[?] {composes,!resolve};
    property eTypeParameter : ETypeParameter[?] {!resolve};
    property eClassifier : EClassifier[?];
  }
  class ETypeParameter extends ENamedElement
  {
    property eBounds : EGenericType[*] {composes,!resolve};
  }
  datatype EInvocationTargetException : "java.lang.reflect.InvocationTargetException" {!serializable};
}

Back to the top