[#1467] Made lookAhead independent from encountered hidden tokens (#1469)

Made lookAhead independent from encountered hidden tokens

closes #1467
This commit is contained in:
Sebastian Zarnekow 2020-05-04 17:18:34 +02:00 committed by GitHub
parent 1647521e63
commit b15fd84cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 4059 additions and 653 deletions

View file

@ -15,7 +15,12 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.LookAheadInfo;
import org.eclipse.xtext.nodemodel.impl.InvariantChecker;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.resource.FileExtensionProvider;
import org.eclipse.xtext.resource.XtextResource;
import com.google.inject.Inject;
@ -28,6 +33,9 @@ public class ParseHelper<T extends EObject> {
@Inject
private ResourceHelper resourceHelper;
@Inject
private InvariantChecker invariantChecker;
public String fileExtension;
@ -40,7 +48,16 @@ public class ParseHelper<T extends EObject> {
public T parse(InputStream in, URI uriToUse, Map<?, ?> options, ResourceSet resourceSet) {
resourceHelper.setFileExtension(fileExtension);
Resource resource = resourceHelper.resource(in, uriToUse, options, resourceSet);
final T root = (T) (resource.getContents().isEmpty() ? null : resource.getContents().get(0));
if (resource instanceof XtextResource) {
IParseResult parseResult = ((XtextResource) resource).getParseResult();
if (parseResult != null) {
ICompositeNode rootNode = parseResult.getRootNode();
if (rootNode != null) {
checkNodeModel(rootNode);
}
}
}
T root = (T) (resource.getContents().isEmpty() ? null : resource.getContents().get(0));
return root;
}
@ -64,4 +81,18 @@ public class ParseHelper<T extends EObject> {
return resourceHelper.getAsStream(text);
}
/**
* @since 2.22
*/
protected InvariantChecker getInvariantChecker() {
return invariantChecker;
}
/**
* @since 2.22
*/
protected void checkNodeModel(ICompositeNode rootNode) {
getInvariantChecker().checkInvariant(rootNode);
new LookAheadInfo(rootNode).checkConsistency();
}
}

View file

@ -6,23 +6,40 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1"
eType="#//Alts" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Alts">
<eClassifiers xsi:type="ecore:EClass" name="Alts"/>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead0" eSuperTypes="#//Alts">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead0" eSuperTypes="#//Alts"/>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead1" eSuperTypes="#//Alts">
<eStructuralFeatures xsi:type="ecore:EReference" name="y" eType="#//LookAhead2"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="z" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead2">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="z" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead3" eSuperTypes="#//Alts">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="z" eType="#//LookAhead4"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAhead4">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAheadPredicate" eSuperTypes="#//Alts"/>
<eClassifiers xsi:type="ecore:EClass" name="LookBeyond" eSuperTypes="#//Alts">
<eStructuralFeatures xsi:type="ecore:EReference" name="left" eType="#//LookAheadStrings"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="right" eType="#//FewerLookAheadStrings"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LookAheadStrings">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="values" unique="false"
upperBound="-1" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FewerLookAheadStrings">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="values" unique="false"
upperBound="-1" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>

View file

@ -9,22 +9,35 @@
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//Entry">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference LookaheadTestLanguage.ecore#//Entry/contents"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//Alts">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//Alts/x"/>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//Alts"/>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead0">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead0/x"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead0"/>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead1">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference LookaheadTestLanguage.ecore#//LookAhead1/y"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead1/x"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead1/z"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead2">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead2/z"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead3">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead3/x"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference LookaheadTestLanguage.ecore#//LookAhead3/z"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAhead4">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAhead4/x"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAheadPredicate"/>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookBeyond">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference LookaheadTestLanguage.ecore#//LookBeyond/left"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference LookaheadTestLanguage.ecore#//LookBeyond/right"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//LookAheadStrings">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//LookAheadStrings/values"/>
</genClasses>
<genClasses ecoreClass="LookaheadTestLanguage.ecore#//FewerLookAheadStrings">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute LookaheadTestLanguage.ecore#//FewerLookAheadStrings/values"/>
</genClasses>
</genPackages>
</genmodel:GenModel>

View file

@ -10,12 +10,6 @@ import org.eclipse.emf.ecore.EObject;
* A representation of the model object '<em><b>Alts</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.Alts#getX <em>X</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getAlts()
* @model
@ -23,26 +17,4 @@ import org.eclipse.emf.ecore.EObject;
*/
public interface Alts extends EObject
{
/**
* Returns the value of the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>X</em>' attribute.
* @see #setX(String)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getAlts_X()
* @model
* @generated
*/
String getX();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.Alts#getX <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>X</em>' attribute.
* @see #getX()
* @generated
*/
void setX(String value);
} // Alts

View file

@ -0,0 +1,40 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Fewer Look Ahead Strings</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings#getValues <em>Values</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getFewerLookAheadStrings()
* @model
* @generated
*/
public interface FewerLookAheadStrings extends EObject
{
/**
* Returns the value of the '<em><b>Values</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Values</em>' attribute list.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getFewerLookAheadStrings_Values()
* @model unique="false"
* @generated
*/
EList<String> getValues();
} // FewerLookAheadStrings

View file

@ -9,6 +9,12 @@ package org.eclipse.xtext.testlanguages.lookaheadLang;
* A representation of the model object '<em><b>Look Ahead0</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0#getX <em>X</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAhead0()
* @model
@ -16,4 +22,26 @@ package org.eclipse.xtext.testlanguages.lookaheadLang;
*/
public interface LookAhead0 extends Alts
{
/**
* Returns the value of the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>X</em>' attribute.
* @see #setX(String)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAhead0_X()
* @model
* @generated
*/
String getX();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0#getX <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>X</em>' attribute.
* @see #getX()
* @generated
*/
void setX(String value);
} // LookAhead0

View file

@ -14,6 +14,7 @@ package org.eclipse.xtext.testlanguages.lookaheadLang;
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getY <em>Y</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getX <em>X</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getZ <em>Z</em>}</li>
* </ul>
*
@ -45,6 +46,28 @@ public interface LookAhead1 extends Alts
*/
void setY(LookAhead2 value);
/**
* Returns the value of the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>X</em>' attribute.
* @see #setX(String)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAhead1_X()
* @model
* @generated
*/
String getX();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getX <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>X</em>' attribute.
* @see #getX()
* @generated
*/
void setX(String value);
/**
* Returns the value of the '<em><b>Z</b></em>' attribute.
* <!-- begin-user-doc -->

View file

@ -13,6 +13,7 @@ package org.eclipse.xtext.testlanguages.lookaheadLang;
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getX <em>X</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getZ <em>Z</em>}</li>
* </ul>
*
@ -22,6 +23,28 @@ package org.eclipse.xtext.testlanguages.lookaheadLang;
*/
public interface LookAhead3 extends Alts
{
/**
* Returns the value of the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>X</em>' attribute.
* @see #setX(String)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAhead3_X()
* @model
* @generated
*/
String getX();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getX <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>X</em>' attribute.
* @see #getX()
* @generated
*/
void setX(String value);
/**
* Returns the value of the '<em><b>Z</b></em>' containment reference.
* <!-- begin-user-doc -->

View file

@ -0,0 +1,19 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Look Ahead Predicate</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAheadPredicate()
* @model
* @generated
*/
public interface LookAheadPredicate extends Alts
{
} // LookAheadPredicate

View file

@ -0,0 +1,40 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Look Ahead Strings</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings#getValues <em>Values</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAheadStrings()
* @model
* @generated
*/
public interface LookAheadStrings extends EObject
{
/**
* Returns the value of the '<em><b>Values</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Values</em>' attribute list.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookAheadStrings_Values()
* @model unique="false"
* @generated
*/
EList<String> getValues();
} // LookAheadStrings

View file

@ -0,0 +1,70 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Look Beyond</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getLeft <em>Left</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getRight <em>Right</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookBeyond()
* @model
* @generated
*/
public interface LookBeyond extends Alts
{
/**
* Returns the value of the '<em><b>Left</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Left</em>' containment reference.
* @see #setLeft(LookAheadStrings)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookBeyond_Left()
* @model containment="true"
* @generated
*/
LookAheadStrings getLeft();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getLeft <em>Left</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Left</em>' containment reference.
* @see #getLeft()
* @generated
*/
void setLeft(LookAheadStrings value);
/**
* Returns the value of the '<em><b>Right</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Right</em>' containment reference.
* @see #setRight(FewerLookAheadStrings)
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage#getLookBeyond_Right()
* @model containment="true"
* @generated
*/
FewerLookAheadStrings getRight();
/**
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getRight <em>Right</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Right</em>' containment reference.
* @see #getRight()
* @generated
*/
void setRight(FewerLookAheadStrings value);
} // LookBeyond

View file

@ -86,6 +86,42 @@ public interface LookaheadLangFactory extends EFactory
*/
LookAhead4 createLookAhead4();
/**
* Returns a new object of class '<em>Look Ahead Predicate</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Look Ahead Predicate</em>'.
* @generated
*/
LookAheadPredicate createLookAheadPredicate();
/**
* Returns a new object of class '<em>Look Beyond</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Look Beyond</em>'.
* @generated
*/
LookBeyond createLookBeyond();
/**
* Returns a new object of class '<em>Look Ahead Strings</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Look Ahead Strings</em>'.
* @generated
*/
LookAheadStrings createLookAheadStrings();
/**
* Returns a new object of class '<em>Fewer Look Ahead Strings</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Fewer Look Ahead Strings</em>'.
* @generated
*/
FewerLookAheadStrings createFewerLookAheadStrings();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->

View file

@ -95,15 +95,6 @@ public interface LookaheadLangPackage extends EPackage
*/
int ALTS = 1;
/**
* The feature id for the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ALTS__X = 0;
/**
* The number of structural features of the '<em>Alts</em>' class.
* <!-- begin-user-doc -->
@ -111,7 +102,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int ALTS_FEATURE_COUNT = 1;
int ALTS_FEATURE_COUNT = 0;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead0Impl <em>Look Ahead0</em>}' class.
@ -130,7 +121,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD0__X = ALTS__X;
int LOOK_AHEAD0__X = ALTS_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Look Ahead0</em>' class.
@ -139,7 +130,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD0_FEATURE_COUNT = ALTS_FEATURE_COUNT + 0;
int LOOK_AHEAD0_FEATURE_COUNT = ALTS_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead1Impl <em>Look Ahead1</em>}' class.
@ -151,15 +142,6 @@ public interface LookaheadLangPackage extends EPackage
*/
int LOOK_AHEAD1 = 3;
/**
* The feature id for the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_AHEAD1__X = ALTS__X;
/**
* The feature id for the '<em><b>Y</b></em>' containment reference.
* <!-- begin-user-doc -->
@ -169,6 +151,15 @@ public interface LookaheadLangPackage extends EPackage
*/
int LOOK_AHEAD1__Y = ALTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>X</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_AHEAD1__X = ALTS_FEATURE_COUNT + 1;
/**
* The feature id for the '<em><b>Z</b></em>' attribute.
* <!-- begin-user-doc -->
@ -176,7 +167,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD1__Z = ALTS_FEATURE_COUNT + 1;
int LOOK_AHEAD1__Z = ALTS_FEATURE_COUNT + 2;
/**
* The number of structural features of the '<em>Look Ahead1</em>' class.
@ -185,7 +176,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD1_FEATURE_COUNT = ALTS_FEATURE_COUNT + 2;
int LOOK_AHEAD1_FEATURE_COUNT = ALTS_FEATURE_COUNT + 3;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead2Impl <em>Look Ahead2</em>}' class.
@ -232,7 +223,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD3__X = ALTS__X;
int LOOK_AHEAD3__X = ALTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>Z</b></em>' containment reference.
@ -241,7 +232,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD3__Z = ALTS_FEATURE_COUNT + 0;
int LOOK_AHEAD3__Z = ALTS_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Look Ahead3</em>' class.
@ -250,7 +241,7 @@ public interface LookaheadLangPackage extends EPackage
* @generated
* @ordered
*/
int LOOK_AHEAD3_FEATURE_COUNT = ALTS_FEATURE_COUNT + 1;
int LOOK_AHEAD3_FEATURE_COUNT = ALTS_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead4Impl <em>Look Ahead4</em>}' class.
@ -280,6 +271,118 @@ public interface LookaheadLangPackage extends EPackage
*/
int LOOK_AHEAD4_FEATURE_COUNT = 1;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadPredicateImpl <em>Look Ahead Predicate</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadPredicateImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookAheadPredicate()
* @generated
*/
int LOOK_AHEAD_PREDICATE = 7;
/**
* The number of structural features of the '<em>Look Ahead Predicate</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_AHEAD_PREDICATE_FEATURE_COUNT = ALTS_FEATURE_COUNT + 0;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl <em>Look Beyond</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookBeyond()
* @generated
*/
int LOOK_BEYOND = 8;
/**
* The feature id for the '<em><b>Left</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_BEYOND__LEFT = ALTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>Right</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_BEYOND__RIGHT = ALTS_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Look Beyond</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_BEYOND_FEATURE_COUNT = ALTS_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadStringsImpl <em>Look Ahead Strings</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadStringsImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookAheadStrings()
* @generated
*/
int LOOK_AHEAD_STRINGS = 9;
/**
* The feature id for the '<em><b>Values</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_AHEAD_STRINGS__VALUES = 0;
/**
* The number of structural features of the '<em>Look Ahead Strings</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LOOK_AHEAD_STRINGS_FEATURE_COUNT = 1;
/**
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.FewerLookAheadStringsImpl <em>Fewer Look Ahead Strings</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.FewerLookAheadStringsImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getFewerLookAheadStrings()
* @generated
*/
int FEWER_LOOK_AHEAD_STRINGS = 10;
/**
* The feature id for the '<em><b>Values</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int FEWER_LOOK_AHEAD_STRINGS__VALUES = 0;
/**
* The number of structural features of the '<em>Fewer Look Ahead Strings</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int FEWER_LOOK_AHEAD_STRINGS_FEATURE_COUNT = 1;
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.Entry <em>Entry</em>}'.
@ -312,17 +415,6 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass getAlts();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.lookaheadLang.Alts#getX <em>X</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>X</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.Alts#getX()
* @see #getAlts()
* @generated
*/
EAttribute getAlts_X();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0 <em>Look Ahead0</em>}'.
* <!-- begin-user-doc -->
@ -333,6 +425,17 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass getLookAhead0();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0#getX <em>X</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>X</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0#getX()
* @see #getLookAhead0()
* @generated
*/
EAttribute getLookAhead0_X();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1 <em>Look Ahead1</em>}'.
* <!-- begin-user-doc -->
@ -354,6 +457,17 @@ public interface LookaheadLangPackage extends EPackage
*/
EReference getLookAhead1_Y();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getX <em>X</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>X</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getX()
* @see #getLookAhead1()
* @generated
*/
EAttribute getLookAhead1_X();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1#getZ <em>Z</em>}'.
* <!-- begin-user-doc -->
@ -396,6 +510,17 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass getLookAhead3();
/**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getX <em>X</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>X</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getX()
* @see #getLookAhead3()
* @generated
*/
EAttribute getLookAhead3_X();
/**
* Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3#getZ <em>Z</em>}'.
* <!-- begin-user-doc -->
@ -428,6 +553,90 @@ public interface LookaheadLangPackage extends EPackage
*/
EAttribute getLookAhead4_X();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate <em>Look Ahead Predicate</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Look Ahead Predicate</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate
* @generated
*/
EClass getLookAheadPredicate();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond <em>Look Beyond</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Look Beyond</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond
* @generated
*/
EClass getLookBeyond();
/**
* Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getLeft <em>Left</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Left</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getLeft()
* @see #getLookBeyond()
* @generated
*/
EReference getLookBeyond_Left();
/**
* Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getRight <em>Right</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Right</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond#getRight()
* @see #getLookBeyond()
* @generated
*/
EReference getLookBeyond_Right();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings <em>Look Ahead Strings</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Look Ahead Strings</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings
* @generated
*/
EClass getLookAheadStrings();
/**
* Returns the meta object for the attribute list '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings#getValues <em>Values</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute list '<em>Values</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings#getValues()
* @see #getLookAheadStrings()
* @generated
*/
EAttribute getLookAheadStrings_Values();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings <em>Fewer Look Ahead Strings</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Fewer Look Ahead Strings</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings
* @generated
*/
EClass getFewerLookAheadStrings();
/**
* Returns the meta object for the attribute list '{@link org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings#getValues <em>Values</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute list '<em>Values</em>'.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings#getValues()
* @see #getFewerLookAheadStrings()
* @generated
*/
EAttribute getFewerLookAheadStrings_Values();
/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
@ -479,14 +688,6 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass ALTS = eINSTANCE.getAlts();
/**
* The meta object literal for the '<em><b>X</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute ALTS__X = eINSTANCE.getAlts_X();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead0Impl <em>Look Ahead0</em>}' class.
* <!-- begin-user-doc -->
@ -497,6 +698,14 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass LOOK_AHEAD0 = eINSTANCE.getLookAhead0();
/**
* The meta object literal for the '<em><b>X</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute LOOK_AHEAD0__X = eINSTANCE.getLookAhead0_X();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead1Impl <em>Look Ahead1</em>}' class.
* <!-- begin-user-doc -->
@ -515,6 +724,14 @@ public interface LookaheadLangPackage extends EPackage
*/
EReference LOOK_AHEAD1__Y = eINSTANCE.getLookAhead1_Y();
/**
* The meta object literal for the '<em><b>X</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute LOOK_AHEAD1__X = eINSTANCE.getLookAhead1_X();
/**
* The meta object literal for the '<em><b>Z</b></em>' attribute feature.
* <!-- begin-user-doc -->
@ -551,6 +768,14 @@ public interface LookaheadLangPackage extends EPackage
*/
EClass LOOK_AHEAD3 = eINSTANCE.getLookAhead3();
/**
* The meta object literal for the '<em><b>X</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute LOOK_AHEAD3__X = eINSTANCE.getLookAhead3_X();
/**
* The meta object literal for the '<em><b>Z</b></em>' containment reference feature.
* <!-- begin-user-doc -->
@ -577,6 +802,78 @@ public interface LookaheadLangPackage extends EPackage
*/
EAttribute LOOK_AHEAD4__X = eINSTANCE.getLookAhead4_X();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadPredicateImpl <em>Look Ahead Predicate</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadPredicateImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookAheadPredicate()
* @generated
*/
EClass LOOK_AHEAD_PREDICATE = eINSTANCE.getLookAheadPredicate();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl <em>Look Beyond</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookBeyond()
* @generated
*/
EClass LOOK_BEYOND = eINSTANCE.getLookBeyond();
/**
* The meta object literal for the '<em><b>Left</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference LOOK_BEYOND__LEFT = eINSTANCE.getLookBeyond_Left();
/**
* The meta object literal for the '<em><b>Right</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference LOOK_BEYOND__RIGHT = eINSTANCE.getLookBeyond_Right();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadStringsImpl <em>Look Ahead Strings</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadStringsImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getLookAheadStrings()
* @generated
*/
EClass LOOK_AHEAD_STRINGS = eINSTANCE.getLookAheadStrings();
/**
* The meta object literal for the '<em><b>Values</b></em>' attribute list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute LOOK_AHEAD_STRINGS__VALUES = eINSTANCE.getLookAheadStrings_Values();
/**
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.FewerLookAheadStringsImpl <em>Fewer Look Ahead Strings</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.FewerLookAheadStringsImpl
* @see org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookaheadLangPackageImpl#getFewerLookAheadStrings()
* @generated
*/
EClass FEWER_LOOK_AHEAD_STRINGS = eINSTANCE.getFewerLookAheadStrings();
/**
* The meta object literal for the '<em><b>Values</b></em>' attribute list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute FEWER_LOOK_AHEAD_STRINGS__VALUES = eINSTANCE.getFewerLookAheadStrings_Values();
}
} //LookaheadLangPackage

View file

@ -3,11 +3,8 @@
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.xtext.testlanguages.lookaheadLang.Alts;
@ -17,37 +14,11 @@ import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Alts</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.AltsImpl#getX <em>X</em>}</li>
* </ul>
*
* @generated
*/
public class AltsImpl extends MinimalEObjectImpl.Container implements Alts
{
/**
* The default value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final String X_EDEFAULT = null;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected String x = X_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -69,112 +40,4 @@ public class AltsImpl extends MinimalEObjectImpl.Container implements Alts
return LookaheadLangPackage.Literals.ALTS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getX()
{
return x;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setX(String newX)
{
String oldX = x;
x = newX;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.ALTS__X, oldX, x));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case LookaheadLangPackage.ALTS__X:
return getX();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case LookaheadLangPackage.ALTS__X:
setX((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.ALTS__X:
setX(X_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.ALTS__X:
return X_EDEFAULT == null ? x != null : !X_EDEFAULT.equals(x);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (x: ");
result.append(x);
result.append(')');
return result.toString();
}
} //AltsImpl

View file

@ -0,0 +1,165 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import java.util.Collection;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Fewer Look Ahead Strings</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.FewerLookAheadStringsImpl#getValues <em>Values</em>}</li>
* </ul>
*
* @generated
*/
public class FewerLookAheadStringsImpl extends MinimalEObjectImpl.Container implements FewerLookAheadStrings
{
/**
* The cached value of the '{@link #getValues() <em>Values</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValues()
* @generated
* @ordered
*/
protected EList<String> values;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FewerLookAheadStringsImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return LookaheadLangPackage.Literals.FEWER_LOOK_AHEAD_STRINGS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<String> getValues()
{
if (values == null)
{
values = new EDataTypeEList<String>(String.class, this, LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS__VALUES);
}
return values;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS__VALUES:
return getValues();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS__VALUES:
getValues().clear();
getValues().addAll((Collection<? extends String>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS__VALUES:
getValues().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS__VALUES:
return values != null && !values.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (values: ");
result.append(values);
result.append(')');
return result.toString();
}
} //FewerLookAheadStringsImpl

View file

@ -3,8 +3,12 @@
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
@ -12,11 +16,37 @@ import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Look Ahead0</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead0Impl#getX <em>X</em>}</li>
* </ul>
*
* @generated
*/
public class LookAhead0Impl extends AltsImpl implements LookAhead0
{
/**
* The default value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final String X_EDEFAULT = null;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected String x = X_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -38,4 +68,112 @@ public class LookAhead0Impl extends AltsImpl implements LookAhead0
return LookaheadLangPackage.Literals.LOOK_AHEAD0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getX()
{
return x;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setX(String newX)
{
String oldX = x;
x = newX;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_AHEAD0__X, oldX, x));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD0__X:
return getX();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD0__X:
setX((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD0__X:
setX(X_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD0__X:
return X_EDEFAULT == null ? x != null : !X_EDEFAULT.equals(x);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (x: ");
result.append(x);
result.append(')');
return result.toString();
}
} //LookAhead0Impl

View file

@ -24,6 +24,7 @@ import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead1Impl#getY <em>Y</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead1Impl#getX <em>X</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead1Impl#getZ <em>Z</em>}</li>
* </ul>
*
@ -41,6 +42,26 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
*/
protected LookAhead2 y;
/**
* The default value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final String X_EDEFAULT = null;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected String x = X_EDEFAULT;
/**
* The default value of the '{@link #getZ() <em>Z</em>}' attribute.
* <!-- begin-user-doc -->
@ -132,6 +153,31 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_AHEAD1__Y, newY, newY));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getX()
{
return x;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setX(String newX)
{
String oldX = x;
x = newX;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_AHEAD1__X, oldX, x));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -185,6 +231,8 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
{
case LookaheadLangPackage.LOOK_AHEAD1__Y:
return getY();
case LookaheadLangPackage.LOOK_AHEAD1__X:
return getX();
case LookaheadLangPackage.LOOK_AHEAD1__Z:
return getZ();
}
@ -204,6 +252,9 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
case LookaheadLangPackage.LOOK_AHEAD1__Y:
setY((LookAhead2)newValue);
return;
case LookaheadLangPackage.LOOK_AHEAD1__X:
setX((String)newValue);
return;
case LookaheadLangPackage.LOOK_AHEAD1__Z:
setZ((String)newValue);
return;
@ -224,6 +275,9 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
case LookaheadLangPackage.LOOK_AHEAD1__Y:
setY((LookAhead2)null);
return;
case LookaheadLangPackage.LOOK_AHEAD1__X:
setX(X_EDEFAULT);
return;
case LookaheadLangPackage.LOOK_AHEAD1__Z:
setZ(Z_EDEFAULT);
return;
@ -243,6 +297,8 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
{
case LookaheadLangPackage.LOOK_AHEAD1__Y:
return y != null;
case LookaheadLangPackage.LOOK_AHEAD1__X:
return X_EDEFAULT == null ? x != null : !X_EDEFAULT.equals(x);
case LookaheadLangPackage.LOOK_AHEAD1__Z:
return Z_EDEFAULT == null ? z != null : !Z_EDEFAULT.equals(z);
}
@ -260,7 +316,9 @@ public class LookAhead1Impl extends AltsImpl implements LookAhead1
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (z: ");
result.append(" (x: ");
result.append(x);
result.append(", z: ");
result.append(z);
result.append(')');
return result.toString();

View file

@ -23,6 +23,7 @@ import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead3Impl#getX <em>X</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAhead3Impl#getZ <em>Z</em>}</li>
* </ul>
*
@ -30,6 +31,26 @@ import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
*/
public class LookAhead3Impl extends AltsImpl implements LookAhead3
{
/**
* The default value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final String X_EDEFAULT = null;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected String x = X_EDEFAULT;
/**
* The cached value of the '{@link #getZ() <em>Z</em>}' containment reference.
* <!-- begin-user-doc -->
@ -61,6 +82,31 @@ public class LookAhead3Impl extends AltsImpl implements LookAhead3
return LookaheadLangPackage.Literals.LOOK_AHEAD3;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getX()
{
return x;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setX(String newX)
{
String oldX = x;
x = newX;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_AHEAD3__X, oldX, x));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -137,6 +183,8 @@ public class LookAhead3Impl extends AltsImpl implements LookAhead3
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD3__X:
return getX();
case LookaheadLangPackage.LOOK_AHEAD3__Z:
return getZ();
}
@ -153,6 +201,9 @@ public class LookAhead3Impl extends AltsImpl implements LookAhead3
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD3__X:
setX((String)newValue);
return;
case LookaheadLangPackage.LOOK_AHEAD3__Z:
setZ((LookAhead4)newValue);
return;
@ -170,6 +221,9 @@ public class LookAhead3Impl extends AltsImpl implements LookAhead3
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD3__X:
setX(X_EDEFAULT);
return;
case LookaheadLangPackage.LOOK_AHEAD3__Z:
setZ((LookAhead4)null);
return;
@ -187,10 +241,29 @@ public class LookAhead3Impl extends AltsImpl implements LookAhead3
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD3__X:
return X_EDEFAULT == null ? x != null : !X_EDEFAULT.equals(x);
case LookaheadLangPackage.LOOK_AHEAD3__Z:
return z != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (x: ");
result.append(x);
result.append(')');
return result.toString();
}
} //LookAhead3Impl

View file

@ -0,0 +1,41 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Look Ahead Predicate</b></em>'.
* <!-- end-user-doc -->
*
* @generated
*/
public class LookAheadPredicateImpl extends AltsImpl implements LookAheadPredicate
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LookAheadPredicateImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return LookaheadLangPackage.Literals.LOOK_AHEAD_PREDICATE;
}
} //LookAheadPredicateImpl

View file

@ -0,0 +1,165 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import java.util.Collection;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Look Ahead Strings</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookAheadStringsImpl#getValues <em>Values</em>}</li>
* </ul>
*
* @generated
*/
public class LookAheadStringsImpl extends MinimalEObjectImpl.Container implements LookAheadStrings
{
/**
* The cached value of the '{@link #getValues() <em>Values</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValues()
* @generated
* @ordered
*/
protected EList<String> values;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LookAheadStringsImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return LookaheadLangPackage.Literals.LOOK_AHEAD_STRINGS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<String> getValues()
{
if (values == null)
{
values = new EDataTypeEList<String>(String.class, this, LookaheadLangPackage.LOOK_AHEAD_STRINGS__VALUES);
}
return values;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD_STRINGS__VALUES:
return getValues();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD_STRINGS__VALUES:
getValues().clear();
getValues().addAll((Collection<? extends String>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD_STRINGS__VALUES:
getValues().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_AHEAD_STRINGS__VALUES:
return values != null && !values.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (values: ");
result.append(values);
result.append(')');
return result.toString();
}
} //LookAheadStringsImpl

View file

@ -0,0 +1,270 @@
/**
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.lookaheadLang.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Look Beyond</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl#getLeft <em>Left</em>}</li>
* <li>{@link org.eclipse.xtext.testlanguages.lookaheadLang.impl.LookBeyondImpl#getRight <em>Right</em>}</li>
* </ul>
*
* @generated
*/
public class LookBeyondImpl extends AltsImpl implements LookBeyond
{
/**
* The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeft()
* @generated
* @ordered
*/
protected LookAheadStrings left;
/**
* The cached value of the '{@link #getRight() <em>Right</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRight()
* @generated
* @ordered
*/
protected FewerLookAheadStrings right;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LookBeyondImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return LookaheadLangPackage.Literals.LOOK_BEYOND;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LookAheadStrings getLeft()
{
return left;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(LookAheadStrings newLeft, NotificationChain msgs)
{
LookAheadStrings oldLeft = left;
left = newLeft;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_BEYOND__LEFT, oldLeft, newLeft);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setLeft(LookAheadStrings newLeft)
{
if (newLeft != left)
{
NotificationChain msgs = null;
if (left != null)
msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LookaheadLangPackage.LOOK_BEYOND__LEFT, null, msgs);
if (newLeft != null)
msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LookaheadLangPackage.LOOK_BEYOND__LEFT, null, msgs);
msgs = basicSetLeft(newLeft, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_BEYOND__LEFT, newLeft, newLeft));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public FewerLookAheadStrings getRight()
{
return right;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRight(FewerLookAheadStrings newRight, NotificationChain msgs)
{
FewerLookAheadStrings oldRight = right;
right = newRight;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_BEYOND__RIGHT, oldRight, newRight);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setRight(FewerLookAheadStrings newRight)
{
if (newRight != right)
{
NotificationChain msgs = null;
if (right != null)
msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LookaheadLangPackage.LOOK_BEYOND__RIGHT, null, msgs);
if (newRight != null)
msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LookaheadLangPackage.LOOK_BEYOND__RIGHT, null, msgs);
msgs = basicSetRight(newRight, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LookaheadLangPackage.LOOK_BEYOND__RIGHT, newRight, newRight));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_BEYOND__LEFT:
return basicSetLeft(null, msgs);
case LookaheadLangPackage.LOOK_BEYOND__RIGHT:
return basicSetRight(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_BEYOND__LEFT:
return getLeft();
case LookaheadLangPackage.LOOK_BEYOND__RIGHT:
return getRight();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_BEYOND__LEFT:
setLeft((LookAheadStrings)newValue);
return;
case LookaheadLangPackage.LOOK_BEYOND__RIGHT:
setRight((FewerLookAheadStrings)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_BEYOND__LEFT:
setLeft((LookAheadStrings)null);
return;
case LookaheadLangPackage.LOOK_BEYOND__RIGHT:
setRight((FewerLookAheadStrings)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case LookaheadLangPackage.LOOK_BEYOND__LEFT:
return left != null;
case LookaheadLangPackage.LOOK_BEYOND__RIGHT:
return right != null;
}
return super.eIsSet(featureID);
}
} //LookBeyondImpl

View file

@ -72,6 +72,10 @@ public class LookaheadLangFactoryImpl extends EFactoryImpl implements LookaheadL
case LookaheadLangPackage.LOOK_AHEAD2: return createLookAhead2();
case LookaheadLangPackage.LOOK_AHEAD3: return createLookAhead3();
case LookaheadLangPackage.LOOK_AHEAD4: return createLookAhead4();
case LookaheadLangPackage.LOOK_AHEAD_PREDICATE: return createLookAheadPredicate();
case LookaheadLangPackage.LOOK_BEYOND: return createLookBeyond();
case LookaheadLangPackage.LOOK_AHEAD_STRINGS: return createLookAheadStrings();
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS: return createFewerLookAheadStrings();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@ -161,6 +165,54 @@ public class LookaheadLangFactoryImpl extends EFactoryImpl implements LookaheadL
return lookAhead4;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LookAheadPredicate createLookAheadPredicate()
{
LookAheadPredicateImpl lookAheadPredicate = new LookAheadPredicateImpl();
return lookAheadPredicate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LookBeyond createLookBeyond()
{
LookBeyondImpl lookBeyond = new LookBeyondImpl();
return lookBeyond;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LookAheadStrings createLookAheadStrings()
{
LookAheadStringsImpl lookAheadStrings = new LookAheadStringsImpl();
return lookAheadStrings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public FewerLookAheadStrings createFewerLookAheadStrings()
{
FewerLookAheadStringsImpl fewerLookAheadStrings = new FewerLookAheadStringsImpl();
return fewerLookAheadStrings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->

View file

@ -13,11 +13,15 @@ import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.xtext.testlanguages.lookaheadLang.Alts;
import org.eclipse.xtext.testlanguages.lookaheadLang.Entry;
import org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead2;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead4;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangFactory;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
@ -78,6 +82,34 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
*/
private EClass lookAhead4EClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass lookAheadPredicateEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass lookBeyondEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass lookAheadStringsEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass fewerLookAheadStringsEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
@ -183,9 +215,9 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
* @generated
*/
@Override
public EAttribute getAlts_X()
public EClass getLookAhead0()
{
return (EAttribute)altsEClass.getEStructuralFeatures().get(0);
return lookAhead0EClass;
}
/**
@ -194,9 +226,9 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
* @generated
*/
@Override
public EClass getLookAhead0()
public EAttribute getLookAhead0_X()
{
return lookAhead0EClass;
return (EAttribute)lookAhead0EClass.getEStructuralFeatures().get(0);
}
/**
@ -227,11 +259,22 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
* @generated
*/
@Override
public EAttribute getLookAhead1_Z()
public EAttribute getLookAhead1_X()
{
return (EAttribute)lookAhead1EClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getLookAhead1_Z()
{
return (EAttribute)lookAhead1EClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -265,6 +308,17 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
return lookAhead3EClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getLookAhead3_X()
{
return (EAttribute)lookAhead3EClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -273,7 +327,7 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
@Override
public EReference getLookAhead3_Z()
{
return (EReference)lookAhead3EClass.getEStructuralFeatures().get(0);
return (EReference)lookAhead3EClass.getEStructuralFeatures().get(1);
}
/**
@ -298,6 +352,94 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
return (EAttribute)lookAhead4EClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EClass getLookAheadPredicate()
{
return lookAheadPredicateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EClass getLookBeyond()
{
return lookBeyondEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EReference getLookBeyond_Left()
{
return (EReference)lookBeyondEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EReference getLookBeyond_Right()
{
return (EReference)lookBeyondEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EClass getLookAheadStrings()
{
return lookAheadStringsEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getLookAheadStrings_Values()
{
return (EAttribute)lookAheadStringsEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EClass getFewerLookAheadStrings()
{
return fewerLookAheadStringsEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getFewerLookAheadStrings_Values()
{
return (EAttribute)fewerLookAheadStringsEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -333,22 +475,36 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
createEReference(entryEClass, ENTRY__CONTENTS);
altsEClass = createEClass(ALTS);
createEAttribute(altsEClass, ALTS__X);
lookAhead0EClass = createEClass(LOOK_AHEAD0);
createEAttribute(lookAhead0EClass, LOOK_AHEAD0__X);
lookAhead1EClass = createEClass(LOOK_AHEAD1);
createEReference(lookAhead1EClass, LOOK_AHEAD1__Y);
createEAttribute(lookAhead1EClass, LOOK_AHEAD1__X);
createEAttribute(lookAhead1EClass, LOOK_AHEAD1__Z);
lookAhead2EClass = createEClass(LOOK_AHEAD2);
createEAttribute(lookAhead2EClass, LOOK_AHEAD2__Z);
lookAhead3EClass = createEClass(LOOK_AHEAD3);
createEAttribute(lookAhead3EClass, LOOK_AHEAD3__X);
createEReference(lookAhead3EClass, LOOK_AHEAD3__Z);
lookAhead4EClass = createEClass(LOOK_AHEAD4);
createEAttribute(lookAhead4EClass, LOOK_AHEAD4__X);
lookAheadPredicateEClass = createEClass(LOOK_AHEAD_PREDICATE);
lookBeyondEClass = createEClass(LOOK_BEYOND);
createEReference(lookBeyondEClass, LOOK_BEYOND__LEFT);
createEReference(lookBeyondEClass, LOOK_BEYOND__RIGHT);
lookAheadStringsEClass = createEClass(LOOK_AHEAD_STRINGS);
createEAttribute(lookAheadStringsEClass, LOOK_AHEAD_STRINGS__VALUES);
fewerLookAheadStringsEClass = createEClass(FEWER_LOOK_AHEAD_STRINGS);
createEAttribute(fewerLookAheadStringsEClass, FEWER_LOOK_AHEAD_STRINGS__VALUES);
}
/**
@ -386,29 +542,45 @@ public class LookaheadLangPackageImpl extends EPackageImpl implements LookaheadL
lookAhead0EClass.getESuperTypes().add(this.getAlts());
lookAhead1EClass.getESuperTypes().add(this.getAlts());
lookAhead3EClass.getESuperTypes().add(this.getAlts());
lookAheadPredicateEClass.getESuperTypes().add(this.getAlts());
lookBeyondEClass.getESuperTypes().add(this.getAlts());
// Initialize classes and features; add operations and parameters
initEClass(entryEClass, Entry.class, "Entry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getEntry_Contents(), this.getAlts(), null, "contents", null, 0, -1, Entry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(altsEClass, Alts.class, "Alts", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAlts_X(), theEcorePackage.getEString(), "x", null, 0, 1, Alts.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAhead0EClass, LookAhead0.class, "LookAhead0", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getLookAhead0_X(), theEcorePackage.getEString(), "x", null, 0, 1, LookAhead0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAhead1EClass, LookAhead1.class, "LookAhead1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getLookAhead1_Y(), this.getLookAhead2(), null, "y", null, 0, 1, LookAhead1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getLookAhead1_X(), theEcorePackage.getEString(), "x", null, 0, 1, LookAhead1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getLookAhead1_Z(), theEcorePackage.getEString(), "z", null, 0, 1, LookAhead1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAhead2EClass, LookAhead2.class, "LookAhead2", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getLookAhead2_Z(), theEcorePackage.getEString(), "z", null, 0, 1, LookAhead2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAhead3EClass, LookAhead3.class, "LookAhead3", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getLookAhead3_X(), theEcorePackage.getEString(), "x", null, 0, 1, LookAhead3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getLookAhead3_Z(), this.getLookAhead4(), null, "z", null, 0, 1, LookAhead3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAhead4EClass, LookAhead4.class, "LookAhead4", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getLookAhead4_X(), theEcorePackage.getEString(), "x", null, 0, 1, LookAhead4.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAheadPredicateEClass, LookAheadPredicate.class, "LookAheadPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(lookBeyondEClass, LookBeyond.class, "LookBeyond", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getLookBeyond_Left(), this.getLookAheadStrings(), null, "left", null, 0, 1, LookBeyond.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getLookBeyond_Right(), this.getFewerLookAheadStrings(), null, "right", null, 0, 1, LookBeyond.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(lookAheadStringsEClass, LookAheadStrings.class, "LookAheadStrings", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getLookAheadStrings_Values(), theEcorePackage.getEString(), "values", null, 0, -1, LookAheadStrings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(fewerLookAheadStringsEClass, FewerLookAheadStrings.class, "FewerLookAheadStrings", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getFewerLookAheadStrings_Values(), theEcorePackage.getEString(), "values", null, 0, -1, FewerLookAheadStrings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
}

View file

@ -111,6 +111,26 @@ public class LookaheadLangAdapterFactory extends AdapterFactoryImpl
return createLookAhead4Adapter();
}
@Override
public Adapter caseLookAheadPredicate(LookAheadPredicate object)
{
return createLookAheadPredicateAdapter();
}
@Override
public Adapter caseLookBeyond(LookBeyond object)
{
return createLookBeyondAdapter();
}
@Override
public Adapter caseLookAheadStrings(LookAheadStrings object)
{
return createLookAheadStringsAdapter();
}
@Override
public Adapter caseFewerLookAheadStrings(FewerLookAheadStrings object)
{
return createFewerLookAheadStringsAdapter();
}
@Override
public Adapter defaultCase(EObject object)
{
return createEObjectAdapter();
@ -237,6 +257,66 @@ public class LookaheadLangAdapterFactory extends AdapterFactoryImpl
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate <em>Look Ahead Predicate</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate
* @generated
*/
public Adapter createLookAheadPredicateAdapter()
{
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond <em>Look Beyond</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond
* @generated
*/
public Adapter createLookBeyondAdapter()
{
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings <em>Look Ahead Strings</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings
* @generated
*/
public Adapter createLookAheadStringsAdapter()
{
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings <em>Fewer Look Ahead Strings</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings
* @generated
*/
public Adapter createFewerLookAheadStringsAdapter()
{
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->

View file

@ -125,6 +125,36 @@ public class LookaheadLangSwitch<T> extends Switch<T>
if (result == null) result = defaultCase(theEObject);
return result;
}
case LookaheadLangPackage.LOOK_AHEAD_PREDICATE:
{
LookAheadPredicate lookAheadPredicate = (LookAheadPredicate)theEObject;
T result = caseLookAheadPredicate(lookAheadPredicate);
if (result == null) result = caseAlts(lookAheadPredicate);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LookaheadLangPackage.LOOK_BEYOND:
{
LookBeyond lookBeyond = (LookBeyond)theEObject;
T result = caseLookBeyond(lookBeyond);
if (result == null) result = caseAlts(lookBeyond);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LookaheadLangPackage.LOOK_AHEAD_STRINGS:
{
LookAheadStrings lookAheadStrings = (LookAheadStrings)theEObject;
T result = caseLookAheadStrings(lookAheadStrings);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS:
{
FewerLookAheadStrings fewerLookAheadStrings = (FewerLookAheadStrings)theEObject;
T result = caseFewerLookAheadStrings(fewerLookAheadStrings);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
@ -241,6 +271,70 @@ public class LookaheadLangSwitch<T> extends Switch<T>
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Look Ahead Predicate</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Look Ahead Predicate</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLookAheadPredicate(LookAheadPredicate object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Look Beyond</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Look Beyond</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLookBeyond(LookBeyond object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Look Ahead Strings</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Look Ahead Strings</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLookAheadStrings(LookAheadStrings object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Fewer Look Ahead Strings</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Fewer Look Ahead Strings</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFewerLookAheadStrings(FewerLookAheadStrings object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->

View file

@ -138,6 +138,34 @@ ruleAlts returns [EObject current=null]
$current = $this_LookAhead3_2.current;
afterParserOrEnumRuleCall();
}
|
(
((
(
)
'zonk'
'a'
'b'
)
)=>
{
newCompositeNode(grammarAccess.getAltsAccess().getLookAheadPredicateParserRuleCall_3());
}
this_LookAheadPredicate_3=ruleLookAheadPredicate
{
$current = $this_LookAheadPredicate_3.current;
afterParserOrEnumRuleCall();
}
)
|
{
newCompositeNode(grammarAccess.getAltsAccess().getLookBeyondParserRuleCall_4());
}
this_LookBeyond_4=ruleLookBeyond
{
$current = $this_LookBeyond_4.current;
afterParserOrEnumRuleCall();
}
)
;
@ -410,6 +438,225 @@ ruleLookAhead4 returns [EObject current=null]
)
;
// Entry rule entryRuleLookAheadPredicate
entryRuleLookAheadPredicate returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getLookAheadPredicateRule()); }
iv_ruleLookAheadPredicate=ruleLookAheadPredicate
{ $current=$iv_ruleLookAheadPredicate.current; }
EOF;
// Rule LookAheadPredicate
ruleLookAheadPredicate returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
((
(
)
'zonk'
'a'
'b'
)
)=>
(
(
{
$current = forceCreateModelElement(
grammarAccess.getLookAheadPredicateAccess().getLookAheadPredicateAction_0_0_0(),
$current);
}
)
otherlv_1='zonk'
{
newLeafNode(otherlv_1, grammarAccess.getLookAheadPredicateAccess().getZonkKeyword_0_0_1());
}
otherlv_2='a'
{
newLeafNode(otherlv_2, grammarAccess.getLookAheadPredicateAccess().getAKeyword_0_0_2());
}
otherlv_3='b'
{
newLeafNode(otherlv_3, grammarAccess.getLookAheadPredicateAccess().getBKeyword_0_0_3());
}
)
)
otherlv_4='d'
{
newLeafNode(otherlv_4, grammarAccess.getLookAheadPredicateAccess().getDKeyword_1());
}
)
;
// Entry rule entryRuleLookBeyond
entryRuleLookBeyond returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getLookBeyondRule()); }
iv_ruleLookBeyond=ruleLookBeyond
{ $current=$iv_ruleLookBeyond.current; }
EOF;
// Rule LookBeyond
ruleLookBeyond returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
newCompositeNode(grammarAccess.getLookBeyondAccess().getLeftLookAheadStringsParserRuleCall_0_0());
}
lv_left_0_0=ruleLookAheadStrings
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getLookBeyondRule());
}
set(
$current,
"left",
lv_left_0_0,
"org.eclipse.xtext.testlanguages.LookaheadTestLanguage.LookAheadStrings");
afterParserOrEnumRuleCall();
}
)
)?
(
(
{
newCompositeNode(grammarAccess.getLookBeyondAccess().getRightFewerLookAheadStringsParserRuleCall_1_0());
}
lv_right_1_0=ruleFewerLookAheadStrings
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getLookBeyondRule());
}
set(
$current,
"right",
lv_right_1_0,
"org.eclipse.xtext.testlanguages.LookaheadTestLanguage.FewerLookAheadStrings");
afterParserOrEnumRuleCall();
}
)
)
)
;
// Entry rule entryRuleLookAheadStrings
entryRuleLookAheadStrings returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getLookAheadStringsRule()); }
iv_ruleLookAheadStrings=ruleLookAheadStrings
{ $current=$iv_ruleLookAheadStrings.current; }
EOF;
// Rule LookAheadStrings
ruleLookAheadStrings returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
lv_values_0_0=RULE_STRING
{
newLeafNode(lv_values_0_0, grammarAccess.getLookAheadStringsAccess().getValuesSTRINGTerminalRuleCall_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getLookAheadStringsRule());
}
addWithLastConsumed(
$current,
"values",
lv_values_0_0,
"org.eclipse.xtext.common.Terminals.STRING");
}
)
)+
;
// Entry rule entryRuleFewerLookAheadStrings
entryRuleFewerLookAheadStrings returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getFewerLookAheadStringsRule()); }
iv_ruleFewerLookAheadStrings=ruleFewerLookAheadStrings
{ $current=$iv_ruleFewerLookAheadStrings.current; }
EOF;
// Rule FewerLookAheadStrings
ruleFewerLookAheadStrings returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
lv_values_0_0=RULE_STRING
{
newLeafNode(lv_values_0_0, grammarAccess.getFewerLookAheadStringsAccess().getValuesSTRINGTerminalRuleCall_0_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getFewerLookAheadStringsRule());
}
addWithLastConsumed(
$current,
"values",
lv_values_0_0,
"org.eclipse.xtext.common.Terminals.STRING");
}
)
)
(
(
lv_values_1_0=RULE_STRING
{
newLeafNode(lv_values_1_0, grammarAccess.getFewerLookAheadStringsAccess().getValuesSTRINGTerminalRuleCall_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getFewerLookAheadStringsRule());
}
addWithLastConsumed(
$current,
"values",
lv_values_1_0,
"org.eclipse.xtext.common.Terminals.STRING");
}
)
)
(
(
lv_values_2_0=RULE_ID
{
newLeafNode(lv_values_2_0, grammarAccess.getFewerLookAheadStringsAccess().getValuesIDTerminalRuleCall_2_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getFewerLookAheadStringsRule());
}
addWithLastConsumed(
$current,
"values",
lv_values_2_0,
"org.eclipse.xtext.common.Terminals.ID");
}
)
)
)
;
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
RULE_INT : ('0'..'9')+;

View file

@ -4,12 +4,13 @@
'c'=16
'd'=15
'foo'=13
'zonk'=17
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
RULE_ID=5
RULE_INT=6
RULE_ML_COMMENT=7
RULE_SL_COMMENT=8
RULE_STRING=6
RULE_STRING=4
RULE_WS=9
T__11=11
T__12=12
@ -17,3 +18,4 @@ T__13=13
T__14=14
T__15=15
T__16=16
T__17=17

View file

@ -12,14 +12,15 @@ import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalLookaheadTestLanguageLexer extends Lexer {
public static final int RULE_ID=4;
public static final int RULE_ID=5;
public static final int RULE_WS=9;
public static final int RULE_STRING=6;
public static final int RULE_STRING=4;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_SL_COMMENT=8;
public static final int T__15=15;
public static final int T__16=16;
public static final int RULE_INT=5;
public static final int T__17=17;
public static final int RULE_INT=6;
public static final int T__11=11;
public static final int RULE_ML_COMMENT=7;
public static final int T__12=12;
@ -162,15 +163,36 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
// $ANTLR end "T__16"
// $ANTLR start "T__17"
public final void mT__17() throws RecognitionException {
try {
int _type = T__17;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:17:7: ( 'zonk' )
// InternalLookaheadTestLanguage.g:17:9: 'zonk'
{
match("zonk");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__17"
// $ANTLR start "RULE_ID"
public final void mRULE_ID() throws RecognitionException {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:413:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalLookaheadTestLanguage.g:413:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalLookaheadTestLanguage.g:660:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalLookaheadTestLanguage.g:660:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// InternalLookaheadTestLanguage.g:413:11: ( '^' )?
// InternalLookaheadTestLanguage.g:660:11: ( '^' )?
int alt1=2;
int LA1_0 = input.LA(1);
@ -179,7 +201,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
switch (alt1) {
case 1 :
// InternalLookaheadTestLanguage.g:413:11: '^'
// InternalLookaheadTestLanguage.g:660:11: '^'
{
match('^');
@ -197,7 +219,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
recover(mse);
throw mse;}
// InternalLookaheadTestLanguage.g:413:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalLookaheadTestLanguage.g:660:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
loop2:
do {
int alt2=2;
@ -246,10 +268,10 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:415:10: ( ( '0' .. '9' )+ )
// InternalLookaheadTestLanguage.g:415:12: ( '0' .. '9' )+
// InternalLookaheadTestLanguage.g:662:10: ( ( '0' .. '9' )+ )
// InternalLookaheadTestLanguage.g:662:12: ( '0' .. '9' )+
{
// InternalLookaheadTestLanguage.g:415:12: ( '0' .. '9' )+
// InternalLookaheadTestLanguage.g:662:12: ( '0' .. '9' )+
int cnt3=0;
loop3:
do {
@ -263,7 +285,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
switch (alt3) {
case 1 :
// InternalLookaheadTestLanguage.g:415:13: '0' .. '9'
// InternalLookaheadTestLanguage.g:662:13: '0' .. '9'
{
matchRange('0','9');
@ -295,10 +317,10 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:417:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalLookaheadTestLanguage.g:417:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalLookaheadTestLanguage.g:664:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalLookaheadTestLanguage.g:664:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// InternalLookaheadTestLanguage.g:417:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalLookaheadTestLanguage.g:664:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt6=2;
int LA6_0 = input.LA(1);
@ -316,10 +338,10 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
switch (alt6) {
case 1 :
// InternalLookaheadTestLanguage.g:417:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
// InternalLookaheadTestLanguage.g:664:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// InternalLookaheadTestLanguage.g:417:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
// InternalLookaheadTestLanguage.g:664:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
loop4:
do {
int alt4=3;
@ -335,7 +357,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
switch (alt4) {
case 1 :
// InternalLookaheadTestLanguage.g:417:21: '\\\\' .
// InternalLookaheadTestLanguage.g:664:21: '\\\\' .
{
match('\\');
matchAny();
@ -343,7 +365,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalLookaheadTestLanguage.g:417:28: ~ ( ( '\\\\' | '\"' ) )
// InternalLookaheadTestLanguage.g:664:28: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -368,10 +390,10 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalLookaheadTestLanguage.g:417:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
// InternalLookaheadTestLanguage.g:664:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// InternalLookaheadTestLanguage.g:417:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
// InternalLookaheadTestLanguage.g:664:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
loop5:
do {
int alt5=3;
@ -387,7 +409,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
switch (alt5) {
case 1 :
// InternalLookaheadTestLanguage.g:417:54: '\\\\' .
// InternalLookaheadTestLanguage.g:664:54: '\\\\' .
{
match('\\');
matchAny();
@ -395,7 +417,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalLookaheadTestLanguage.g:417:61: ~ ( ( '\\\\' | '\\'' ) )
// InternalLookaheadTestLanguage.g:664:61: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -438,12 +460,12 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:419:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalLookaheadTestLanguage.g:419:19: '/*' ( options {greedy=false; } : . )* '*/'
// InternalLookaheadTestLanguage.g:666:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalLookaheadTestLanguage.g:666:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// InternalLookaheadTestLanguage.g:419:24: ( options {greedy=false; } : . )*
// InternalLookaheadTestLanguage.g:666:24: ( options {greedy=false; } : . )*
loop7:
do {
int alt7=2;
@ -468,7 +490,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
switch (alt7) {
case 1 :
// InternalLookaheadTestLanguage.g:419:52: .
// InternalLookaheadTestLanguage.g:666:52: .
{
matchAny();
@ -498,12 +520,12 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:421:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalLookaheadTestLanguage.g:421:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// InternalLookaheadTestLanguage.g:668:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalLookaheadTestLanguage.g:668:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalLookaheadTestLanguage.g:421:24: (~ ( ( '\\n' | '\\r' ) ) )*
// InternalLookaheadTestLanguage.g:668:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop8:
do {
int alt8=2;
@ -516,7 +538,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
switch (alt8) {
case 1 :
// InternalLookaheadTestLanguage.g:421:24: ~ ( ( '\\n' | '\\r' ) )
// InternalLookaheadTestLanguage.g:668:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -536,7 +558,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
} while (true);
// InternalLookaheadTestLanguage.g:421:40: ( ( '\\r' )? '\\n' )?
// InternalLookaheadTestLanguage.g:668:40: ( ( '\\r' )? '\\n' )?
int alt10=2;
int LA10_0 = input.LA(1);
@ -545,9 +567,9 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
switch (alt10) {
case 1 :
// InternalLookaheadTestLanguage.g:421:41: ( '\\r' )? '\\n'
// InternalLookaheadTestLanguage.g:668:41: ( '\\r' )? '\\n'
{
// InternalLookaheadTestLanguage.g:421:41: ( '\\r' )?
// InternalLookaheadTestLanguage.g:668:41: ( '\\r' )?
int alt9=2;
int LA9_0 = input.LA(1);
@ -556,7 +578,7 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
switch (alt9) {
case 1 :
// InternalLookaheadTestLanguage.g:421:41: '\\r'
// InternalLookaheadTestLanguage.g:668:41: '\\r'
{
match('\r');
@ -588,10 +610,10 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:423:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalLookaheadTestLanguage.g:423:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalLookaheadTestLanguage.g:670:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalLookaheadTestLanguage.g:670:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// InternalLookaheadTestLanguage.g:423:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalLookaheadTestLanguage.g:670:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt11=0;
loop11:
do {
@ -645,8 +667,8 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalLookaheadTestLanguage.g:425:16: ( . )
// InternalLookaheadTestLanguage.g:425:18: .
// InternalLookaheadTestLanguage.g:672:16: ( . )
// InternalLookaheadTestLanguage.g:672:18: .
{
matchAny();
@ -661,8 +683,8 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
// $ANTLR end "RULE_ANY_OTHER"
public void mTokens() throws RecognitionException {
// InternalLookaheadTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=13;
// InternalLookaheadTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=14;
alt12 = dfa12.predict(input);
switch (alt12) {
case 1 :
@ -708,49 +730,56 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
}
break;
case 7 :
// InternalLookaheadTestLanguage.g:1:46: RULE_ID
// InternalLookaheadTestLanguage.g:1:46: T__17
{
mT__17();
}
break;
case 8 :
// InternalLookaheadTestLanguage.g:1:52: RULE_ID
{
mRULE_ID();
}
break;
case 8 :
// InternalLookaheadTestLanguage.g:1:54: RULE_INT
case 9 :
// InternalLookaheadTestLanguage.g:1:60: RULE_INT
{
mRULE_INT();
}
break;
case 9 :
// InternalLookaheadTestLanguage.g:1:63: RULE_STRING
case 10 :
// InternalLookaheadTestLanguage.g:1:69: RULE_STRING
{
mRULE_STRING();
}
break;
case 10 :
// InternalLookaheadTestLanguage.g:1:75: RULE_ML_COMMENT
case 11 :
// InternalLookaheadTestLanguage.g:1:81: RULE_ML_COMMENT
{
mRULE_ML_COMMENT();
}
break;
case 11 :
// InternalLookaheadTestLanguage.g:1:91: RULE_SL_COMMENT
case 12 :
// InternalLookaheadTestLanguage.g:1:97: RULE_SL_COMMENT
{
mRULE_SL_COMMENT();
}
break;
case 12 :
// InternalLookaheadTestLanguage.g:1:107: RULE_WS
case 13 :
// InternalLookaheadTestLanguage.g:1:113: RULE_WS
{
mRULE_WS();
}
break;
case 13 :
// InternalLookaheadTestLanguage.g:1:115: RULE_ANY_OTHER
case 14 :
// InternalLookaheadTestLanguage.g:1:121: RULE_ANY_OTHER
{
mRULE_ANY_OTHER();
@ -764,49 +793,54 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
protected DFA12 dfa12 = new DFA12(this);
static final String DFA12_eotS =
"\1\uffff\1\17\1\21\1\20\1\23\1\24\1\15\2\uffff\3\15\2\uffff\1\20\3\uffff\1\20\7\uffff\1\34\1\35\2\uffff";
"\1\uffff\1\20\1\22\1\21\1\24\1\25\1\21\1\16\2\uffff\3\16\2\uffff\1\21\3\uffff\1\21\2\uffff\1\21\5\uffff\1\37\1\40\1\21\2\uffff\1\42\1\uffff";
static final String DFA12_eofS =
"\36\uffff";
"\43\uffff";
static final String DFA12_minS =
"\1\0\2\60\1\157\2\60\1\101\2\uffff\2\0\1\52\2\uffff\1\162\3\uffff\1\157\7\uffff\2\60\2\uffff";
"\1\0\2\60\1\157\2\60\1\157\1\101\2\uffff\2\0\1\52\2\uffff\1\162\3\uffff\1\157\2\uffff\1\156\5\uffff\2\60\1\153\2\uffff\1\60\1\uffff";
static final String DFA12_maxS =
"\1\uffff\2\172\1\157\3\172\2\uffff\2\uffff\1\57\2\uffff\1\162\3\uffff\1\157\7\uffff\2\172\2\uffff";
"\1\uffff\2\172\1\157\2\172\1\157\1\172\2\uffff\2\uffff\1\57\2\uffff\1\162\3\uffff\1\157\2\uffff\1\156\5\uffff\2\172\1\153\2\uffff\1\172\1\uffff";
static final String DFA12_acceptS =
"\7\uffff\1\7\1\10\3\uffff\1\14\1\15\1\uffff\1\4\1\7\1\2\1\uffff\1\5\1\6\1\10\1\11\1\12\1\13\1\14\2\uffff\1\1\1\3";
"\10\uffff\1\10\1\11\3\uffff\1\15\1\16\1\uffff\1\4\1\10\1\2\1\uffff\1\5\1\6\1\uffff\1\11\1\12\1\13\1\14\1\15\3\uffff\1\1\1\3\1\uffff\1\7";
static final String DFA12_specialS =
"\1\1\10\uffff\1\0\1\2\23\uffff}>";
"\1\2\11\uffff\1\0\1\1\27\uffff}>";
static final String[] DFA12_transitionS = DFA12_transitionS_.DFA12_transitionS;
private static final class DFA12_transitionS_ {
static final String[] DFA12_transitionS = {
"\11\15\2\14\2\15\1\14\22\15\1\14\1\15\1\11\4\15\1\12\7\15\1\13\12\10\7\15\32\7\3\15\1\6\1\7\1\15\1\2\1\1\1\5\1\4\1\7\1\3\24\7\uff85\15",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\1\16\31\20",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
"\1\22",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
"\32\20\4\uffff\1\20\1\uffff\32\20",
"\11\16\2\15\2\16\1\15\22\16\1\15\1\16\1\12\4\16\1\13\7\16\1\14\12\11\7\16\32\10\3\16\1\7\1\10\1\16\1\2\1\1\1\5\1\4\1\10\1\3\23\10\1\6\uff85\16",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\1\17\31\21",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
"\1\23",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
"\1\26",
"\32\21\4\uffff\1\21\1\uffff\32\21",
"",
"",
"\0\26",
"\0\26",
"\1\27\4\uffff\1\30",
"\0\30",
"\0\30",
"\1\31\4\uffff\1\32",
"",
"",
"\1\32",
"\1\34",
"",
"",
"",
"\1\33",
"\1\35",
"",
"",
"\1\36",
"",
"",
"",
"",
"",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
"\1\41",
"",
"",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
"",
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
""
};
}
@ -841,23 +875,33 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
this.transition = DFA12_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
}
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
IntStream input = _input;
int _s = s;
switch ( s ) {
case 0 :
int LA12_9 = input.LA(1);
int LA12_10 = input.LA(1);
s = -1;
if ( ((LA12_9>='\u0000' && LA12_9<='\uFFFF')) ) {s = 22;}
if ( ((LA12_10>='\u0000' && LA12_10<='\uFFFF')) ) {s = 24;}
else s = 13;
else s = 14;
if ( s>=0 ) return s;
break;
case 1 :
int LA12_11 = input.LA(1);
s = -1;
if ( ((LA12_11>='\u0000' && LA12_11<='\uFFFF')) ) {s = 24;}
else s = 14;
if ( s>=0 ) return s;
break;
case 2 :
int LA12_0 = input.LA(1);
s = -1;
@ -871,31 +915,23 @@ public class InternalLookaheadTestLanguageLexer extends Lexer {
else if ( (LA12_0=='c') ) {s = 5;}
else if ( (LA12_0=='^') ) {s = 6;}
else if ( (LA12_0=='z') ) {s = 6;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='e'||(LA12_0>='g' && LA12_0<='z')) ) {s = 7;}
else if ( (LA12_0=='^') ) {s = 7;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 8;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='e'||(LA12_0>='g' && LA12_0<='y')) ) {s = 8;}
else if ( (LA12_0=='\"') ) {s = 9;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 9;}
else if ( (LA12_0=='\'') ) {s = 10;}
else if ( (LA12_0=='\"') ) {s = 10;}
else if ( (LA12_0=='/') ) {s = 11;}
else if ( (LA12_0=='\'') ) {s = 11;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 12;}
else if ( (LA12_0=='/') ) {s = 12;}
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||(LA12_0>='[' && LA12_0<=']')||LA12_0=='`'||(LA12_0>='{' && LA12_0<='\uFFFF')) ) {s = 13;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 13;}
if ( s>=0 ) return s;
break;
case 2 :
int LA12_10 = input.LA(1);
s = -1;
if ( ((LA12_10>='\u0000' && LA12_10<='\uFFFF')) ) {s = 22;}
else s = 13;
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||(LA12_0>='[' && LA12_0<=']')||LA12_0=='`'||(LA12_0>='{' && LA12_0<='\uFFFF')) ) {s = 14;}
if ( s>=0 ) return s;
break;

View file

@ -15,11 +15,15 @@ import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;
import org.eclipse.xtext.testlanguages.lookaheadLang.Entry;
import org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead0;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead1;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead2;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead3;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAhead4;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookaheadLangPackage;
import org.eclipse.xtext.testlanguages.services.LookaheadTestLanguageGrammarAccess;
@ -40,6 +44,9 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
case LookaheadLangPackage.ENTRY:
sequence_Entry(context, (Entry) semanticObject);
return;
case LookaheadLangPackage.FEWER_LOOK_AHEAD_STRINGS:
sequence_FewerLookAheadStrings(context, (FewerLookAheadStrings) semanticObject);
return;
case LookaheadLangPackage.LOOK_AHEAD0:
sequence_LookAhead0(context, (LookAhead0) semanticObject);
return;
@ -55,6 +62,15 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
case LookaheadLangPackage.LOOK_AHEAD4:
sequence_LookAhead4(context, (LookAhead4) semanticObject);
return;
case LookaheadLangPackage.LOOK_AHEAD_PREDICATE:
sequence_LookAheadPredicate(context, (LookAheadPredicate) semanticObject);
return;
case LookaheadLangPackage.LOOK_AHEAD_STRINGS:
sequence_LookAheadStrings(context, (LookAheadStrings) semanticObject);
return;
case LookaheadLangPackage.LOOK_BEYOND:
sequence_LookBeyond(context, (LookBeyond) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
@ -72,6 +88,18 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
}
/**
* Contexts:
* FewerLookAheadStrings returns FewerLookAheadStrings
*
* Constraint:
* (values+=STRING values+=STRING values+=ID)
*/
protected void sequence_FewerLookAheadStrings(ISerializationContext context, FewerLookAheadStrings semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Alts returns LookAhead0
@ -82,8 +110,8 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
*/
protected void sequence_LookAhead0(ISerializationContext context, LookAhead0 semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.ALTS__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.ALTS__X));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD0__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD0__X));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getLookAhead0Access().getXAKeyword_1_0(), semanticObject.getX());
@ -103,8 +131,8 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__Y) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__Y));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.ALTS__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.ALTS__X));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__X));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__Z) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD1__Z));
}
@ -138,8 +166,8 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
*/
protected void sequence_LookAhead3(ISerializationContext context, LookAhead3 semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.ALTS__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.ALTS__X));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD3__X) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD3__X));
if (transientValues.isValueTransient(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD3__Z) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, LookaheadLangPackage.Literals.LOOK_AHEAD3__Z));
}
@ -162,4 +190,42 @@ public class LookaheadTestLanguageSemanticSequencer extends AbstractDelegatingSe
}
/**
* Contexts:
* Alts returns LookAheadPredicate
* LookAheadPredicate returns LookAheadPredicate
*
* Constraint:
* {LookAheadPredicate}
*/
protected void sequence_LookAheadPredicate(ISerializationContext context, LookAheadPredicate semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* LookAheadStrings returns LookAheadStrings
*
* Constraint:
* values+=STRING+
*/
protected void sequence_LookAheadStrings(ISerializationContext context, LookAheadStrings semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Alts returns LookBeyond
* LookBeyond returns LookBeyond
*
* Constraint:
* (left=LookAheadStrings? right=FewerLookAheadStrings)
*/
protected void sequence_LookBeyond(ISerializationContext context, LookBeyond semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
}

View file

@ -6,6 +6,7 @@ package org.eclipse.xtext.testlanguages.services;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.xtext.Action;
import org.eclipse.xtext.Alternatives;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.Grammar;
@ -43,12 +44,14 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
private final RuleCall cLookAhead0ParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall cLookAhead1ParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1);
private final RuleCall cLookAhead3ParserRuleCall_2 = (RuleCall)cAlternatives.eContents().get(2);
private final RuleCall cLookAheadPredicateParserRuleCall_3 = (RuleCall)cAlternatives.eContents().get(3);
private final RuleCall cLookBeyondParserRuleCall_4 = (RuleCall)cAlternatives.eContents().get(4);
//Alts:
// LookAhead0 | LookAhead1 | LookAhead3;
// LookAhead0 | LookAhead1 | LookAhead3 | LookAheadPredicate | LookBeyond;
@Override public ParserRule getRule() { return rule; }
//LookAhead0 | LookAhead1 | LookAhead3
//LookAhead0 | LookAhead1 | LookAhead3 | LookAheadPredicate | LookBeyond
public Alternatives getAlternatives() { return cAlternatives; }
//LookAhead0
@ -59,6 +62,12 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
//LookAhead3
public RuleCall getLookAhead3ParserRuleCall_2() { return cLookAhead3ParserRuleCall_2; }
//LookAheadPredicate
public RuleCall getLookAheadPredicateParserRuleCall_3() { return cLookAheadPredicateParserRuleCall_3; }
//LookBeyond
public RuleCall getLookBeyondParserRuleCall_4() { return cLookBeyondParserRuleCall_4; }
}
public class LookAhead0Elements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.LookaheadTestLanguage.LookAhead0");
@ -219,6 +228,122 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
//'d'
public Keyword getXDKeyword_1_0() { return cXDKeyword_1_0; }
}
public class LookAheadPredicateElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.LookaheadTestLanguage.LookAheadPredicate");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group cGroup_0 = (Group)cGroup.eContents().get(0);
private final Group cGroup_0_0 = (Group)cGroup_0.eContents().get(0);
private final Action cLookAheadPredicateAction_0_0_0 = (Action)cGroup_0_0.eContents().get(0);
private final Keyword cZonkKeyword_0_0_1 = (Keyword)cGroup_0_0.eContents().get(1);
private final Keyword cAKeyword_0_0_2 = (Keyword)cGroup_0_0.eContents().get(2);
private final Keyword cBKeyword_0_0_3 = (Keyword)cGroup_0_0.eContents().get(3);
private final Keyword cDKeyword_1 = (Keyword)cGroup.eContents().get(1);
//LookAheadPredicate:
// => ({LookAheadPredicate} 'zonk' 'a' 'b') 'd';
@Override public ParserRule getRule() { return rule; }
//=> ({LookAheadPredicate} 'zonk' 'a' 'b') 'd'
public Group getGroup() { return cGroup; }
//=> ({LookAheadPredicate} 'zonk' 'a' 'b')
public Group getGroup_0() { return cGroup_0; }
//({LookAheadPredicate} 'zonk' 'a' 'b')
public Group getGroup_0_0() { return cGroup_0_0; }
//{LookAheadPredicate}
public Action getLookAheadPredicateAction_0_0_0() { return cLookAheadPredicateAction_0_0_0; }
//'zonk'
public Keyword getZonkKeyword_0_0_1() { return cZonkKeyword_0_0_1; }
//'a'
public Keyword getAKeyword_0_0_2() { return cAKeyword_0_0_2; }
//'b'
public Keyword getBKeyword_0_0_3() { return cBKeyword_0_0_3; }
//'d'
public Keyword getDKeyword_1() { return cDKeyword_1; }
}
public class LookBeyondElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.LookaheadTestLanguage.LookBeyond");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment cLeftAssignment_0 = (Assignment)cGroup.eContents().get(0);
private final RuleCall cLeftLookAheadStringsParserRuleCall_0_0 = (RuleCall)cLeftAssignment_0.eContents().get(0);
private final Assignment cRightAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final RuleCall cRightFewerLookAheadStringsParserRuleCall_1_0 = (RuleCall)cRightAssignment_1.eContents().get(0);
//LookBeyond:
// left=LookAheadStrings? right=FewerLookAheadStrings;
@Override public ParserRule getRule() { return rule; }
//left=LookAheadStrings? right=FewerLookAheadStrings
public Group getGroup() { return cGroup; }
//left=LookAheadStrings?
public Assignment getLeftAssignment_0() { return cLeftAssignment_0; }
//LookAheadStrings
public RuleCall getLeftLookAheadStringsParserRuleCall_0_0() { return cLeftLookAheadStringsParserRuleCall_0_0; }
//right=FewerLookAheadStrings
public Assignment getRightAssignment_1() { return cRightAssignment_1; }
//FewerLookAheadStrings
public RuleCall getRightFewerLookAheadStringsParserRuleCall_1_0() { return cRightFewerLookAheadStringsParserRuleCall_1_0; }
}
public class LookAheadStringsElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.LookaheadTestLanguage.LookAheadStrings");
private final Assignment cValuesAssignment = (Assignment)rule.eContents().get(1);
private final RuleCall cValuesSTRINGTerminalRuleCall_0 = (RuleCall)cValuesAssignment.eContents().get(0);
//LookAheadStrings:
// values+=STRING+;
@Override public ParserRule getRule() { return rule; }
//values+=STRING+
public Assignment getValuesAssignment() { return cValuesAssignment; }
//STRING
public RuleCall getValuesSTRINGTerminalRuleCall_0() { return cValuesSTRINGTerminalRuleCall_0; }
}
public class FewerLookAheadStringsElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.LookaheadTestLanguage.FewerLookAheadStrings");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment cValuesAssignment_0 = (Assignment)cGroup.eContents().get(0);
private final RuleCall cValuesSTRINGTerminalRuleCall_0_0 = (RuleCall)cValuesAssignment_0.eContents().get(0);
private final Assignment cValuesAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final RuleCall cValuesSTRINGTerminalRuleCall_1_0 = (RuleCall)cValuesAssignment_1.eContents().get(0);
private final Assignment cValuesAssignment_2 = (Assignment)cGroup.eContents().get(2);
private final RuleCall cValuesIDTerminalRuleCall_2_0 = (RuleCall)cValuesAssignment_2.eContents().get(0);
//FewerLookAheadStrings:
// values+=STRING values+=STRING values+=ID;
@Override public ParserRule getRule() { return rule; }
//values+=STRING values+=STRING values+=ID
public Group getGroup() { return cGroup; }
//values+=STRING
public Assignment getValuesAssignment_0() { return cValuesAssignment_0; }
//STRING
public RuleCall getValuesSTRINGTerminalRuleCall_0_0() { return cValuesSTRINGTerminalRuleCall_0_0; }
//values+=STRING
public Assignment getValuesAssignment_1() { return cValuesAssignment_1; }
//STRING
public RuleCall getValuesSTRINGTerminalRuleCall_1_0() { return cValuesSTRINGTerminalRuleCall_1_0; }
//values+=ID
public Assignment getValuesAssignment_2() { return cValuesAssignment_2; }
//ID
public RuleCall getValuesIDTerminalRuleCall_2_0() { return cValuesIDTerminalRuleCall_2_0; }
}
private final EntryElements pEntry;
@ -228,6 +353,10 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
private final LookAhead2Elements pLookAhead2;
private final LookAhead3Elements pLookAhead3;
private final LookAhead4Elements pLookAhead4;
private final LookAheadPredicateElements pLookAheadPredicate;
private final LookBeyondElements pLookBeyond;
private final LookAheadStringsElements pLookAheadStrings;
private final FewerLookAheadStringsElements pFewerLookAheadStrings;
private final Grammar grammar;
@ -245,6 +374,10 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
this.pLookAhead2 = new LookAhead2Elements();
this.pLookAhead3 = new LookAhead3Elements();
this.pLookAhead4 = new LookAhead4Elements();
this.pLookAheadPredicate = new LookAheadPredicateElements();
this.pLookBeyond = new LookBeyondElements();
this.pLookAheadStrings = new LookAheadStringsElements();
this.pFewerLookAheadStrings = new FewerLookAheadStringsElements();
}
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
@ -285,7 +418,7 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
}
//Alts:
// LookAhead0 | LookAhead1 | LookAhead3;
// LookAhead0 | LookAhead1 | LookAhead3 | LookAheadPredicate | LookBeyond;
public AltsElements getAltsAccess() {
return pAlts;
}
@ -344,6 +477,46 @@ public class LookaheadTestLanguageGrammarAccess extends AbstractGrammarElementFi
return getLookAhead4Access().getRule();
}
//LookAheadPredicate:
// => ({LookAheadPredicate} 'zonk' 'a' 'b') 'd';
public LookAheadPredicateElements getLookAheadPredicateAccess() {
return pLookAheadPredicate;
}
public ParserRule getLookAheadPredicateRule() {
return getLookAheadPredicateAccess().getRule();
}
//LookBeyond:
// left=LookAheadStrings? right=FewerLookAheadStrings;
public LookBeyondElements getLookBeyondAccess() {
return pLookBeyond;
}
public ParserRule getLookBeyondRule() {
return getLookBeyondAccess().getRule();
}
//LookAheadStrings:
// values+=STRING+;
public LookAheadStringsElements getLookAheadStringsAccess() {
return pLookAheadStrings;
}
public ParserRule getLookAheadStringsRule() {
return getLookAheadStringsAccess().getRule();
}
//FewerLookAheadStrings:
// values+=STRING values+=STRING values+=ID;
public FewerLookAheadStringsElements getFewerLookAheadStringsAccess() {
return pFewerLookAheadStrings;
}
public ParserRule getFewerLookAheadStringsRule() {
return getFewerLookAheadStringsAccess().getRule();
}
//terminal ID:
// '^'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*;
public TerminalRule getIDRule() {

View file

@ -9,8 +9,15 @@
*******************************************************************************/
package org.eclipse.xtext.parser;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.parser.impl.PartialParsingPointers;
import org.eclipse.xtext.testlanguages.LookaheadTestLanguageStandaloneSetup;
import org.eclipse.xtext.testlanguages.lookaheadLang.Entry;
import org.eclipse.xtext.testlanguages.lookaheadLang.FewerLookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadPredicate;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookAheadStrings;
import org.eclipse.xtext.testlanguages.lookaheadLang.LookBeyond;
import org.junit.Test;
/**
@ -18,30 +25,33 @@ import org.junit.Test;
* @author Sebastian Zarnekow
*/
public class PartialParsingPointerLookaheadTest extends AbstractPartialParsingPointerTest {
@Override
public void setUp() throws Exception {
super.setUp();
with(LookaheadTestLanguageStandaloneSetup.class);
}
@Test public void testLookahead_0_2() throws Exception {
@Test
public void testLookahead_0_2() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 0; i < 3; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
checkParseRegionPointers(parsingPointers, model, "ParserRule", "Entry");
}
}
@Test public void testLookahead_3_4() throws Exception {
@Test
public void testLookahead_3_4() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 3; i < 5; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
checkParseRegionPointers(parsingPointers, "bar a", "RuleCall", "LookAhead0");
}
}
@Test public void testLookahead_6_8() throws Exception {
@Test
public void testLookahead_6_8() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 6; i < 9; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
@ -49,25 +59,29 @@ public class PartialParsingPointerLookaheadTest extends AbstractPartialParsingPo
}
}
@Test public void testLookahead_9_14() throws Exception {
@Test
public void testLookahead_9_14() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 9; i < 15; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
// actual expecation would lead to yet more complexity in partial parser
// actual expecation would lead to yet more complexity in partial
// parser
// checkParseRegionPointers(parsingPointers, " foo bar c b d", "RuleCall", "Alts");
checkParseRegionPointers(parsingPointers, model, "ParserRule", "Entry");
}
}
@Test public void testLookahead_15_18() throws Exception {
@Test
public void testLookahead_15_18() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 15; i < 19; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
checkParseRegionPointers(parsingPointers, " foo bar c b d", "RuleCall", "LookAhead1");
}
}
@Test public void testLookahead_19_22() throws Exception {
@Test
public void testLookahead_19_22() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 19; i < 22; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
@ -75,20 +89,91 @@ public class PartialParsingPointerLookaheadTest extends AbstractPartialParsingPo
}
}
@Test public void testLookahead_23_28() throws Exception {
@Test
public void testLookahead_23_28() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 23; i < 29; ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
checkParseRegionPointers(parsingPointers, model, "ParserRule", "Entry");
}
}
@Test public void testLookahead_29() throws Exception {
@Test
public void testLookahead_29() throws Exception {
String model = "bar a foo bar c b d foo bar b c";
for (int i = 29; i < model.length(); ++i) {
PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
checkParseRegionPointers(parsingPointers, " c", "RuleCall", "LookAhead4");
}
}
@Test
public void testPredicatedLookahead_01() throws Exception {
Entry e = (Entry) getModel("zonk a b d");
LookAheadPredicate lap = (LookAheadPredicate) e.getContents().get(0);
ICompositeNode node = NodeModelUtils.getNode(lap);
assertEquals(3, node.getLookAhead());
}
@Test
public void testPredicatedLookahead_02() throws Exception {
Entry e = (Entry) getModel("zonk /* */ a /* */ b d");
LookAheadPredicate lap = (LookAheadPredicate) e.getContents().get(0);
ICompositeNode node = NodeModelUtils.getNode(lap);
assertEquals(3, node.getLookAhead());
}
@Test
public void testLookBeyond_01() throws Exception {
Entry e = (Entry) getModel("'' '' ID");
LookBeyond lb = (LookBeyond) e.getContents().get(0);
ICompositeNode node = NodeModelUtils.getNode(lb);
assertEquals(1, node.getLookAhead());
assertNull(lb.getLeft());
FewerLookAheadStrings flas = lb.getRight();
node = NodeModelUtils.getNode(flas);
assertEquals(3, node.getLookAhead());
}
@Test
public void testLookBeyond_02() throws Exception {
Entry e = (Entry) getModel("'a' 'b' 'c' ID");
LookBeyond lb = (LookBeyond) e.getContents().get(0);
ICompositeNode node = NodeModelUtils.getNode(lb);
assertEquals(1, node.getLookAhead());
assertNotNull(lb.getLeft());
LookAheadStrings las = lb.getLeft();
node = NodeModelUtils.getNode(las);
assertEquals(3, node.getLookAhead());
FewerLookAheadStrings flas = lb.getRight();
node = NodeModelUtils.getNode(flas);
assertEquals(3, node.getLookAhead());
}
@Test
public void testLookBeyond_03() throws Exception {
Entry e = (Entry) getModel("'1' '1' '1' '1' 'a' 'a' ID");
LookBeyond lb = (LookBeyond) e.getContents().get(0);
ICompositeNode node = NodeModelUtils.getNode(lb);
assertEquals(1, node.getLookAhead());
assertNotNull(lb.getLeft());
LookAheadStrings las = lb.getLeft();
node = NodeModelUtils.getNode(las);
assertEquals(3, node.getLookAhead());
FewerLookAheadStrings flas = lb.getRight();
node = NodeModelUtils.getNode(flas);
assertEquals(3, node.getLookAhead());
}
@Test
public void testLookBeyond_04() throws Exception {
String model = "'1' '1' '1' '2' '1' 'a' 'a' ID";
PartialParsingPointers ppp = calculatePartialParsingPointers(model, model.indexOf("'2'"), 3);
/*
* TODO this is an invalid expectation since changes to the number of
* strings would have an impact on the resulting model
*/
checkParseRegionPointers(ppp, "'1' '1' '1' '2' '1'", "RuleCall", "LookAheadStrings");
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2008, 2020 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
@ -13,7 +13,7 @@ generate lookaheadLang "http://www.eclipse.org/2008/xtext/LookaheadLang"
Entry: (contents+=Alts)*;
Alts: LookAhead0 | LookAhead1 | LookAhead3;
Alts: LookAhead0 | LookAhead1 | LookAhead3 | LookAheadPredicate | LookBeyond;
LookAhead0: 'bar' x='a';
@ -26,4 +26,19 @@ LookAhead3: 'foo' 'bar' x='b' z=LookAhead4;
LookAhead4:
x='c' | x='d';
LookAheadPredicate:
=>({LookAheadPredicate} 'zonk' 'a' 'b') 'd'
;
LookBeyond:
left=LookAheadStrings? right=FewerLookAheadStrings
;
LookAheadStrings:
values += STRING+
;
FewerLookAheadStrings:
values+=STRING values+=STRING values+=ID
;

View file

@ -27,6 +27,7 @@ import org.eclipse.xtext.formatting.INodeModelFormatter;
import org.eclipse.xtext.linking.ILinkingService;
import org.eclipse.xtext.linking.lazy.LazyLinkingResource;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.LookAheadInfo;
import org.eclipse.xtext.nodemodel.impl.InvariantChecker;
import org.eclipse.xtext.parser.IAstFactory;
import org.eclipse.xtext.parser.IParseResult;
@ -289,8 +290,11 @@ public abstract class AbstractXtextTests extends Assert implements ResourceLoadH
protected void checkNodeModel(XtextResource resource) {
IParseResult parseResult = resource.getParseResult();
if(parseResult != null)
getInvariantChecker().checkInvariant(parseResult.getRootNode());
if(parseResult != null) {
ICompositeNode rootNode = parseResult.getRootNode();
getInvariantChecker().checkInvariant(rootNode);
new LookAheadInfo(rootNode).checkConsistency();
}
}
protected boolean shouldTestSerializer(XtextResource resource) {

View file

@ -0,0 +1,100 @@
/*******************************************************************************
* Copyright (c) 2020 Sebastian Zarnekow and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.xtext.nodemodel;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.xtext.Action;
import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
/**
* Utility to work with the lookAhead information in the node model.
*
* @author Sebastian Zarnekow - Initial contribution and API
*
* @since 2.22
*/
@Beta
public class LookAheadInfo {
/* TODO
* - add getLookAhead(INode node) with support for leaf-nodes
* - add getLookBeyond(INode node)
* - getParserInformation(int offset): ParserInformation with ParserInformation( ParserRule, TextRegion, Iterator**)
* usable for content assist, e.g. it must support parameterized rule stack recreation
* - getEntryPoint(int offset, int length, String newText) with support for partial parsing (consider lookBeyond)
* - Iterator** returns an iterator over nodes from the entry point to the position such that
* the parser would reach the position as fast as possible, e.g. an iterator that skips over
* regions that are not relevant to the parsers decision
* - INode.getLookAheadInfo(): LookAheadInfo as default method that uses the resource to obtain an
* injectable LookAheadInfo.Factory from allow customization
*/
public static class InconsistentLookAheadException extends RuntimeException {
private static final long serialVersionUID = 1L;
public InconsistentLookAheadException(String message, Throwable cause) {
super(message, cause);
}
public InconsistentLookAheadException(String message) {
super(message);
}
}
private final ICompositeNode rootNode;
public LookAheadInfo(ICompositeNode rootNode) {
Preconditions.checkArgument(rootNode.getRootNode() == rootNode);
this.rootNode = rootNode;
}
public void checkConsistency() throws InconsistentLookAheadException {
AtomicInteger currentLookAhead = new AtomicInteger();
for(INode node: rootNode.getAsTreeIterable()) {
checkConsistency(node, currentLookAhead);
}
}
protected void checkConsistency(INode node, AtomicInteger currentLookAhead) {
if (node instanceof ICompositeNode) {
checkConsistency((ICompositeNode)node, currentLookAhead);
} else {
checkConsistency((ILeafNode)node, currentLookAhead);
}
}
protected void checkConsistency(ICompositeNode node, AtomicInteger currentLookAhead) {
int nodeLookAhead = node.getLookAhead();
if (node.getGrammarElement() instanceof Action) {
ICompositeNode firstChild = (ICompositeNode) node.getFirstChild();
if (firstChild.getLookAhead() != nodeLookAhead) {
throw new InconsistentLookAheadException(
String.format("Action nodes must have the lookahead of their first child. Expected %d but was %d at offset %d (%s)", nodeLookAhead, firstChild.getLookAhead(), node.getTotalOffset(), node.getText()));
}
}
if (nodeLookAhead > currentLookAhead.get()) {
currentLookAhead.set(nodeLookAhead);
} else if (nodeLookAhead < currentLookAhead.get()) {
throw new InconsistentLookAheadException(
String.format("Expected at least %d but found %d at offset %d (%s)", currentLookAhead.get(), nodeLookAhead, node.getTotalOffset(), node.getText()));
}
}
protected void checkConsistency(ILeafNode node, AtomicInteger currentLookAhead) {
if (!node.isHidden()) {
currentLookAhead.updateAndGet(old->old > 0 ? old - 1 : old);
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2008-2020 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
@ -25,13 +25,34 @@ import org.antlr.runtime.TokenSource;
* A token stream that is aware of the current lookahead.
*
* @author Jan Köhnlein - Initial contribution and API
* @author Sebastian Zarnekow - Support for dynamic hidden tokens,
* reworked lookahead algorithm
* @author Sebastian Zarnekow - Support for dynamic hidden tokens, reworked lookahead algorithm
*/
public class XtextTokenStream extends CommonTokenStream {
/**
* The lookAhead marks a position relative to the current position
* in the token list. The lookahead is sensitive to hidden tokens
* e.g. a lookahead of 1 may point 10 tokens into the future if there are 9 hidden tokens before the next
* non-hidden token.
*/
private int currentLookAhead;
/** The maximum, absolute position p that was considered by the parser so far. */
private int indexOfLookAhead;
/**
* markerCount indicates the number of markers that are currently set on this stream.
* If it is greater than 0, the parser is predicting, otherwise it is consuming.
*/
private int markerCount = 0;
/**
* The position of the firts marker that was set, e.g. where the parser started its prediction.
* {@code -1} indicates that no marker is set right now.
*/
@Deprecated
private int firstMarker = -1;
private Map<String, Integer> rulenameToTokenType;
private BitSet hiddenTokens;
@ -168,38 +189,49 @@ public class XtextTokenStream extends CommonTokenStream {
}
/*
* (non-Javadoc)
*
* @see org.antlr.runtime.CommonTokenStream#LA(int)
*/
@Override
public int LA(int i) {
Token lookaheadToken = LT(i);
if (firstMarker != -1) {
int currentLookAheadIsRelativeTo = Math.min(firstMarker, p);
int totalLA = p + i - currentLookAheadIsRelativeTo;
currentLookAhead = Math.max(totalLA, currentLookAhead);
} else {
currentLookAhead = Math.max(i, currentLookAhead);
if (markerCount > 0) { // predicting with a marker
int laTokenIndex = getTokenIndex(lookaheadToken);
if (indexOfLookAhead < laTokenIndex) {
indexOfLookAhead = laTokenIndex;
currentLookAhead++;
}
} else if (i > currentLookAhead) {
currentLookAhead = i;
}
// return super.LA(i); // inlined
return lookaheadToken.getType();
}
private int firstMarker = -1;
/**
* @since 2.22
*/
protected int getTokenIndex(Token tok) {
if (tok == Token.EOF_TOKEN) {
return size();
}
return tok.getTokenIndex();
}
@Override
public void consume() {
if (firstMarker != -1) { // predicting
int currentLookAheadIsRelativeTo = Math.min(firstMarker, p);
currentLookAhead = Math.max(currentLookAhead, p - currentLookAheadIsRelativeTo);
super.consume();
if (markerCount > 0) { // predicting
basicConsume();
} else { // producing
super.consume();
basicConsume();
currentLookAhead--;
}
}
/**
* Make super-impl of {@link #consume()} accessible to subtypes.
*
* @since 2.22
*/
protected void basicConsume() {
super.consume();
}
/**
* @since 2.1
@ -210,19 +242,44 @@ public class XtextTokenStream extends CommonTokenStream {
@Override
public int mark() {
int result = super.mark();
if (firstMarker == -1)
int result = basicMark();
if (markerCount == 0) {
if (indexOfLookAhead < p) {
indexOfLookAhead = p;
}
firstMarker = result;
}
markerCount++;
return result;
}
@Override
public void seek(int index) {
if (index == firstMarker)
firstMarker = -1;
super.seek(index);
/**
* Make super-impl of {@link #mark()} accessible to subtypes.
*
* @since 2.22
*/
protected int basicMark() {
return super.mark();
}
@Override
public void rewind(int marker) {
markerCount--;
if (markerCount == 0) {
firstMarker = -1;
}
basicRewind(marker);
}
/**
* Make super-impl of {@link #rewind()} accessible to subtypes.
*
* @since 2.22
*/
protected void basicRewind(int marker) {
super.rewind(marker);
}
/**
* Same as {@link CommonTokenStream#LT(int)} except that we skip
* hidden tokens even for <code>k == 1<code>.