mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
Generated CommentAssociationTestLanguage
This commit is contained in:
parent
3fadeea82a
commit
c385e0e63b
18 changed files with 559 additions and 401 deletions
|
@ -17,11 +17,11 @@ import org.eclipse.emf.ecore.EObject;
|
|||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.parsetree.impl.crossContainment.Element#getContainer <em>Container</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.parsetree.impl.crossContainment.Element#getContainment <em>Containment</em>}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @see org.eclipse.xtext.parsetree.impl.crossContainment.CrossContainmentPackage#getElement()
|
||||
* @model
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CrossContainmentFactoryImpl extends EFactoryImpl implements CrossCo
|
|||
*/
|
||||
public static CrossContainmentFactory init() {
|
||||
try {
|
||||
CrossContainmentFactory theCrossContainmentFactory = (CrossContainmentFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/xtext/test/crossContainment");
|
||||
CrossContainmentFactory theCrossContainmentFactory = (CrossContainmentFactory)EPackage.Registry.INSTANCE.getEFactory(CrossContainmentPackage.eNS_URI);
|
||||
if (theCrossContainmentFactory != null) {
|
||||
return theCrossContainmentFactory;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ import org.eclipse.xtext.parsetree.impl.crossContainment.Element;
|
|||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.parsetree.impl.crossContainment.impl.ElementImpl#getContainer <em>Container</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.parsetree.impl.crossContainment.impl.ElementImpl#getContainment <em>Containment</em>}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
|||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.util.Switch;
|
||||
import org.eclipse.xtext.parsetree.impl.crossContainment.*;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +28,7 @@ import org.eclipse.xtext.parsetree.impl.crossContainment.*;
|
|||
* @see org.eclipse.xtext.parsetree.impl.crossContainment.CrossContainmentPackage
|
||||
* @generated
|
||||
*/
|
||||
public class CrossContainmentSwitch<T> {
|
||||
public class CrossContainmentSwitch<T> extends Switch<T> {
|
||||
/**
|
||||
* The cached model package
|
||||
* <!-- begin-user-doc -->
|
||||
|
@ -48,34 +50,16 @@ public class CrossContainmentSwitch<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
||||
* Checks whether this is a switch for the given package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
||||
* @param ePackage the package in question.
|
||||
* @return whether this is a switch for the given package.
|
||||
* @generated
|
||||
*/
|
||||
public T doSwitch(EObject theEObject) {
|
||||
return doSwitch(theEObject.eClass(), theEObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
||||
* @generated
|
||||
*/
|
||||
protected T doSwitch(EClass theEClass, EObject theEObject) {
|
||||
if (theEClass.eContainer() == modelPackage) {
|
||||
return doSwitch(theEClass.getClassifierID(), theEObject);
|
||||
}
|
||||
else {
|
||||
List<EClass> eSuperTypes = theEClass.getESuperTypes();
|
||||
return
|
||||
eSuperTypes.isEmpty() ?
|
||||
defaultCase(theEObject) :
|
||||
doSwitch(eSuperTypes.get(0), theEObject);
|
||||
}
|
||||
@Override
|
||||
protected boolean isSwitchFor(EPackage ePackage) {
|
||||
return ePackage == modelPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,6 +69,7 @@ public class CrossContainmentSwitch<T> {
|
|||
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected T doSwitch(int classifierID, EObject theEObject) {
|
||||
switch (classifierID) {
|
||||
case CrossContainmentPackage.ELEMENT: {
|
||||
|
@ -123,6 +108,7 @@ public class CrossContainmentSwitch<T> {
|
|||
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public T defaultCase(EObject object) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,18 +3,38 @@
|
|||
*/
|
||||
package org.eclipse.xtext.parsetree.impl;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.xtext.Constants;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.name.Names;
|
||||
import java.util.Properties;
|
||||
import org.eclipse.xtext.Constants;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.parser.IParser;
|
||||
import org.eclipse.xtext.parser.ITokenToStringConverter;
|
||||
import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider;
|
||||
import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter;
|
||||
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
|
||||
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
|
||||
import org.eclipse.xtext.parser.antlr.Lexer;
|
||||
import org.eclipse.xtext.parser.antlr.LexerBindings;
|
||||
import org.eclipse.xtext.parser.antlr.LexerProvider;
|
||||
import org.eclipse.xtext.parsetree.impl.parser.antlr.CommentAssociationTestLanguageAntlrTokenFileProvider;
|
||||
import org.eclipse.xtext.parsetree.impl.parser.antlr.CommentAssociationTestLanguageParser;
|
||||
import org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageLexer;
|
||||
import org.eclipse.xtext.parsetree.impl.serializer.CommentAssociationTestLanguageSemanticSequencer;
|
||||
import org.eclipse.xtext.parsetree.impl.serializer.CommentAssociationTestLanguageSyntacticSequencer;
|
||||
import org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.serializer.ISerializer;
|
||||
import org.eclipse.xtext.serializer.impl.Serializer;
|
||||
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
|
||||
import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer;
|
||||
import org.eclipse.xtext.service.DefaultRuntimeModule;
|
||||
|
||||
/**
|
||||
* Manual modifications go to {org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguageRuntimeModule}
|
||||
* Manual modifications go to {@link CommentAssociationTestLanguageRuntimeModule}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractCommentAssociationTestLanguageRuntimeModule extends org.eclipse.xtext.service.DefaultRuntimeModule {
|
||||
public abstract class AbstractCommentAssociationTestLanguageRuntimeModule extends DefaultRuntimeModule {
|
||||
|
||||
protected Properties properties = null;
|
||||
|
||||
|
@ -33,54 +53,66 @@ public abstract class AbstractCommentAssociationTestLanguageRuntimeModule extend
|
|||
binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("commentassociationtestlanguage");
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public Class<? extends org.eclipse.xtext.parser.IParser> bindIParser() {
|
||||
return org.eclipse.xtext.parsetree.impl.parser.antlr.CommentAssociationTestLanguageParser.class;
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IParser> bindIParser() {
|
||||
return CommentAssociationTestLanguageParser.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public Class<? extends org.eclipse.xtext.parser.ITokenToStringConverter> bindITokenToStringConverter() {
|
||||
return org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends ITokenToStringConverter> bindITokenToStringConverter() {
|
||||
return AntlrTokenToStringConverter.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public Class<? extends org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
|
||||
return org.eclipse.xtext.parsetree.impl.parser.antlr.CommentAssociationTestLanguageAntlrTokenFileProvider.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
|
||||
return CommentAssociationTestLanguageAntlrTokenFileProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public Class<? extends org.eclipse.xtext.parser.antlr.Lexer> bindLexer() {
|
||||
return org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageLexer.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends Lexer> bindLexer() {
|
||||
return InternalCommentAssociationTestLanguageLexer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public com.google.inject.Provider<org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageLexer> provideInternalCommentAssociationTestLanguageLexer() {
|
||||
return org.eclipse.xtext.parser.antlr.LexerProvider.create(org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageLexer.class);
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
|
||||
return AntlrTokenDefProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public void configureRuntimeLexer(com.google.inject.Binder binder) {
|
||||
binder.bind(org.eclipse.xtext.parser.antlr.Lexer.class).annotatedWith(com.google.inject.name.Names.named(org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME)).to(org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageLexer.class);
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Provider<InternalCommentAssociationTestLanguageLexer> provideInternalCommentAssociationTestLanguageLexer() {
|
||||
return LexerProvider.create(InternalCommentAssociationTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment
|
||||
public Class<? extends org.eclipse.xtext.parser.antlr.ITokenDefProvider> bindITokenDefProvider() {
|
||||
return org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public void configureRuntimeLexer(Binder binder) {
|
||||
binder.bind(Lexer.class)
|
||||
.annotatedWith(Names.named(LexerBindings.RUNTIME))
|
||||
.to(InternalCommentAssociationTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.grammarAccess.GrammarAccessFragment
|
||||
public java.lang.ClassLoader bindClassLoaderToInstance() {
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
|
||||
public ClassLoader bindClassLoaderToInstance() {
|
||||
return getClass().getClassLoader();
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.grammarAccess.GrammarAccessFragment
|
||||
public Class<? extends org.eclipse.xtext.IGrammarAccess> bindIGrammarAccess() {
|
||||
return org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageGrammarAccess.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
|
||||
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
|
||||
return CommentAssociationTestLanguageGrammarAccess.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.generator.parseTreeConstructor.ParseTreeConstructorFragment
|
||||
public Class<? extends org.eclipse.xtext.parsetree.reconstr.IParseTreeConstructor> bindIParseTreeConstructor() {
|
||||
return org.eclipse.xtext.parsetree.impl.parseTreeConstruction.CommentAssociationTestLanguageParsetreeConstructor.class;
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
|
||||
return CommentAssociationTestLanguageSemanticSequencer.class;
|
||||
}
|
||||
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
|
||||
return CommentAssociationTestLanguageSyntacticSequencer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISerializer> bindISerializer() {
|
||||
return Serializer.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
copyrightFields="false" editPluginID="org.eclipse.xtext.tests.edit" editorPluginID="org.eclipse.xtext.tests.editor"
|
||||
runtimeVersion="2.9" usedGenPackages="platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
|
||||
<genPackages prefix="CommentAssociation" basePackage="org.eclipse.xtext.parsetree.impl"
|
||||
disposableProviderFactory="true" ecorePackage="CommentAssociationTestLanguage.ecore#/">
|
||||
disposableProviderFactory="true" fileExtensions="commentassociationtestlanguage"
|
||||
ecorePackage="CommentAssociationTestLanguage.ecore#/">
|
||||
<genClasses ecoreClass="CommentAssociationTestLanguage.ecore#//Model">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference CommentAssociationTestLanguage.ecore#//Model/elements"/>
|
||||
</genClasses>
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
*/
|
||||
package org.eclipse.xtext.parsetree.impl;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.ISetup;
|
||||
import org.eclipse.xtext.common.TerminalsStandaloneSetup;
|
||||
import org.eclipse.xtext.parsetree.impl.commentAssociation.CommentAssociationPackage;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* Generated from StandaloneSetup.xpt!
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class CommentAssociationTestLanguageStandaloneSetupGenerated implements ISetup {
|
||||
|
||||
@Override
|
||||
public Injector createInjectorAndDoEMFRegistration() {
|
||||
org.eclipse.xtext.common.TerminalsStandaloneSetup.doSetup();
|
||||
TerminalsStandaloneSetup.doSetup();
|
||||
|
||||
Injector injector = createInjector();
|
||||
register(injector);
|
||||
|
@ -26,19 +26,17 @@ public class CommentAssociationTestLanguageStandaloneSetupGenerated implements I
|
|||
}
|
||||
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(new org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguageRuntimeModule());
|
||||
return Guice.createInjector(new CommentAssociationTestLanguageRuntimeModule());
|
||||
}
|
||||
|
||||
public void register(Injector injector) {
|
||||
|
||||
org.eclipse.xtext.resource.IResourceFactory resourceFactory = injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
|
||||
org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider = injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
|
||||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("commentassociationtestlanguage", resourceFactory);
|
||||
org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("commentassociationtestlanguage", serviceProvider);
|
||||
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
|
||||
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
|
||||
|
||||
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/tests/CommentAssociation")) {
|
||||
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/tests/CommentAssociation", org.eclipse.xtext.parsetree.impl.commentAssociation.CommentAssociationPackage.eINSTANCE);
|
||||
}
|
||||
|
||||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("commentassociationtestlanguage", resourceFactory);
|
||||
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("commentassociationtestlanguage", serviceProvider);
|
||||
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/tests/CommentAssociation")) {
|
||||
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/tests/CommentAssociation", CommentAssociationPackage.eINSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import java.io.InputStream;
|
|||
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
|
||||
|
||||
public class CommentAssociationTestLanguageAntlrTokenFileProvider implements IAntlrTokenFileProvider {
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream getAntlrTokenFile() {
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
return classLoader.getResourceAsStream("org/eclipse/xtext/parsetree/impl/parser/antlr/internal/InternalCommentAssociationTestLanguage.tokens");
|
||||
return classLoader.getResourceAsStream("org/eclipse/xtext/parsetree/impl/parser/antlr/internal/InternalCommentAssociationTestLanguage.tokens");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,36 +4,37 @@
|
|||
package org.eclipse.xtext.parsetree.impl.parser.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
import org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageParser;
|
||||
import org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageGrammarAccess;
|
||||
|
||||
public class CommentAssociationTestLanguageParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser {
|
||||
|
||||
public class CommentAssociationTestLanguageParser extends AbstractAntlrParser {
|
||||
|
||||
@Inject
|
||||
private CommentAssociationTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
|
||||
@Override
|
||||
protected void setInitialHiddenTokens(XtextTokenStream tokenStream) {
|
||||
tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageParser createParser(XtextTokenStream stream) {
|
||||
return new org.eclipse.xtext.parsetree.impl.parser.antlr.internal.InternalCommentAssociationTestLanguageParser(stream, getGrammarAccess());
|
||||
protected InternalCommentAssociationTestLanguageParser createParser(XtextTokenStream stream) {
|
||||
return new InternalCommentAssociationTestLanguageParser(stream, getGrammarAccess());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getDefaultRuleName() {
|
||||
return "Model";
|
||||
}
|
||||
|
||||
|
||||
public CommentAssociationTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return this.grammarAccess;
|
||||
}
|
||||
|
||||
|
||||
public void setGrammarAccess(CommentAssociationTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ grammar InternalCommentAssociationTestLanguage;
|
|||
|
||||
options {
|
||||
superClass=AbstractInternalAntlrParser;
|
||||
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
|
@ -17,7 +16,7 @@ import org.eclipse.xtext.parser.antlr.Lexer;
|
|||
}
|
||||
|
||||
@parser::header {
|
||||
package org.eclipse.xtext.parsetree.impl.parser.antlr.internal;
|
||||
package org.eclipse.xtext.parsetree.impl.parser.antlr.internal;
|
||||
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.parser.*;
|
||||
|
@ -35,144 +34,140 @@ import org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageG
|
|||
@parser::members {
|
||||
|
||||
private CommentAssociationTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
|
||||
public InternalCommentAssociationTestLanguageParser(TokenStream input, CommentAssociationTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "Model";
|
||||
return "Model";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected CommentAssociationTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@rulecatch {
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
@rulecatch {
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Entry rule entryRuleModel
|
||||
entryRuleModel returns [EObject current=null]
|
||||
:
|
||||
entryRuleModel returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getModelRule()); }
|
||||
iv_ruleModel=ruleModel
|
||||
{ $current=$iv_ruleModel.current; }
|
||||
EOF
|
||||
;
|
||||
iv_ruleModel=ruleModel
|
||||
{ $current=$iv_ruleModel.current; }
|
||||
EOF;
|
||||
|
||||
// Rule Model
|
||||
ruleModel returns [EObject current=null]
|
||||
@init { enterRule();
|
||||
}
|
||||
@after { leaveRule(); }:
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getModelAccess().getElementsElementParserRuleCall_0());
|
||||
}
|
||||
lv_elements_0_0=ruleElement {
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getModelRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"elements",
|
||||
lv_elements_0_0,
|
||||
"org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
|
||||
)
|
||||
)*
|
||||
ruleModel returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getModelAccess().getElementsElementParserRuleCall_0());
|
||||
}
|
||||
lv_elements_0_0=ruleElement
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getModelRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"elements",
|
||||
lv_elements_0_0,
|
||||
"org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Entry rule entryRuleElement
|
||||
entryRuleElement returns [EObject current=null]
|
||||
:
|
||||
entryRuleElement returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getElementRule()); }
|
||||
iv_ruleElement=ruleElement
|
||||
{ $current=$iv_ruleElement.current; }
|
||||
EOF
|
||||
;
|
||||
iv_ruleElement=ruleElement
|
||||
{ $current=$iv_ruleElement.current; }
|
||||
EOF;
|
||||
|
||||
// Rule Element
|
||||
ruleElement returns [EObject current=null]
|
||||
@init { enterRule();
|
||||
}
|
||||
@after { leaveRule(); }:
|
||||
( otherlv_0='element'
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
lv_name_1_0=RULE_ID
|
||||
ruleElement returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
otherlv_0='element'
|
||||
{
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
|
||||
)
|
||||
)((
|
||||
{
|
||||
$current = forceCreateModelElementAndSet(
|
||||
grammarAccess.getElementAccess().getElementChildAction_2_0(),
|
||||
$current);
|
||||
}
|
||||
) otherlv_3='parent'
|
||||
{
|
||||
newLeafNode(otherlv_3, grammarAccess.getElementAccess().getParentKeyword_2_1());
|
||||
}
|
||||
(
|
||||
(
|
||||
lv_name_4_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_4_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_2_2_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_4_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
|
||||
)
|
||||
))?)
|
||||
(
|
||||
(
|
||||
lv_name_1_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
{
|
||||
$current = forceCreateModelElementAndSet(
|
||||
grammarAccess.getElementAccess().getElementChildAction_2_0(),
|
||||
$current);
|
||||
}
|
||||
)
|
||||
otherlv_3='parent'
|
||||
{
|
||||
newLeafNode(otherlv_3, grammarAccess.getElementAccess().getParentKeyword_2_1());
|
||||
}
|
||||
(
|
||||
(
|
||||
lv_name_4_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_4_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_2_2_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_4_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
)
|
||||
)
|
||||
)?
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
|
||||
|
||||
RULE_INT : ('0'..'9')+;
|
||||
|
@ -186,5 +181,3 @@ RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
|
|||
RULE_WS : (' '|'\t'|'\r'|'\n')+;
|
||||
|
||||
RULE_ANY_OTHER : .;
|
||||
|
||||
|
||||
|
|
|
@ -83,10 +83,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:176:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalCommentAssociationTestLanguage.g:176:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalCommentAssociationTestLanguage.g:171:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalCommentAssociationTestLanguage.g:171:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:176:11: ( '^' )?
|
||||
// InternalCommentAssociationTestLanguage.g:171:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:176:11: '^'
|
||||
// InternalCommentAssociationTestLanguage.g:171:11: '^'
|
||||
{
|
||||
match('^');
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:176:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalCommentAssociationTestLanguage.g:171:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
|
@ -162,10 +162,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_INT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:178:10: ( ( '0' .. '9' )+ )
|
||||
// InternalCommentAssociationTestLanguage.g:178:12: ( '0' .. '9' )+
|
||||
// InternalCommentAssociationTestLanguage.g:173:10: ( ( '0' .. '9' )+ )
|
||||
// InternalCommentAssociationTestLanguage.g:173:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:178:12: ( '0' .. '9' )+
|
||||
// InternalCommentAssociationTestLanguage.g:173:12: ( '0' .. '9' )+
|
||||
int cnt3=0;
|
||||
loop3:
|
||||
do {
|
||||
|
@ -179,7 +179,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:178:13: '0' .. '9'
|
||||
// InternalCommentAssociationTestLanguage.g:173:13: '0' .. '9'
|
||||
{
|
||||
matchRange('0','9');
|
||||
|
||||
|
@ -211,10 +211,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_STRING;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:180:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalCommentAssociationTestLanguage.g:180:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalCommentAssociationTestLanguage.g:175:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalCommentAssociationTestLanguage.g:175:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:180:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalCommentAssociationTestLanguage.g:175:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
int alt6=2;
|
||||
int LA6_0 = input.LA(1);
|
||||
|
||||
|
@ -232,10 +232,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt6) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
// InternalCommentAssociationTestLanguage.g:175:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalCommentAssociationTestLanguage.g:180:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
// InternalCommentAssociationTestLanguage.g:175:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=3;
|
||||
|
@ -251,7 +251,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:21: '\\\\' .
|
||||
// InternalCommentAssociationTestLanguage.g:175:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -259,7 +259,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
// InternalCommentAssociationTestLanguage.g:175:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -284,10 +284,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
// InternalCommentAssociationTestLanguage.g:175:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalCommentAssociationTestLanguage.g:180:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
// InternalCommentAssociationTestLanguage.g:175:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
loop5:
|
||||
do {
|
||||
int alt5=3;
|
||||
|
@ -303,7 +303,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt5) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:54: '\\\\' .
|
||||
// InternalCommentAssociationTestLanguage.g:175:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -311,7 +311,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalCommentAssociationTestLanguage.g:180:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
// InternalCommentAssociationTestLanguage.g:175:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -354,12 +354,12 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ML_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:182:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalCommentAssociationTestLanguage.g:182:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
// InternalCommentAssociationTestLanguage.g:177:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalCommentAssociationTestLanguage.g:177:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:182:24: ( options {greedy=false; } : . )*
|
||||
// InternalCommentAssociationTestLanguage.g:177:24: ( options {greedy=false; } : . )*
|
||||
loop7:
|
||||
do {
|
||||
int alt7=2;
|
||||
|
@ -384,7 +384,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt7) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:182:52: .
|
||||
// InternalCommentAssociationTestLanguage.g:177:52: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
@ -414,12 +414,12 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_SL_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:184:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalCommentAssociationTestLanguage.g:184:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
// InternalCommentAssociationTestLanguage.g:179:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalCommentAssociationTestLanguage.g:179:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:184:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
// InternalCommentAssociationTestLanguage.g:179:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
loop8:
|
||||
do {
|
||||
int alt8=2;
|
||||
|
@ -432,7 +432,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt8) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:184:24: ~ ( ( '\\n' | '\\r' ) )
|
||||
// InternalCommentAssociationTestLanguage.g:179: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();
|
||||
|
@ -452,7 +452,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
} while (true);
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:184:40: ( ( '\\r' )? '\\n' )?
|
||||
// InternalCommentAssociationTestLanguage.g:179:40: ( ( '\\r' )? '\\n' )?
|
||||
int alt10=2;
|
||||
int LA10_0 = input.LA(1);
|
||||
|
||||
|
@ -461,9 +461,9 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt10) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:184:41: ( '\\r' )? '\\n'
|
||||
// InternalCommentAssociationTestLanguage.g:179:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:184:41: ( '\\r' )?
|
||||
// InternalCommentAssociationTestLanguage.g:179:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
|
@ -472,7 +472,7 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:184:41: '\\r'
|
||||
// InternalCommentAssociationTestLanguage.g:179:41: '\\r'
|
||||
{
|
||||
match('\r');
|
||||
|
||||
|
@ -504,10 +504,10 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_WS;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:186:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalCommentAssociationTestLanguage.g:186:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalCommentAssociationTestLanguage.g:181:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalCommentAssociationTestLanguage.g:181:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:186:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalCommentAssociationTestLanguage.g:181:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
int cnt11=0;
|
||||
loop11:
|
||||
do {
|
||||
|
@ -561,8 +561,8 @@ public class InternalCommentAssociationTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ANY_OTHER;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalCommentAssociationTestLanguage.g:188:16: ( . )
|
||||
// InternalCommentAssociationTestLanguage.g:188:18: .
|
||||
// InternalCommentAssociationTestLanguage.g:183:16: ( . )
|
||||
// InternalCommentAssociationTestLanguage.g:183:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.eclipse.xtext.parsetree.impl.parser.antlr.internal;
|
||||
package org.eclipse.xtext.parsetree.impl.parser.antlr.internal;
|
||||
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.parser.*;
|
||||
|
@ -53,18 +53,18 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
private CommentAssociationTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
|
||||
public InternalCommentAssociationTestLanguageParser(TokenStream input, CommentAssociationTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "Model";
|
||||
return "Model";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected CommentAssociationTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
|
@ -72,8 +72,9 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleModel"
|
||||
// InternalCommentAssociationTestLanguage.g:67:1: entryRuleModel returns [EObject current=null] : iv_ruleModel= ruleModel EOF ;
|
||||
// InternalCommentAssociationTestLanguage.g:64:1: entryRuleModel returns [EObject current=null] : iv_ruleModel= ruleModel EOF ;
|
||||
public final EObject entryRuleModel() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
|
@ -81,8 +82,8 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
try {
|
||||
// InternalCommentAssociationTestLanguage.g:68:2: (iv_ruleModel= ruleModel EOF )
|
||||
// InternalCommentAssociationTestLanguage.g:69:2: iv_ruleModel= ruleModel EOF
|
||||
// InternalCommentAssociationTestLanguage.g:64:46: (iv_ruleModel= ruleModel EOF )
|
||||
// InternalCommentAssociationTestLanguage.g:65:2: iv_ruleModel= ruleModel EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getModelRule());
|
||||
pushFollow(FollowSets000.FOLLOW_1);
|
||||
|
@ -96,11 +97,11 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
|
@ -109,20 +110,21 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
// $ANTLR start "ruleModel"
|
||||
// InternalCommentAssociationTestLanguage.g:76:1: ruleModel returns [EObject current=null] : ( (lv_elements_0_0= ruleElement ) )* ;
|
||||
// InternalCommentAssociationTestLanguage.g:71:1: ruleModel returns [EObject current=null] : ( (lv_elements_0_0= ruleElement ) )* ;
|
||||
public final EObject ruleModel() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject lv_elements_0_0 = null;
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalCommentAssociationTestLanguage.g:79:28: ( ( (lv_elements_0_0= ruleElement ) )* )
|
||||
// InternalCommentAssociationTestLanguage.g:80:1: ( (lv_elements_0_0= ruleElement ) )*
|
||||
// InternalCommentAssociationTestLanguage.g:77:2: ( ( (lv_elements_0_0= ruleElement ) )* )
|
||||
// InternalCommentAssociationTestLanguage.g:78:2: ( (lv_elements_0_0= ruleElement ) )*
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:80:1: ( (lv_elements_0_0= ruleElement ) )*
|
||||
// InternalCommentAssociationTestLanguage.g:78:2: ( (lv_elements_0_0= ruleElement ) )*
|
||||
loop1:
|
||||
do {
|
||||
int alt1=2;
|
||||
|
@ -135,30 +137,30 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:81:1: (lv_elements_0_0= ruleElement )
|
||||
// InternalCommentAssociationTestLanguage.g:79:3: (lv_elements_0_0= ruleElement )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:81:1: (lv_elements_0_0= ruleElement )
|
||||
// InternalCommentAssociationTestLanguage.g:82:3: lv_elements_0_0= ruleElement
|
||||
// InternalCommentAssociationTestLanguage.g:79:3: (lv_elements_0_0= ruleElement )
|
||||
// InternalCommentAssociationTestLanguage.g:80:4: lv_elements_0_0= ruleElement
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getModelAccess().getElementsElementParserRuleCall_0());
|
||||
|
||||
|
||||
newCompositeNode(grammarAccess.getModelAccess().getElementsElementParserRuleCall_0());
|
||||
|
||||
pushFollow(FollowSets000.FOLLOW_3);
|
||||
lv_elements_0_0=ruleElement();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getModelRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"elements",
|
||||
lv_elements_0_0,
|
||||
"org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getModelRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"elements",
|
||||
lv_elements_0_0,
|
||||
"org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -174,13 +176,15 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
}
|
||||
|
||||
leaveRule();
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
|
@ -189,7 +193,7 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
// $ANTLR start "entryRuleElement"
|
||||
// InternalCommentAssociationTestLanguage.g:106:1: entryRuleElement returns [EObject current=null] : iv_ruleElement= ruleElement EOF ;
|
||||
// InternalCommentAssociationTestLanguage.g:100:1: entryRuleElement returns [EObject current=null] : iv_ruleElement= ruleElement EOF ;
|
||||
public final EObject entryRuleElement() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
|
@ -197,8 +201,8 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
try {
|
||||
// InternalCommentAssociationTestLanguage.g:107:2: (iv_ruleElement= ruleElement EOF )
|
||||
// InternalCommentAssociationTestLanguage.g:108:2: iv_ruleElement= ruleElement EOF
|
||||
// InternalCommentAssociationTestLanguage.g:100:48: (iv_ruleElement= ruleElement EOF )
|
||||
// InternalCommentAssociationTestLanguage.g:101:2: iv_ruleElement= ruleElement EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getElementRule());
|
||||
pushFollow(FollowSets000.FOLLOW_1);
|
||||
|
@ -212,11 +216,11 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
|
@ -225,7 +229,7 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
|
||||
// $ANTLR start "ruleElement"
|
||||
// InternalCommentAssociationTestLanguage.g:115:1: ruleElement returns [EObject current=null] : (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? ) ;
|
||||
// InternalCommentAssociationTestLanguage.g:107:1: ruleElement returns [EObject current=null] : (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? ) ;
|
||||
public final EObject ruleElement() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
|
@ -234,46 +238,47 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
Token otherlv_3=null;
|
||||
Token lv_name_4_0=null;
|
||||
|
||||
enterRule();
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalCommentAssociationTestLanguage.g:118:28: ( (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? ) )
|
||||
// InternalCommentAssociationTestLanguage.g:119:1: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? )
|
||||
// InternalCommentAssociationTestLanguage.g:113:2: ( (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? ) )
|
||||
// InternalCommentAssociationTestLanguage.g:114:2: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:119:1: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? )
|
||||
// InternalCommentAssociationTestLanguage.g:119:3: otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )?
|
||||
// InternalCommentAssociationTestLanguage.g:114:2: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )? )
|
||||
// InternalCommentAssociationTestLanguage.g:115:3: otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )?
|
||||
{
|
||||
otherlv_0=(Token)match(input,11,FollowSets000.FOLLOW_4);
|
||||
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:123:1: ( (lv_name_1_0= RULE_ID ) )
|
||||
// InternalCommentAssociationTestLanguage.g:124:1: (lv_name_1_0= RULE_ID )
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:119:3: ( (lv_name_1_0= RULE_ID ) )
|
||||
// InternalCommentAssociationTestLanguage.g:120:4: (lv_name_1_0= RULE_ID )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:124:1: (lv_name_1_0= RULE_ID )
|
||||
// InternalCommentAssociationTestLanguage.g:125:3: lv_name_1_0= RULE_ID
|
||||
// InternalCommentAssociationTestLanguage.g:120:4: (lv_name_1_0= RULE_ID )
|
||||
// InternalCommentAssociationTestLanguage.g:121:5: lv_name_1_0= RULE_ID
|
||||
{
|
||||
lv_name_1_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_5);
|
||||
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:141:2: ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )?
|
||||
// InternalCommentAssociationTestLanguage.g:137:3: ( () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) ) )?
|
||||
int alt2=2;
|
||||
int LA2_0 = input.LA(1);
|
||||
|
||||
|
@ -282,43 +287,43 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
}
|
||||
switch (alt2) {
|
||||
case 1 :
|
||||
// InternalCommentAssociationTestLanguage.g:141:3: () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) )
|
||||
// InternalCommentAssociationTestLanguage.g:138:4: () otherlv_3= 'parent' ( (lv_name_4_0= RULE_ID ) )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:141:3: ()
|
||||
// InternalCommentAssociationTestLanguage.g:142:5:
|
||||
// InternalCommentAssociationTestLanguage.g:138:4: ()
|
||||
// InternalCommentAssociationTestLanguage.g:139:5:
|
||||
{
|
||||
|
||||
current = forceCreateModelElementAndSet(
|
||||
grammarAccess.getElementAccess().getElementChildAction_2_0(),
|
||||
current);
|
||||
|
||||
current = forceCreateModelElementAndSet(
|
||||
grammarAccess.getElementAccess().getElementChildAction_2_0(),
|
||||
current);
|
||||
|
||||
|
||||
}
|
||||
|
||||
otherlv_3=(Token)match(input,12,FollowSets000.FOLLOW_4);
|
||||
|
||||
newLeafNode(otherlv_3, grammarAccess.getElementAccess().getParentKeyword_2_1());
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:151:1: ( (lv_name_4_0= RULE_ID ) )
|
||||
// InternalCommentAssociationTestLanguage.g:152:1: (lv_name_4_0= RULE_ID )
|
||||
newLeafNode(otherlv_3, grammarAccess.getElementAccess().getParentKeyword_2_1());
|
||||
|
||||
// InternalCommentAssociationTestLanguage.g:149:4: ( (lv_name_4_0= RULE_ID ) )
|
||||
// InternalCommentAssociationTestLanguage.g:150:5: (lv_name_4_0= RULE_ID )
|
||||
{
|
||||
// InternalCommentAssociationTestLanguage.g:152:1: (lv_name_4_0= RULE_ID )
|
||||
// InternalCommentAssociationTestLanguage.g:153:3: lv_name_4_0= RULE_ID
|
||||
// InternalCommentAssociationTestLanguage.g:150:5: (lv_name_4_0= RULE_ID )
|
||||
// InternalCommentAssociationTestLanguage.g:151:6: lv_name_4_0= RULE_ID
|
||||
{
|
||||
lv_name_4_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_2);
|
||||
|
||||
newLeafNode(lv_name_4_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_2_2_0());
|
||||
|
||||
newLeafNode(lv_name_4_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_2_2_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_4_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_4_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -337,13 +342,15 @@ public class InternalCommentAssociationTestLanguageParser extends AbstractIntern
|
|||
|
||||
}
|
||||
|
||||
leaveRule();
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.parsetree.impl.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Set;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.Action;
|
||||
import org.eclipse.xtext.Parameter;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.parsetree.impl.commentAssociation.CommentAssociationPackage;
|
||||
import org.eclipse.xtext.parsetree.impl.commentAssociation.Element;
|
||||
import org.eclipse.xtext.parsetree.impl.commentAssociation.Model;
|
||||
import org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.serializer.ISerializationContext;
|
||||
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
|
||||
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
|
||||
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class CommentAssociationTestLanguageSemanticSequencer extends AbstractDelegatingSemanticSequencer {
|
||||
|
||||
@Inject
|
||||
private CommentAssociationTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Override
|
||||
public void sequence(ISerializationContext context, EObject semanticObject) {
|
||||
EPackage epackage = semanticObject.eClass().getEPackage();
|
||||
ParserRule rule = context.getParserRule();
|
||||
Action action = context.getAssignedAction();
|
||||
Set<Parameter> parameters = context.getEnabledBooleanParameters();
|
||||
if (epackage == CommentAssociationPackage.eINSTANCE)
|
||||
switch (semanticObject.eClass().getClassifierID()) {
|
||||
case CommentAssociationPackage.ELEMENT:
|
||||
if (rule == grammarAccess.getElementRule()) {
|
||||
sequence_Element(context, (Element) semanticObject);
|
||||
return;
|
||||
}
|
||||
else if (action == grammarAccess.getElementAccess().getElementChildAction_2_0()) {
|
||||
sequence_Element_Element_2_0(context, (Element) semanticObject);
|
||||
return;
|
||||
}
|
||||
else break;
|
||||
case CommentAssociationPackage.MODEL:
|
||||
sequence_Model(context, (Model) semanticObject);
|
||||
return;
|
||||
}
|
||||
if (errorAcceptor != null)
|
||||
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Element returns Element
|
||||
*
|
||||
* Constraint:
|
||||
* (name=ID | (child=Element_Element_2_0 name=ID))
|
||||
*/
|
||||
protected void sequence_Element(ISerializationContext context, Element semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Element.Element_2_0 returns Element
|
||||
*
|
||||
* Constraint:
|
||||
* name=ID
|
||||
*/
|
||||
protected void sequence_Element_Element_2_0(ISerializationContext context, Element semanticObject) {
|
||||
if (errorAcceptor != null) {
|
||||
if (transientValues.isValueTransient(semanticObject, CommentAssociationPackage.Literals.ELEMENT__NAME) == ValueTransient.YES)
|
||||
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, CommentAssociationPackage.Literals.ELEMENT__NAME));
|
||||
}
|
||||
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
||||
feeder.accept(grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
|
||||
feeder.finish();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Model returns Model
|
||||
*
|
||||
* Constraint:
|
||||
* elements+=Element+
|
||||
*/
|
||||
protected void sequence_Model(ISerializationContext context, Model semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.parsetree.impl.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.parsetree.impl.services.CommentAssociationTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
|
||||
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
|
||||
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class CommentAssociationTestLanguageSyntacticSequencer extends AbstractSyntacticSequencer {
|
||||
|
||||
protected CommentAssociationTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Inject
|
||||
protected void init(IGrammarAccess access) {
|
||||
grammarAccess = (CommentAssociationTestLanguageGrammarAccess) access;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
|
||||
if (transition.getAmbiguousSyntaxes().isEmpty()) return;
|
||||
List<INode> transitionNodes = collectNodes(fromNode, toNode);
|
||||
for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
|
||||
List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
|
||||
acceptNodes(getLastNavigableState(), syntaxNodes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,21 +3,25 @@
|
|||
*/
|
||||
package org.eclipse.xtext.parsetree.impl.services;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.service.GrammarProvider;
|
||||
import org.eclipse.xtext.service.AbstractElementFinder.*;
|
||||
|
||||
import org.eclipse.xtext.Action;
|
||||
import org.eclipse.xtext.Assignment;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.Group;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.common.services.TerminalsGrammarAccess;
|
||||
import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder;
|
||||
import org.eclipse.xtext.service.GrammarProvider;
|
||||
|
||||
@Singleton
|
||||
public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
||||
|
||||
|
||||
public class ModelElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Model");
|
||||
private final Assignment cElementsAssignment = (Assignment)rule.eContents().get(1);
|
||||
|
@ -26,14 +30,13 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
//Model:
|
||||
// elements+=Element*;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
|
||||
//elements+=Element*
|
||||
public Assignment getElementsAssignment() { return cElementsAssignment; }
|
||||
|
||||
|
||||
//Element
|
||||
public RuleCall getElementsElementParserRuleCall_0() { return cElementsElementParserRuleCall_0; }
|
||||
}
|
||||
|
||||
public class ElementElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.impl.CommentAssociationTestLanguage.Element");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
|
@ -49,31 +52,31 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
//Element:
|
||||
// 'element' name=ID ({Element.child=current} 'parent' name=ID)?;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
|
||||
//'element' name=ID ({Element.child=current} 'parent' name=ID)?
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
|
||||
//'element'
|
||||
public Keyword getElementKeyword_0() { return cElementKeyword_0; }
|
||||
|
||||
|
||||
//name=ID
|
||||
public Assignment getNameAssignment_1() { return cNameAssignment_1; }
|
||||
|
||||
|
||||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
|
||||
|
||||
|
||||
//({Element.child=current} 'parent' name=ID)?
|
||||
public Group getGroup_2() { return cGroup_2; }
|
||||
|
||||
|
||||
//{Element.child=current}
|
||||
public Action getElementChildAction_2_0() { return cElementChildAction_2_0; }
|
||||
|
||||
|
||||
//'parent'
|
||||
public Keyword getParentKeyword_2_1() { return cParentKeyword_2_1; }
|
||||
|
||||
|
||||
//name=ID
|
||||
public Assignment getNameAssignment_2_2() { return cNameAssignment_2_2; }
|
||||
|
||||
|
||||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_2_2_0() { return cNameIDTerminalRuleCall_2_2_0; }
|
||||
}
|
||||
|
@ -83,12 +86,12 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
private final ElementElements pElement;
|
||||
|
||||
private final Grammar grammar;
|
||||
|
||||
|
||||
private final TerminalsGrammarAccess gaTerminals;
|
||||
|
||||
@Inject
|
||||
public CommentAssociationTestLanguageGrammarAccess(GrammarProvider grammarProvider,
|
||||
TerminalsGrammarAccess gaTerminals) {
|
||||
TerminalsGrammarAccess gaTerminals) {
|
||||
this.grammar = internalFindGrammar(grammarProvider);
|
||||
this.gaTerminals = gaTerminals;
|
||||
this.pModel = new ModelElements();
|
||||
|
@ -116,7 +119,7 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
return grammar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public TerminalsGrammarAccess getTerminalsGrammarAccess() {
|
||||
return gaTerminals;
|
||||
}
|
||||
|
@ -131,7 +134,7 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
public ParserRule getModelRule() {
|
||||
return getModelAccess().getRule();
|
||||
}
|
||||
|
||||
|
||||
//Element:
|
||||
// 'element' name=ID ({Element.child=current} 'parent' name=ID)?;
|
||||
public ElementElements getElementAccess() {
|
||||
|
@ -141,47 +144,47 @@ public class CommentAssociationTestLanguageGrammarAccess extends AbstractGrammar
|
|||
public ParserRule getElementRule() {
|
||||
return getElementAccess().getRule();
|
||||
}
|
||||
|
||||
|
||||
//terminal ID:
|
||||
// '^'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*;
|
||||
public TerminalRule getIDRule() {
|
||||
return gaTerminals.getIDRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal INT returns ecore::EInt:
|
||||
// '0'..'9'+;
|
||||
public TerminalRule getINTRule() {
|
||||
return gaTerminals.getINTRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal STRING:
|
||||
// '"' ('\\' . | !('\\' | '"'))* '"' |
|
||||
// "'" ('\\' . | !('\\' | "'"))* "'";
|
||||
public TerminalRule getSTRINGRule() {
|
||||
return gaTerminals.getSTRINGRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal ML_COMMENT:
|
||||
// '/ *'->'* /';
|
||||
public TerminalRule getML_COMMENTRule() {
|
||||
return gaTerminals.getML_COMMENTRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal SL_COMMENT:
|
||||
// '//' !('\n' | '\r')* ('\r'? '\n')?;
|
||||
public TerminalRule getSL_COMMENTRule() {
|
||||
return gaTerminals.getSL_COMMENTRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal WS:
|
||||
// ' ' | '\t' | '\r' | '\n'+;
|
||||
public TerminalRule getWSRule() {
|
||||
return gaTerminals.getWSRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//terminal ANY_OTHER:
|
||||
// .;
|
||||
public TerminalRule getANY_OTHERRule() {
|
||||
return gaTerminals.getANY_OTHERRule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.xtext.xtext.generator.*
|
|||
var projectName = "org.eclipse.xtext.tests"
|
||||
var runtimeProject = "../${projectName}"
|
||||
var lineDelimiter = '\n'
|
||||
var srcGenOnly = true
|
||||
|
||||
Workflow {
|
||||
bean = StandaloneSetup {
|
||||
|
|
|
@ -20,11 +20,11 @@ import org.eclipse.xtext.parsetree.impl.commentAssociation.CommentAssociationFac
|
|||
import org.eclipse.xtext.parsetree.impl.commentAssociation.Element;
|
||||
import org.eclipse.xtext.parsetree.impl.commentAssociation.Model;
|
||||
import org.eclipse.xtext.parsetree.reconstr.ICommentAssociater;
|
||||
import org.eclipse.xtext.parsetree.reconstr.Serializer;
|
||||
import org.eclipse.xtext.resource.SaveOptions;
|
||||
import org.eclipse.xtext.serializer.ISerializer;
|
||||
import org.eclipse.xtext.tests.AbstractXtextTests;
|
||||
import org.eclipse.xtext.util.ReplaceRegion;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
|
@ -33,7 +33,6 @@ import com.google.common.collect.Multimap;
|
|||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CommentAssociationTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
|
@ -102,6 +101,8 @@ public class CommentAssociationTest extends AbstractXtextTests {
|
|||
checkComments(multimap, z, "// comment pre z\n");
|
||||
}
|
||||
|
||||
// TODO https://github.com/eclipse/xtext-core/issues/32
|
||||
@Ignore
|
||||
@Test public void testSerializeReplacement() throws Exception {
|
||||
String xBlock =
|
||||
"// comment pre x\n" +
|
||||
|
@ -131,7 +132,7 @@ public class CommentAssociationTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
protected void checkReplaceRegion(Element element, String expectedText, String completeModel) {
|
||||
Serializer serializer = get(Serializer.class);
|
||||
ISerializer serializer = get(ISerializer.class);
|
||||
ReplaceRegion replacement = serializer.serializeReplacement(element, SaveOptions.defaultOptions());
|
||||
assertEquals(expectedText, replacement.getText());
|
||||
assertEquals(completeModel.indexOf(expectedText), replacement.getOffset());
|
||||
|
@ -146,6 +147,8 @@ public class CommentAssociationTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO https://github.com/eclipse/xtext-core/issues/32
|
||||
@Ignore
|
||||
@Test public void testCommentsAtEndOfFile() throws Exception {
|
||||
// the text-model without a trailing LB does not work
|
||||
// since the serializer does not know something about the terminal rules
|
||||
|
@ -169,9 +172,5 @@ public class CommentAssociationTest extends AbstractXtextTests {
|
|||
return "element x // comment post x\n parent y element z";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ISerializer getSerializer() {
|
||||
return get(Serializer.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ Workflow {
|
|||
}
|
||||
}
|
||||
|
||||
// language = { XXX
|
||||
// grammarUri = "classpath:/org/eclipse/xtext/parsetree/impl/CommentAssociationTestLanguage.xtext"
|
||||
// fragment = @org.eclipse.xtext.TestLanguagesFragmentsParseTreeConstructor {}
|
||||
// }
|
||||
language = {
|
||||
grammarUri = "classpath:/org/eclipse/xtext/parsetree/impl/CommentAssociationTestLanguage.xtext"
|
||||
fragment = @org.eclipse.xtext.TestLanguagesFragments {}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue