added token limit & debug flag to grammar ecore model

This commit is contained in:
overflowerror 2022-01-16 18:22:19 +01:00
parent 623f4b69ae
commit e317d65b45
6 changed files with 243 additions and 1 deletions

View file

@ -22,6 +22,8 @@ import org.eclipse.emf.ecore.EObject;
* <li>{@link org.eclipse.xtext.Grammar#getMetamodelDeclarations <em>Metamodel Declarations</em>}</li> * <li>{@link org.eclipse.xtext.Grammar#getMetamodelDeclarations <em>Metamodel Declarations</em>}</li>
* <li>{@link org.eclipse.xtext.Grammar#getRules <em>Rules</em>}</li> * <li>{@link org.eclipse.xtext.Grammar#getRules <em>Rules</em>}</li>
* <li>{@link org.eclipse.xtext.Grammar#getInitBlock <em>Init Block</em>}</li> * <li>{@link org.eclipse.xtext.Grammar#getInitBlock <em>Init Block</em>}</li>
* <li>{@link org.eclipse.xtext.Grammar#getTokenLimit <em>Token Limit</em>}</li>
* <li>{@link org.eclipse.xtext.Grammar#isDebug <em>Debug</em>}</li>
* </ul> * </ul>
* *
* @see org.eclipse.xtext.XtextPackage#getGrammar() * @see org.eclipse.xtext.XtextPackage#getGrammar()
@ -167,4 +169,48 @@ public interface Grammar extends EObject {
*/ */
void setInitBlock(InitBlock value); void setInitBlock(InitBlock value);
/**
* Returns the value of the '<em><b>Token Limit</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Token Limit</em>' attribute.
* @see #setTokenLimit(int)
* @see org.eclipse.xtext.XtextPackage#getGrammar_TokenLimit()
* @model
* @generated
*/
int getTokenLimit();
/**
* Sets the value of the '{@link org.eclipse.xtext.Grammar#getTokenLimit <em>Token Limit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Token Limit</em>' attribute.
* @see #getTokenLimit()
* @generated
*/
void setTokenLimit(int value);
/**
* Returns the value of the '<em><b>Debug</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Debug</em>' attribute.
* @see #setDebug(boolean)
* @see org.eclipse.xtext.XtextPackage#getGrammar_Debug()
* @model
* @generated
*/
boolean isDebug();
/**
* Sets the value of the '{@link org.eclipse.xtext.Grammar#isDebug <em>Debug</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Debug</em>' attribute.
* @see #isDebug()
* @generated
*/
void setDebug(boolean value);
} // Grammar } // Grammar

View file

@ -130,6 +130,24 @@ public interface XtextPackage extends EPackage {
*/ */
int GRAMMAR__INIT_BLOCK = 6; int GRAMMAR__INIT_BLOCK = 6;
/**
* The feature id for the '<em><b>Token Limit</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GRAMMAR__TOKEN_LIMIT = 7;
/**
* The feature id for the '<em><b>Debug</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GRAMMAR__DEBUG = 8;
/** /**
* The number of structural features of the '<em>Grammar</em>' class. * The number of structural features of the '<em>Grammar</em>' class.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
@ -137,7 +155,7 @@ public interface XtextPackage extends EPackage {
* @generated * @generated
* @ordered * @ordered
*/ */
int GRAMMAR_FEATURE_COUNT = 7; int GRAMMAR_FEATURE_COUNT = 9;
/** /**
* The meta object id for the '{@link org.eclipse.xtext.impl.AbstractRuleImpl <em>Abstract Rule</em>}' class. * The meta object id for the '{@link org.eclipse.xtext.impl.AbstractRuleImpl <em>Abstract Rule</em>}' class.
@ -2305,6 +2323,28 @@ public interface XtextPackage extends EPackage {
*/ */
EReference getGrammar_InitBlock(); EReference getGrammar_InitBlock();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.Grammar#getTokenLimit <em>Token Limit</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Token Limit</em>'.
* @see org.eclipse.xtext.Grammar#getTokenLimit()
* @see #getGrammar()
* @generated
*/
EAttribute getGrammar_TokenLimit();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.Grammar#isDebug <em>Debug</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Debug</em>'.
* @see org.eclipse.xtext.Grammar#isDebug()
* @see #getGrammar()
* @generated
*/
EAttribute getGrammar_Debug();
/** /**
* Returns the meta object for class '{@link org.eclipse.xtext.AbstractRule <em>Abstract Rule</em>}'. * Returns the meta object for class '{@link org.eclipse.xtext.AbstractRule <em>Abstract Rule</em>}'.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
@ -3389,6 +3429,22 @@ public interface XtextPackage extends EPackage {
*/ */
EReference GRAMMAR__INIT_BLOCK = eINSTANCE.getGrammar_InitBlock(); EReference GRAMMAR__INIT_BLOCK = eINSTANCE.getGrammar_InitBlock();
/**
* The meta object literal for the '<em><b>Token Limit</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GRAMMAR__TOKEN_LIMIT = eINSTANCE.getGrammar_TokenLimit();
/**
* The meta object literal for the '<em><b>Debug</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GRAMMAR__DEBUG = eINSTANCE.getGrammar_Debug();
/** /**
* The meta object literal for the '{@link org.eclipse.xtext.impl.AbstractRuleImpl <em>Abstract Rule</em>}' class. * The meta object literal for the '{@link org.eclipse.xtext.impl.AbstractRuleImpl <em>Abstract Rule</em>}' class.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->

View file

@ -41,6 +41,8 @@ import org.eclipse.xtext.XtextPackage;
* <li>{@link org.eclipse.xtext.impl.GrammarImpl#getMetamodelDeclarations <em>Metamodel Declarations</em>}</li> * <li>{@link org.eclipse.xtext.impl.GrammarImpl#getMetamodelDeclarations <em>Metamodel Declarations</em>}</li>
* <li>{@link org.eclipse.xtext.impl.GrammarImpl#getRules <em>Rules</em>}</li> * <li>{@link org.eclipse.xtext.impl.GrammarImpl#getRules <em>Rules</em>}</li>
* <li>{@link org.eclipse.xtext.impl.GrammarImpl#getInitBlock <em>Init Block</em>}</li> * <li>{@link org.eclipse.xtext.impl.GrammarImpl#getInitBlock <em>Init Block</em>}</li>
* <li>{@link org.eclipse.xtext.impl.GrammarImpl#getTokenLimit <em>Token Limit</em>}</li>
* <li>{@link org.eclipse.xtext.impl.GrammarImpl#isDebug <em>Debug</em>}</li>
* </ul> * </ul>
* *
* @generated * @generated
@ -136,6 +138,46 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
*/ */
protected InitBlock initBlock; protected InitBlock initBlock;
/**
* The default value of the '{@link #getTokenLimit() <em>Token Limit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTokenLimit()
* @generated
* @ordered
*/
protected static final int TOKEN_LIMIT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getTokenLimit() <em>Token Limit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTokenLimit()
* @generated
* @ordered
*/
protected int tokenLimit = TOKEN_LIMIT_EDEFAULT;
/**
* The default value of the '{@link #isDebug() <em>Debug</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDebug()
* @generated
* @ordered
*/
protected static final boolean DEBUG_EDEFAULT = false;
/**
* The cached value of the '{@link #isDebug() <em>Debug</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDebug()
* @generated
* @ordered
*/
protected boolean debug = DEBUG_EDEFAULT;
/** /**
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
@ -298,6 +340,52 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GRAMMAR__INIT_BLOCK, newInitBlock, newInitBlock)); eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GRAMMAR__INIT_BLOCK, newInitBlock, newInitBlock));
} }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int getTokenLimit() {
return tokenLimit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTokenLimit(int newTokenLimit) {
int oldTokenLimit = tokenLimit;
tokenLimit = newTokenLimit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GRAMMAR__TOKEN_LIMIT, oldTokenLimit, tokenLimit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isDebug() {
return debug;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDebug(boolean newDebug) {
boolean oldDebug = debug;
debug = newDebug;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GRAMMAR__DEBUG, oldDebug, debug));
}
/** /**
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
@ -338,6 +426,10 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
return getRules(); return getRules();
case XtextPackage.GRAMMAR__INIT_BLOCK: case XtextPackage.GRAMMAR__INIT_BLOCK:
return getInitBlock(); return getInitBlock();
case XtextPackage.GRAMMAR__TOKEN_LIMIT:
return getTokenLimit();
case XtextPackage.GRAMMAR__DEBUG:
return isDebug();
} }
return super.eGet(featureID, resolve, coreType); return super.eGet(featureID, resolve, coreType);
} }
@ -376,6 +468,12 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
case XtextPackage.GRAMMAR__INIT_BLOCK: case XtextPackage.GRAMMAR__INIT_BLOCK:
setInitBlock((InitBlock)newValue); setInitBlock((InitBlock)newValue);
return; return;
case XtextPackage.GRAMMAR__TOKEN_LIMIT:
setTokenLimit((Integer)newValue);
return;
case XtextPackage.GRAMMAR__DEBUG:
setDebug((Boolean)newValue);
return;
} }
super.eSet(featureID, newValue); super.eSet(featureID, newValue);
} }
@ -409,6 +507,12 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
case XtextPackage.GRAMMAR__INIT_BLOCK: case XtextPackage.GRAMMAR__INIT_BLOCK:
setInitBlock((InitBlock)null); setInitBlock((InitBlock)null);
return; return;
case XtextPackage.GRAMMAR__TOKEN_LIMIT:
setTokenLimit(TOKEN_LIMIT_EDEFAULT);
return;
case XtextPackage.GRAMMAR__DEBUG:
setDebug(DEBUG_EDEFAULT);
return;
} }
super.eUnset(featureID); super.eUnset(featureID);
} }
@ -435,6 +539,10 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
return rules != null && !rules.isEmpty(); return rules != null && !rules.isEmpty();
case XtextPackage.GRAMMAR__INIT_BLOCK: case XtextPackage.GRAMMAR__INIT_BLOCK:
return initBlock != null; return initBlock != null;
case XtextPackage.GRAMMAR__TOKEN_LIMIT:
return tokenLimit != TOKEN_LIMIT_EDEFAULT;
case XtextPackage.GRAMMAR__DEBUG:
return debug != DEBUG_EDEFAULT;
} }
return super.eIsSet(featureID); return super.eIsSet(featureID);
} }
@ -453,6 +561,10 @@ public class GrammarImpl extends MinimalEObjectImpl.Container implements Grammar
result.append(name); result.append(name);
result.append(", definesHiddenTokens: "); result.append(", definesHiddenTokens: ");
result.append(definesHiddenTokens); result.append(definesHiddenTokens);
result.append(", tokenLimit: ");
result.append(tokenLimit);
result.append(", debug: ");
result.append(debug);
result.append(')'); result.append(')');
return result.toString(); return result.toString();
} }

View file

@ -499,6 +499,26 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
return (EReference)grammarEClass.getEStructuralFeatures().get(6); return (EReference)grammarEClass.getEStructuralFeatures().get(6);
} }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getGrammar_TokenLimit() {
return (EAttribute)grammarEClass.getEStructuralFeatures().get(7);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getGrammar_Debug() {
return (EAttribute)grammarEClass.getEStructuralFeatures().get(8);
}
/** /**
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
@ -1467,6 +1487,8 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
createEReference(grammarEClass, GRAMMAR__METAMODEL_DECLARATIONS); createEReference(grammarEClass, GRAMMAR__METAMODEL_DECLARATIONS);
createEReference(grammarEClass, GRAMMAR__RULES); createEReference(grammarEClass, GRAMMAR__RULES);
createEReference(grammarEClass, GRAMMAR__INIT_BLOCK); createEReference(grammarEClass, GRAMMAR__INIT_BLOCK);
createEAttribute(grammarEClass, GRAMMAR__TOKEN_LIMIT);
createEAttribute(grammarEClass, GRAMMAR__DEBUG);
abstractRuleEClass = createEClass(ABSTRACT_RULE); abstractRuleEClass = createEClass(ABSTRACT_RULE);
createEAttribute(abstractRuleEClass, ABSTRACT_RULE__NAME); createEAttribute(abstractRuleEClass, ABSTRACT_RULE__NAME);
@ -1674,6 +1696,8 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
initEReference(getGrammar_MetamodelDeclarations(), this.getAbstractMetamodelDeclaration(), null, "metamodelDeclarations", null, 0, -1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getGrammar_MetamodelDeclarations(), this.getAbstractMetamodelDeclaration(), null, "metamodelDeclarations", null, 0, -1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getGrammar_Rules(), this.getAbstractRule(), null, "rules", null, 0, -1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getGrammar_Rules(), this.getAbstractRule(), null, "rules", null, 0, -1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getGrammar_InitBlock(), this.getInitBlock(), null, "initBlock", null, 0, 1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getGrammar_InitBlock(), this.getInitBlock(), null, "initBlock", null, 0, 1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGrammar_TokenLimit(), ecorePackage.getEInt(), "tokenLimit", null, 0, 1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGrammar_Debug(), ecorePackage.getEBoolean(), "debug", null, 0, 1, Grammar.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(abstractRuleEClass, AbstractRule.class, "AbstractRule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(abstractRuleEClass, AbstractRule.class, "AbstractRule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAbstractRule_Name(), theEcorePackage.getEString(), "name", null, 0, 1, AbstractRule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getAbstractRule_Name(), theEcorePackage.getEString(), "name", null, 0, 1, AbstractRule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

View file

@ -14,6 +14,8 @@
eType="#//AbstractRule" containment="true"/> eType="#//AbstractRule" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="initBlock" eType="#//InitBlock" <eStructuralFeatures xsi:type="ecore:EReference" name="initBlock" eType="#//InitBlock"
containment="true"/> containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="tokenLimit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="debug" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers> </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractRule"> <eClassifiers xsi:type="ecore:EClass" name="AbstractRule">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType ../../../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType ../../../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>

View file

@ -17,6 +17,8 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/metamodelDeclarations"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/metamodelDeclarations"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/rules"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/rules"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/initBlock"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//Grammar/initBlock"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//Grammar/tokenLimit"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//Grammar/debug"/>
</genClasses> </genClasses>
<genClasses ecoreClass="Xtext.ecore#//AbstractRule"> <genClasses ecoreClass="Xtext.ecore#//AbstractRule">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//AbstractRule/name"/> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//AbstractRule/name"/>