mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
Merge pull request #72 from eclipse/me_xtextresource
introduce XtextResource#setEntryPoint(ParserRule)
This commit is contained in:
commit
79118e564d
82 changed files with 8858 additions and 226 deletions
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="partialContentAssistTestLanguage" nsURI="http://www.eclipse.org/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage"
|
||||
nsPrefix="partialContentAssistTestLanguage">
|
||||
<eClassifiers xsi:type="ecore:EClass" name="TypeDeclaration">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="superType" eType="#//TypeDeclaration"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="properties" upperBound="-1"
|
||||
eType="#//Property" containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Property">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
</eClassifiers>
|
||||
</ecore:EPackage>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
|
||||
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html"
|
||||
modelDirectory="/org.eclipse.xtext.ide.tests/testlang-src-gen" modelPluginID="org.eclipse.xtext.ide.tests"
|
||||
forceOverwrite="true" modelName="PartialContentAssistTestLanguage" updateClasspath="false"
|
||||
rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" complianceLevel="6.0"
|
||||
copyrightFields="false" runtimeVersion="2.11">
|
||||
<genPackages prefix="PartialContentAssistTestLanguage" basePackage="org.eclipse.xtext.ide.tests.testlanguage"
|
||||
disposableProviderFactory="true" fileExtensions="partialcontentassisttestlang"
|
||||
ecorePackage="PartialContentAssistTestLanguage.ecore#/">
|
||||
<genClasses ecoreClass="PartialContentAssistTestLanguage.ecore#//TypeDeclaration">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute PartialContentAssistTestLanguage.ecore#//TypeDeclaration/name"/>
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference PartialContentAssistTestLanguage.ecore#//TypeDeclaration/superType"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference PartialContentAssistTestLanguage.ecore#//TypeDeclaration/properties"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="PartialContentAssistTestLanguage.ecore#//Property">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute PartialContentAssistTestLanguage.ecore#//Property/type"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute PartialContentAssistTestLanguage.ecore#//Property/name"/>
|
||||
</genClasses>
|
||||
</genPackages>
|
||||
</genmodel:GenModel>
|
|
@ -0,0 +1,122 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist
|
||||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageIdeInjectorProvider
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess
|
||||
import org.eclipse.xtext.testing.InjectWith
|
||||
import org.eclipse.xtext.testing.XtextRunner
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import static extension org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner)
|
||||
@InjectWith(TestLanguageIdeInjectorProvider)
|
||||
class ContentAssistContextFactoryTest {
|
||||
|
||||
@Inject extension ContentAssistContextTestHelper
|
||||
@Inject ContentAssistContextFactory factory
|
||||
@Inject TestLanguageGrammarAccess grammar
|
||||
|
||||
@Test def void testSimple1() {
|
||||
document = '''
|
||||
type Foo <|>{
|
||||
int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Keyword: TypeDeclaration:'extends'
|
||||
Keyword: TypeDeclaration:'{'
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testSimple2() {
|
||||
document = '''
|
||||
type Foo {
|
||||
<|>int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: TypeDeclaration:properties+= *
|
||||
RuleCall: TypeDeclaration:properties+=Property
|
||||
Assignment: Property:type=
|
||||
RuleCall: Property:type=Type
|
||||
RuleCall: Type:TypeReference
|
||||
Assignment: TypeReference:typeRef=
|
||||
RuleCall: Type:PrimitiveType
|
||||
Assignment: PrimitiveType:name=
|
||||
Keyword: PrimitiveType:name='string'
|
||||
Keyword: PrimitiveType:name='int'
|
||||
Keyword: PrimitiveType:name='boolean'
|
||||
Keyword: TypeDeclaration:'}'
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testBeginning() {
|
||||
document = '''
|
||||
<|>type Foo {
|
||||
int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Model:types+= *
|
||||
RuleCall: Model:types+=TypeDeclaration
|
||||
Keyword: TypeDeclaration:'type'
|
||||
RuleCall: <AbstractElement not contained in AbstractRule!>:Model
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testCustomEntryPoint() {
|
||||
entryPoint = grammar.propertyRule
|
||||
document = '''
|
||||
int <|>bar
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Type:arrayDiemensions+=
|
||||
Keyword: Type:arrayDiemensions+='['
|
||||
Assignment: Property:name=
|
||||
RuleCall: Property:name=ID
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testCustomEntryPointBeginning() {
|
||||
entryPoint = grammar.propertyRule
|
||||
document = '''
|
||||
<|>int bar
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Property:type=
|
||||
RuleCall: Property:type=Type
|
||||
RuleCall: Type:TypeReference
|
||||
Assignment: TypeReference:typeRef=
|
||||
RuleCall: Type:PrimitiveType
|
||||
Assignment: PrimitiveType:name=
|
||||
Keyword: PrimitiveType:name='string'
|
||||
Keyword: PrimitiveType:name='int'
|
||||
Keyword: PrimitiveType:name='boolean'
|
||||
RuleCall: <AbstractElement not contained in AbstractRule!>:Type
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist
|
||||
|
||||
import com.google.common.base.Preconditions
|
||||
import com.google.inject.Inject
|
||||
import java.util.concurrent.Executors
|
||||
import org.eclipse.emf.common.util.URI
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.ParserRule
|
||||
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory
|
||||
import org.eclipse.xtext.resource.FileExtensionProvider
|
||||
import org.eclipse.xtext.resource.IResourceFactory
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
import org.eclipse.xtext.resource.XtextResourceSet
|
||||
import org.eclipse.xtext.testing.validation.ValidationTestHelper
|
||||
import org.eclipse.xtext.util.StringInputStream
|
||||
import org.eclipse.xtext.util.TextRegion
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
class ContentAssistContextTestHelper {
|
||||
@Inject FileExtensionProvider fileExtension
|
||||
@Inject IResourceFactory resFactory
|
||||
@Inject ValidationTestHelper validator
|
||||
|
||||
@Accessors String document
|
||||
@Accessors ParserRule entryPoint
|
||||
@Accessors String cursor = "<|>"
|
||||
|
||||
def private XtextResource parse(String doc) {
|
||||
val uri = URI.createURI("dummy." + fileExtension.primaryFileExtension)
|
||||
val res = resFactory.createResource(uri) as XtextResource
|
||||
new XtextResourceSet().resources += res
|
||||
if (entryPoint !== null) {
|
||||
res.entryPoint = entryPoint
|
||||
}
|
||||
res.load(new StringInputStream(doc), emptyMap)
|
||||
validator.assertNoErrors(res)
|
||||
return res
|
||||
}
|
||||
|
||||
def String firstSetGrammarElementsToString(ContentAssistContextFactory factory) {
|
||||
val offset = document.indexOf(cursor)
|
||||
Preconditions.checkArgument(offset >= 0, "you forgot to provide a cursor")
|
||||
val doc = document.replace(cursor, "")
|
||||
val res = parse(doc)
|
||||
factory.pool = Executors.newCachedThreadPool
|
||||
val ctxs = factory.create(doc, new TextRegion(0, 0), offset, res)
|
||||
val f = new GrammarElementTitleSwitch().showAssignments.showQualified.showRule
|
||||
return '''
|
||||
«FOR ctx : ctxs.indexed»
|
||||
context«ctx.key» {
|
||||
«FOR ele:ctx.value.firstSetGrammarElements»
|
||||
«ele.eClass.name»: «f.apply(ele)»
|
||||
«ENDFOR»
|
||||
}
|
||||
«ENDFOR»
|
||||
'''
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist
|
||||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageIdeInjectorProvider
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess
|
||||
import org.eclipse.xtext.testing.InjectWith
|
||||
import org.eclipse.xtext.testing.XtextRunner
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import static extension org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner)
|
||||
@InjectWith(PartialContentAssistTestLanguageIdeInjectorProvider)
|
||||
class PartialContentAssistTestLanguageContextFactoryTest {
|
||||
|
||||
@Inject extension ContentAssistContextTestHelper
|
||||
@Inject ContentAssistContextFactory factory
|
||||
@Inject PartialContentAssistTestLanguageGrammarAccess grammar
|
||||
|
||||
@Test def void testConfig() {
|
||||
assertTrue(factory instanceof PartialContentAssistContextFactory)
|
||||
}
|
||||
|
||||
@Test def void testSimple1() {
|
||||
document = '''
|
||||
type Foo <|>{
|
||||
int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Keyword: TypeDeclaration:'extends'
|
||||
Keyword: TypeDeclaration:'{'
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testSimple2() {
|
||||
document = '''
|
||||
type Foo {
|
||||
<|>int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: TypeDeclaration:properties+= *
|
||||
RuleCall: TypeDeclaration:properties+=Property
|
||||
Assignment: Property:type=
|
||||
Keyword: Property:type='int'
|
||||
Keyword: Property:type='bool'
|
||||
Keyword: TypeDeclaration:'}'
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testBeginning() {
|
||||
document = '''
|
||||
<|>type Foo {
|
||||
int bar
|
||||
}
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Keyword: TypeDeclaration:'type'
|
||||
RuleCall: <AbstractElement not contained in AbstractRule!>:TypeDeclaration
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testCustomEntryPoint() {
|
||||
entryPoint = grammar.propertyRule
|
||||
document = '''
|
||||
int <|>bar
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Property:name=
|
||||
RuleCall: Property:name=ID
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
@Test def void testCustomEntryPointBeginning() {
|
||||
entryPoint = grammar.propertyRule
|
||||
document = '''
|
||||
<|>int bar
|
||||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Property:type=
|
||||
Keyword: Property:type='int'
|
||||
Keyword: Property:type='bool'
|
||||
RuleCall: <AbstractElement not contained in AbstractRule!>:Property
|
||||
}
|
||||
'''.toString.assertEquals(factory.firstSetGrammarElementsToString)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist.antlr
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
class CustomEntryPointContentAssistTest {
|
||||
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeSetup
|
||||
org.eclipse.xtext.ide.tests.testlanguage.ide.PartialContentAssistTestLanguageIdeSetup
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
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.generator.IGenerator2;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.generator.PartialContentAssistTestLanguageGenerator;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.PartialContentAssistTestLanguageAntlrTokenFileProvider;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.PartialContentAssistTestLanguageParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal.InternalPartialContentAssistTestLanguageLexer;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.scoping.PartialContentAssistTestLanguageScopeProvider;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.serializer.PartialContentAssistTestLanguageSemanticSequencer;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.serializer.PartialContentAssistTestLanguageSyntacticSequencer;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.validation.PartialContentAssistTestLanguageValidator;
|
||||
import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider;
|
||||
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.resource.IContainer;
|
||||
import org.eclipse.xtext.resource.IResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.containers.IAllContainersState;
|
||||
import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider;
|
||||
import org.eclipse.xtext.resource.containers.StateBasedContainerManager;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
|
||||
import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
|
||||
import org.eclipse.xtext.scoping.IGlobalScopeProvider;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.scoping.IgnoreCaseLinking;
|
||||
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider;
|
||||
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;
|
||||
import org.eclipse.xtext.service.SingletonBinding;
|
||||
|
||||
/**
|
||||
* Manual modifications go to {@link PartialContentAssistTestLanguageRuntimeModule}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractPartialContentAssistTestLanguageRuntimeModule extends DefaultRuntimeModule {
|
||||
|
||||
protected Properties properties = null;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder) {
|
||||
properties = tryBindProperties(binder, "org/eclipse/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage.properties");
|
||||
super.configure(binder);
|
||||
}
|
||||
|
||||
public void configureLanguageName(Binder binder) {
|
||||
binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage");
|
||||
}
|
||||
|
||||
public void configureFileExtensions(Binder binder) {
|
||||
if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
|
||||
binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("partialcontentassisttestlang");
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
|
||||
public ClassLoader bindClassLoaderToInstance() {
|
||||
return getClass().getClassLoader();
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
|
||||
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
|
||||
return PartialContentAssistTestLanguageGrammarAccess.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
|
||||
return PartialContentAssistTestLanguageSemanticSequencer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
|
||||
return PartialContentAssistTestLanguageSyntacticSequencer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISerializer> bindISerializer() {
|
||||
return Serializer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IParser> bindIParser() {
|
||||
return PartialContentAssistTestLanguageParser.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends ITokenToStringConverter> bindITokenToStringConverter() {
|
||||
return AntlrTokenToStringConverter.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
|
||||
return PartialContentAssistTestLanguageAntlrTokenFileProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends Lexer> bindLexer() {
|
||||
return InternalPartialContentAssistTestLanguageLexer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
|
||||
return AntlrTokenDefProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Provider<? extends InternalPartialContentAssistTestLanguageLexer> provideInternalPartialContentAssistTestLanguageLexer() {
|
||||
return LexerProvider.create(InternalPartialContentAssistTestLanguageLexer.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(InternalPartialContentAssistTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2
|
||||
@SingletonBinding(eager=true)
|
||||
public Class<? extends PartialContentAssistTestLanguageValidator> bindPartialContentAssistTestLanguageValidator() {
|
||||
return PartialContentAssistTestLanguageValidator.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
|
||||
public Class<? extends IScopeProvider> bindIScopeProvider() {
|
||||
return PartialContentAssistTestLanguageScopeProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
|
||||
public void configureIScopeProviderDelegate(Binder binder) {
|
||||
binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
|
||||
public Class<? extends IGlobalScopeProvider> bindIGlobalScopeProvider() {
|
||||
return DefaultGlobalScopeProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
|
||||
public void configureIgnoreCaseLinking(Binder binder) {
|
||||
binder.bindConstant().annotatedWith(IgnoreCaseLinking.class).to(false);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
|
||||
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
|
||||
return DefaultDeclarativeQualifiedNameProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
|
||||
public Class<? extends IContainer.Manager> bindIContainer$Manager() {
|
||||
return StateBasedContainerManager.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
|
||||
public Class<? extends IAllContainersState.Provider> bindIAllContainersState$Provider() {
|
||||
return ResourceSetBasedAllContainersStateProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
|
||||
public void configureIResourceDescriptions(Binder binder) {
|
||||
binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
|
||||
public void configureIResourceDescriptionsPersisted(Binder binder) {
|
||||
binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2
|
||||
public Class<? extends IGenerator2> bindIGenerator2() {
|
||||
return PartialContentAssistTestLanguageGenerator.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -128,7 +128,7 @@ public abstract class AbstractTestLanguageRuntimeModule extends DefaultRuntimeMo
|
|||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Provider<InternalTestLanguageLexer> provideInternalTestLanguageLexer() {
|
||||
public Provider<? extends InternalTestLanguageLexer> provideInternalTestLanguageLexer() {
|
||||
return LexerProvider.create(InternalTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
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.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageStandaloneSetupGenerated implements ISetup {
|
||||
|
||||
@Override
|
||||
public Injector createInjectorAndDoEMFRegistration() {
|
||||
TerminalsStandaloneSetup.doSetup();
|
||||
|
||||
Injector injector = createInjector();
|
||||
register(injector);
|
||||
return injector;
|
||||
}
|
||||
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(new PartialContentAssistTestLanguageRuntimeModule());
|
||||
}
|
||||
|
||||
public void register(Injector injector) {
|
||||
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage")) {
|
||||
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage", PartialContentAssistTestLanguagePackage.eINSTANCE);
|
||||
}
|
||||
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
|
||||
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
|
||||
|
||||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("partialcontentassisttestlang", resourceFactory);
|
||||
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("partialcontentassisttestlang", serviceProvider);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.name.Names;
|
||||
import org.eclipse.xtext.ide.DefaultIdeModule;
|
||||
import org.eclipse.xtext.ide.LexerIdeBindings;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.PartialContentAssistTestLanguageParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalPartialContentAssistTestLanguageLexer;
|
||||
|
||||
/**
|
||||
* Manual modifications go to {@link PartialContentAssistTestLanguageIdeModule}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractPartialContentAssistTestLanguageIdeModule extends DefaultIdeModule {
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public void configureContentAssistLexer(Binder binder) {
|
||||
binder.bind(Lexer.class)
|
||||
.annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
|
||||
.to(InternalPartialContentAssistTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IContentAssistParser> bindIContentAssistParser() {
|
||||
return PartialContentAssistTestLanguageParser.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends ContentAssistContextFactory> bindContentAssistContextFactory() {
|
||||
return PartialContentAssistContextFactory.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractPartialContentAssistParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalPartialContentAssistTestLanguageParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
|
||||
public class PartialContentAssistTestLanguageParser extends AbstractPartialContentAssistParser {
|
||||
|
||||
@Inject
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
private Map<AbstractElement, String> nameMappings;
|
||||
|
||||
@Override
|
||||
protected InternalPartialContentAssistTestLanguageParser createParser() {
|
||||
InternalPartialContentAssistTestLanguageParser result = new InternalPartialContentAssistTestLanguageParser(null);
|
||||
result.setGrammarAccess(grammarAccess);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRuleName(AbstractElement element) {
|
||||
if (nameMappings == null) {
|
||||
nameMappings = new HashMap<AbstractElement, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put(grammarAccess.getPropertyAccess().getTypeAlternatives_0_0(), "rule__Property__TypeAlternatives_0_0");
|
||||
put(grammarAccess.getTypeDeclarationAccess().getGroup(), "rule__TypeDeclaration__Group__0");
|
||||
put(grammarAccess.getTypeDeclarationAccess().getGroup_2(), "rule__TypeDeclaration__Group_2__0");
|
||||
put(grammarAccess.getPropertyAccess().getGroup(), "rule__Property__Group__0");
|
||||
put(grammarAccess.getTypeDeclarationAccess().getNameAssignment_1(), "rule__TypeDeclaration__NameAssignment_1");
|
||||
put(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1(), "rule__TypeDeclaration__SuperTypeAssignment_2_1");
|
||||
put(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4(), "rule__TypeDeclaration__PropertiesAssignment_4");
|
||||
put(grammarAccess.getPropertyAccess().getTypeAssignment_0(), "rule__Property__TypeAssignment_0");
|
||||
put(grammarAccess.getPropertyAccess().getNameAssignment_1(), "rule__Property__NameAssignment_1");
|
||||
}
|
||||
};
|
||||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
}
|
||||
|
||||
public PartialContentAssistTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return this.grammarAccess;
|
||||
}
|
||||
|
||||
public void setGrammarAccess(PartialContentAssistTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.eclipse.xtext.AbstractRule;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser;
|
||||
import org.eclipse.xtext.util.PolymorphicDispatcher;
|
||||
|
||||
public class PartialPartialContentAssistTestLanguageContentAssistParser extends PartialContentAssistTestLanguageParser implements IPartialEditingContentAssistParser {
|
||||
|
||||
private AbstractRule rule;
|
||||
|
||||
@Override
|
||||
public void initializeFor(AbstractRule rule) {
|
||||
this.rule = rule;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
if (rule == null || rule.eIsProxy())
|
||||
return Collections.emptyList();
|
||||
String methodName = "entryRule" + rule.getName();
|
||||
PolymorphicDispatcher<Collection<FollowElement>> dispatcher =
|
||||
new PolymorphicDispatcher<Collection<FollowElement>>(methodName, 0, 0, Collections.singletonList(parser));
|
||||
dispatcher.invoke();
|
||||
return parser.getFollowElements();
|
||||
}
|
||||
|
||||
}
|
|
@ -8,14 +8,10 @@
|
|||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalTestLanguageParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess;
|
||||
|
||||
|
@ -60,18 +56,7 @@ public class TestLanguageParser extends AbstractContentAssistParser {
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalTestLanguageParser typedParser = (InternalTestLanguageParser) parser;
|
||||
typedParser.entryRuleModel();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -0,0 +1,488 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
grammar InternalPartialContentAssistTestLanguage;
|
||||
|
||||
options {
|
||||
superClass=AbstractInternalContentAssistParser;
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal;
|
||||
|
||||
// Hack: Use our own Lexer superclass by means of import.
|
||||
// Currently there is no other way to specify the superclass for the lexer.
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
}
|
||||
|
||||
@parser::header {
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.parser.*;
|
||||
import org.eclipse.xtext.parser.impl.*;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
|
||||
}
|
||||
@parser::members {
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public void setGrammarAccess(PartialContentAssistTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Grammar getGrammar() {
|
||||
return grammarAccess.getGrammar();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getValueForTokenName(String tokenName) {
|
||||
return tokenName;
|
||||
}
|
||||
}
|
||||
|
||||
// Entry rule entryRuleTypeDeclaration
|
||||
entryRuleTypeDeclaration
|
||||
:
|
||||
{ before(grammarAccess.getTypeDeclarationRule()); }
|
||||
ruleTypeDeclaration
|
||||
{ after(grammarAccess.getTypeDeclarationRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule TypeDeclaration
|
||||
ruleTypeDeclaration
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getGroup()); }
|
||||
(rule__TypeDeclaration__Group__0)
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
// Entry rule entryRuleProperty
|
||||
entryRuleProperty
|
||||
:
|
||||
{ before(grammarAccess.getPropertyRule()); }
|
||||
ruleProperty
|
||||
{ after(grammarAccess.getPropertyRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule Property
|
||||
ruleProperty
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getGroup()); }
|
||||
(rule__Property__Group__0)
|
||||
{ after(grammarAccess.getPropertyAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__TypeAlternatives_0_0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getTypeIntKeyword_0_0_0()); }
|
||||
'int'
|
||||
{ after(grammarAccess.getPropertyAccess().getTypeIntKeyword_0_0_0()); }
|
||||
)
|
||||
|
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getTypeBoolKeyword_0_0_1()); }
|
||||
'bool'
|
||||
{ after(grammarAccess.getPropertyAccess().getTypeBoolKeyword_0_0_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__0__Impl
|
||||
rule__TypeDeclaration__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getTypeKeyword_0()); }
|
||||
'type'
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getTypeKeyword_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__1__Impl
|
||||
rule__TypeDeclaration__Group__2
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getNameAssignment_1()); }
|
||||
(rule__TypeDeclaration__NameAssignment_1)
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getNameAssignment_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__2
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__2__Impl
|
||||
rule__TypeDeclaration__Group__3
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__2__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getGroup_2()); }
|
||||
(rule__TypeDeclaration__Group_2__0)?
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getGroup_2()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__3__Impl
|
||||
rule__TypeDeclaration__Group__4
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__3__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()); }
|
||||
'{'
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__4
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__4__Impl
|
||||
rule__TypeDeclaration__Group__5
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__4__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4()); }
|
||||
(rule__TypeDeclaration__PropertiesAssignment_4)*
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__5
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group__5__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group__5__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()); }
|
||||
'}'
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__TypeDeclaration__Group_2__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group_2__0__Impl
|
||||
rule__TypeDeclaration__Group_2__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group_2__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0()); }
|
||||
'extends'
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group_2__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__TypeDeclaration__Group_2__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__Group_2__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1()); }
|
||||
(rule__TypeDeclaration__SuperTypeAssignment_2_1)
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__Property__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Property__Group__0__Impl
|
||||
rule__Property__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getTypeAssignment_0()); }
|
||||
(rule__Property__TypeAssignment_0)
|
||||
{ after(grammarAccess.getPropertyAccess().getTypeAssignment_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Property__Group__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getNameAssignment_1()); }
|
||||
(rule__Property__NameAssignment_1)
|
||||
{ after(grammarAccess.getPropertyAccess().getNameAssignment_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__TypeDeclaration__NameAssignment_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__SuperTypeAssignment_2_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
|
||||
)
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__TypeDeclaration__PropertiesAssignment_4
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0()); }
|
||||
ruleProperty
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__TypeAssignment_0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getTypeAlternatives_0_0()); }
|
||||
(rule__Property__TypeAlternatives_0_0)
|
||||
{ after(grammarAccess.getPropertyAccess().getTypeAlternatives_0_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Property__NameAssignment_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
|
||||
|
||||
RULE_INT : ('0'..'9')+;
|
||||
|
||||
RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\'');
|
||||
|
||||
RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/';
|
||||
|
||||
RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
|
||||
|
||||
RULE_WS : (' '|'\t'|'\r'|'\n')+;
|
||||
|
||||
RULE_ANY_OTHER : .;
|
|
@ -0,0 +1,19 @@
|
|||
'bool'=12
|
||||
'extends'=16
|
||||
'int'=11
|
||||
'type'=13
|
||||
'{'=14
|
||||
'}'=15
|
||||
RULE_ANY_OTHER=10
|
||||
RULE_ID=4
|
||||
RULE_INT=5
|
||||
RULE_ML_COMMENT=7
|
||||
RULE_SL_COMMENT=8
|
||||
RULE_STRING=6
|
||||
RULE_WS=9
|
||||
T__11=11
|
||||
T__12=12
|
||||
T__13=13
|
||||
T__14=14
|
||||
T__15=15
|
||||
T__16=16
|
|
@ -0,0 +1,923 @@
|
|||
package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal;
|
||||
|
||||
// Hack: Use our own Lexer superclass by means of import.
|
||||
// Currently there is no other way to specify the superclass for the lexer.
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class InternalPartialContentAssistTestLanguageLexer extends Lexer {
|
||||
public static final int RULE_ID=4;
|
||||
public static final int RULE_WS=9;
|
||||
public static final int RULE_STRING=6;
|
||||
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__11=11;
|
||||
public static final int RULE_ML_COMMENT=7;
|
||||
public static final int T__12=12;
|
||||
public static final int T__13=13;
|
||||
public static final int T__14=14;
|
||||
public static final int EOF=-1;
|
||||
|
||||
// delegates
|
||||
// delegators
|
||||
|
||||
public InternalPartialContentAssistTestLanguageLexer() {;}
|
||||
public InternalPartialContentAssistTestLanguageLexer(CharStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalPartialContentAssistTestLanguageLexer(CharStream input, RecognizerSharedState state) {
|
||||
super(input,state);
|
||||
|
||||
}
|
||||
public String getGrammarFileName() { return "InternalPartialContentAssistTestLanguage.g"; }
|
||||
|
||||
// $ANTLR start "T__11"
|
||||
public final void mT__11() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__11;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:11:7: ( 'int' )
|
||||
// InternalPartialContentAssistTestLanguage.g:11:9: 'int'
|
||||
{
|
||||
match("int");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__11"
|
||||
|
||||
// $ANTLR start "T__12"
|
||||
public final void mT__12() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__12;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:12:7: ( 'bool' )
|
||||
// InternalPartialContentAssistTestLanguage.g:12:9: 'bool'
|
||||
{
|
||||
match("bool");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__12"
|
||||
|
||||
// $ANTLR start "T__13"
|
||||
public final void mT__13() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__13;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:13:7: ( 'type' )
|
||||
// InternalPartialContentAssistTestLanguage.g:13:9: 'type'
|
||||
{
|
||||
match("type");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__13"
|
||||
|
||||
// $ANTLR start "T__14"
|
||||
public final void mT__14() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__14;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:14:7: ( '{' )
|
||||
// InternalPartialContentAssistTestLanguage.g:14:9: '{'
|
||||
{
|
||||
match('{');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__14"
|
||||
|
||||
// $ANTLR start "T__15"
|
||||
public final void mT__15() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__15;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:15:7: ( '}' )
|
||||
// InternalPartialContentAssistTestLanguage.g:15:9: '}'
|
||||
{
|
||||
match('}');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__15"
|
||||
|
||||
// $ANTLR start "T__16"
|
||||
public final void mT__16() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__16;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:16:7: ( 'extends' )
|
||||
// InternalPartialContentAssistTestLanguage.g:16:9: 'extends'
|
||||
{
|
||||
match("extends");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__16"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:476:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalPartialContentAssistTestLanguage.g:476:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:476:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0=='^') ) {
|
||||
alt1=1;
|
||||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:476:11: '^'
|
||||
{
|
||||
match('^');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:476:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
int LA2_0 = input.LA(1);
|
||||
|
||||
if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='Z')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='z')) ) {
|
||||
alt2=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt2) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:
|
||||
{
|
||||
if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop2;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ID"
|
||||
|
||||
// $ANTLR start "RULE_INT"
|
||||
public final void mRULE_INT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_INT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:478:10: ( ( '0' .. '9' )+ )
|
||||
// InternalPartialContentAssistTestLanguage.g:478:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:478:12: ( '0' .. '9' )+
|
||||
int cnt3=0;
|
||||
loop3:
|
||||
do {
|
||||
int alt3=2;
|
||||
int LA3_0 = input.LA(1);
|
||||
|
||||
if ( ((LA3_0>='0' && LA3_0<='9')) ) {
|
||||
alt3=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:478:13: '0' .. '9'
|
||||
{
|
||||
matchRange('0','9');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
if ( cnt3 >= 1 ) break loop3;
|
||||
EarlyExitException eee =
|
||||
new EarlyExitException(3, input);
|
||||
throw eee;
|
||||
}
|
||||
cnt3++;
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_INT"
|
||||
|
||||
// $ANTLR start "RULE_STRING"
|
||||
public final void mRULE_STRING() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_STRING;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:480:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:480:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:480:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
int alt6=2;
|
||||
int LA6_0 = input.LA(1);
|
||||
|
||||
if ( (LA6_0=='\"') ) {
|
||||
alt6=1;
|
||||
}
|
||||
else if ( (LA6_0=='\'') ) {
|
||||
alt6=2;
|
||||
}
|
||||
else {
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException("", 6, 0, input);
|
||||
|
||||
throw nvae;
|
||||
}
|
||||
switch (alt6) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalPartialContentAssistTestLanguage.g:480:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=3;
|
||||
int LA4_0 = input.LA(1);
|
||||
|
||||
if ( (LA4_0=='\\') ) {
|
||||
alt4=1;
|
||||
}
|
||||
else if ( ((LA4_0>='\u0000' && LA4_0<='!')||(LA4_0>='#' && LA4_0<='[')||(LA4_0>=']' && LA4_0<='\uFFFF')) ) {
|
||||
alt4=2;
|
||||
}
|
||||
|
||||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop4;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match('\"');
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalPartialContentAssistTestLanguage.g:480:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
loop5:
|
||||
do {
|
||||
int alt5=3;
|
||||
int LA5_0 = input.LA(1);
|
||||
|
||||
if ( (LA5_0=='\\') ) {
|
||||
alt5=1;
|
||||
}
|
||||
else if ( ((LA5_0>='\u0000' && LA5_0<='&')||(LA5_0>='(' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) {
|
||||
alt5=2;
|
||||
}
|
||||
|
||||
|
||||
switch (alt5) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:480:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop5;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match('\'');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_STRING"
|
||||
|
||||
// $ANTLR start "RULE_ML_COMMENT"
|
||||
public final void mRULE_ML_COMMENT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ML_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:482:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalPartialContentAssistTestLanguage.g:482:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:482:24: ( options {greedy=false; } : . )*
|
||||
loop7:
|
||||
do {
|
||||
int alt7=2;
|
||||
int LA7_0 = input.LA(1);
|
||||
|
||||
if ( (LA7_0=='*') ) {
|
||||
int LA7_1 = input.LA(2);
|
||||
|
||||
if ( (LA7_1=='/') ) {
|
||||
alt7=2;
|
||||
}
|
||||
else if ( ((LA7_1>='\u0000' && LA7_1<='.')||(LA7_1>='0' && LA7_1<='\uFFFF')) ) {
|
||||
alt7=1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if ( ((LA7_0>='\u0000' && LA7_0<=')')||(LA7_0>='+' && LA7_0<='\uFFFF')) ) {
|
||||
alt7=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt7) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:482:52: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop7;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match("*/");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ML_COMMENT"
|
||||
|
||||
// $ANTLR start "RULE_SL_COMMENT"
|
||||
public final void mRULE_SL_COMMENT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_SL_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:484:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalPartialContentAssistTestLanguage.g:484:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:484:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
loop8:
|
||||
do {
|
||||
int alt8=2;
|
||||
int LA8_0 = input.LA(1);
|
||||
|
||||
if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) {
|
||||
alt8=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt8) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:484: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();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop8;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:484:40: ( ( '\\r' )? '\\n' )?
|
||||
int alt10=2;
|
||||
int LA10_0 = input.LA(1);
|
||||
|
||||
if ( (LA10_0=='\n'||LA10_0=='\r') ) {
|
||||
alt10=1;
|
||||
}
|
||||
switch (alt10) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:484:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:484:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
if ( (LA9_0=='\r') ) {
|
||||
alt9=1;
|
||||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:484:41: '\\r'
|
||||
{
|
||||
match('\r');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
match('\n');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_SL_COMMENT"
|
||||
|
||||
// $ANTLR start "RULE_WS"
|
||||
public final void mRULE_WS() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_WS;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:486:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalPartialContentAssistTestLanguage.g:486:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:486:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
int cnt11=0;
|
||||
loop11:
|
||||
do {
|
||||
int alt11=2;
|
||||
int LA11_0 = input.LA(1);
|
||||
|
||||
if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) {
|
||||
alt11=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt11) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:
|
||||
{
|
||||
if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
if ( cnt11 >= 1 ) break loop11;
|
||||
EarlyExitException eee =
|
||||
new EarlyExitException(11, input);
|
||||
throw eee;
|
||||
}
|
||||
cnt11++;
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_WS"
|
||||
|
||||
// $ANTLR start "RULE_ANY_OTHER"
|
||||
public final void mRULE_ANY_OTHER() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ANY_OTHER;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:488:16: ( . )
|
||||
// InternalPartialContentAssistTestLanguage.g:488:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalPartialContentAssistTestLanguage.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;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:10: T__11
|
||||
{
|
||||
mT__11();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:16: T__12
|
||||
{
|
||||
mT__12();
|
||||
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:22: T__13
|
||||
{
|
||||
mT__13();
|
||||
|
||||
}
|
||||
break;
|
||||
case 4 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:28: T__14
|
||||
{
|
||||
mT__14();
|
||||
|
||||
}
|
||||
break;
|
||||
case 5 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:34: T__15
|
||||
{
|
||||
mT__15();
|
||||
|
||||
}
|
||||
break;
|
||||
case 6 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:40: T__16
|
||||
{
|
||||
mT__16();
|
||||
|
||||
}
|
||||
break;
|
||||
case 7 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:46: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 8 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:54: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 9 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:63: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 10 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:75: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 11 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:91: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 12 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:107: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 13 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:115: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\3\20\2\uffff\1\20\1\16\2\uffff\3\16\2\uffff\1\20\1\uffff\2\20\2\uffff\1\20\5\uffff\1\37\3\20\1\uffff\1\43\1\44\1\20\2\uffff\2\20\1\50\1\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\51\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\156\1\157\1\171\2\uffff\1\170\1\101\2\uffff\2\0\1\52\2\uffff\1\164\1\uffff\1\157\1\160\2\uffff\1\164\5\uffff\1\60\1\154\2\145\1\uffff\2\60\1\156\2\uffff\1\144\1\163\1\60\1\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\156\1\157\1\171\2\uffff\1\170\1\172\2\uffff\2\uffff\1\57\2\uffff\1\164\1\uffff\1\157\1\160\2\uffff\1\164\5\uffff\1\172\1\154\2\145\1\uffff\2\172\1\156\2\uffff\1\144\1\163\1\172\1\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\4\uffff\1\4\1\5\2\uffff\1\7\1\10\3\uffff\1\14\1\15\1\uffff\1\7\2\uffff\1\4\1\5\1\uffff\1\10\1\11\1\12\1\13\1\14\4\uffff\1\1\3\uffff\1\2\1\3\3\uffff\1\6";
|
||||
static final String DFA12_specialS =
|
||||
"\1\0\11\uffff\1\1\1\2\35\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\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\10\1\2\2\10\1\6\3\10\1\1\12\10\1\3\6\10\1\4\1\16\1\5\uff82\16",
|
||||
"\1\17",
|
||||
"\1\21",
|
||||
"\1\22",
|
||||
"",
|
||||
"",
|
||||
"\1\25",
|
||||
"\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"",
|
||||
"",
|
||||
"\0\27",
|
||||
"\0\27",
|
||||
"\1\30\4\uffff\1\31",
|
||||
"",
|
||||
"",
|
||||
"\1\33",
|
||||
"",
|
||||
"\1\34",
|
||||
"\1\35",
|
||||
"",
|
||||
"",
|
||||
"\1\36",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"\1\40",
|
||||
"\1\41",
|
||||
"\1\42",
|
||||
"",
|
||||
"\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",
|
||||
"\1\45",
|
||||
"",
|
||||
"",
|
||||
"\1\46",
|
||||
"\1\47",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
""
|
||||
};
|
||||
|
||||
static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS);
|
||||
static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS);
|
||||
static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS);
|
||||
static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS);
|
||||
static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS);
|
||||
static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS);
|
||||
static final short[][] DFA12_transition;
|
||||
|
||||
static {
|
||||
int numStates = DFA12_transitionS.length;
|
||||
DFA12_transition = new short[numStates][];
|
||||
for (int i=0; i<numStates; i++) {
|
||||
DFA12_transition[i] = DFA.unpackEncodedString(DFA12_transitionS[i]);
|
||||
}
|
||||
}
|
||||
|
||||
class DFA12 extends DFA {
|
||||
|
||||
public DFA12(BaseRecognizer recognizer) {
|
||||
this.recognizer = recognizer;
|
||||
this.decisionNumber = 12;
|
||||
this.eot = DFA12_eot;
|
||||
this.eof = DFA12_eof;
|
||||
this.min = DFA12_min;
|
||||
this.max = DFA12_max;
|
||||
this.accept = DFA12_accept;
|
||||
this.special = DFA12_special;
|
||||
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 );";
|
||||
}
|
||||
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
|
||||
IntStream input = _input;
|
||||
int _s = s;
|
||||
switch ( s ) {
|
||||
case 0 :
|
||||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( (LA12_0=='i') ) {s = 1;}
|
||||
|
||||
else if ( (LA12_0=='b') ) {s = 2;}
|
||||
|
||||
else if ( (LA12_0=='t') ) {s = 3;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 7;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='s')||(LA12_0>='u' && LA12_0<='z')) ) {s = 8;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 9;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 12;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {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>='~' && LA12_0<='\uFFFF')) ) {s = 14;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_10 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_10>='\u0000' && LA12_10<='\uFFFF')) ) {s = 23;}
|
||||
|
||||
else s = 14;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_11 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_11>='\u0000' && LA12_11<='\uFFFF')) ) {s = 23;}
|
||||
|
||||
else s = 14;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
}
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException(getDescription(), 12, _s, input);
|
||||
error(nvae);
|
||||
throw nvae;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
|
||||
|
||||
public class PartialContentAssistTestLanguageAntlrTokenFileProvider implements IAntlrTokenFileProvider {
|
||||
|
||||
@Override
|
||||
public InputStream getAntlrTokenFile() {
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
return classLoader.getResourceAsStream("org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalPartialContentAssistTestLanguage.tokens");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal.InternalPartialContentAssistTestLanguageParser;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
|
||||
public class PartialContentAssistTestLanguageParser extends AbstractAntlrParser {
|
||||
|
||||
@Inject
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Override
|
||||
protected void setInitialHiddenTokens(XtextTokenStream tokenStream) {
|
||||
tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected InternalPartialContentAssistTestLanguageParser createParser(XtextTokenStream stream) {
|
||||
return new InternalPartialContentAssistTestLanguageParser(stream, getGrammarAccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultRuleName() {
|
||||
return "TypeDeclaration";
|
||||
}
|
||||
|
||||
public PartialContentAssistTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return this.grammarAccess;
|
||||
}
|
||||
|
||||
public void setGrammarAccess(PartialContentAssistTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
grammar InternalPartialContentAssistTestLanguage;
|
||||
|
||||
options {
|
||||
superClass=AbstractInternalAntlrParser;
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal;
|
||||
|
||||
// Hack: Use our own Lexer superclass by means of import.
|
||||
// Currently there is no other way to specify the superclass for the lexer.
|
||||
import org.eclipse.xtext.parser.antlr.Lexer;
|
||||
}
|
||||
|
||||
@parser::header {
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal;
|
||||
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.parser.*;
|
||||
import org.eclipse.xtext.parser.impl.*;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
|
||||
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
|
||||
}
|
||||
|
||||
@parser::members {
|
||||
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public InternalPartialContentAssistTestLanguageParser(TokenStream input, PartialContentAssistTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "TypeDeclaration";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PartialContentAssistTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@rulecatch {
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
|
||||
// Entry rule entryRuleTypeDeclaration
|
||||
entryRuleTypeDeclaration returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getTypeDeclarationRule()); }
|
||||
iv_ruleTypeDeclaration=ruleTypeDeclaration
|
||||
{ $current=$iv_ruleTypeDeclaration.current; }
|
||||
EOF;
|
||||
|
||||
// Rule TypeDeclaration
|
||||
ruleTypeDeclaration returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
otherlv_0='type'
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getTypeDeclarationAccess().getTypeKeyword_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
lv_name_1_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getTypeDeclarationAccess().getNameIDTerminalRuleCall_1_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
)
|
||||
)
|
||||
(
|
||||
otherlv_2='extends'
|
||||
{
|
||||
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
}
|
||||
otherlv_3=RULE_ID
|
||||
{
|
||||
newLeafNode(otherlv_3, grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
|
||||
}
|
||||
)
|
||||
)
|
||||
)?
|
||||
otherlv_4='{'
|
||||
{
|
||||
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0());
|
||||
}
|
||||
lv_properties_5_0=ruleProperty
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"properties",
|
||||
lv_properties_5_0,
|
||||
"org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage.Property");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
otherlv_6='}'
|
||||
{
|
||||
newLeafNode(otherlv_6, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5());
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleProperty
|
||||
entryRuleProperty returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getPropertyRule()); }
|
||||
iv_ruleProperty=ruleProperty
|
||||
{ $current=$iv_ruleProperty.current; }
|
||||
EOF;
|
||||
|
||||
// Rule Property
|
||||
ruleProperty returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
(
|
||||
(
|
||||
(
|
||||
lv_type_0_1='int'
|
||||
{
|
||||
newLeafNode(lv_type_0_1, grammarAccess.getPropertyAccess().getTypeIntKeyword_0_0_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed($current, "type", lv_type_0_1, null);
|
||||
}
|
||||
|
|
||||
lv_type_0_2='bool'
|
||||
{
|
||||
newLeafNode(lv_type_0_2, grammarAccess.getPropertyAccess().getTypeBoolKeyword_0_0_1());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed($current, "type", lv_type_0_2, null);
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
lv_name_1_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_1_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
|
||||
|
||||
RULE_INT : ('0'..'9')+;
|
||||
|
||||
RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\'');
|
||||
|
||||
RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/';
|
||||
|
||||
RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
|
||||
|
||||
RULE_WS : (' '|'\t'|'\r'|'\n')+;
|
||||
|
||||
RULE_ANY_OTHER : .;
|
|
@ -0,0 +1,19 @@
|
|||
'bool'=16
|
||||
'extends'=12
|
||||
'int'=15
|
||||
'type'=11
|
||||
'{'=13
|
||||
'}'=14
|
||||
RULE_ANY_OTHER=10
|
||||
RULE_ID=4
|
||||
RULE_INT=5
|
||||
RULE_ML_COMMENT=7
|
||||
RULE_SL_COMMENT=8
|
||||
RULE_STRING=6
|
||||
RULE_WS=9
|
||||
T__11=11
|
||||
T__12=12
|
||||
T__13=13
|
||||
T__14=14
|
||||
T__15=15
|
||||
T__16=16
|
|
@ -0,0 +1,923 @@
|
|||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal;
|
||||
|
||||
// Hack: Use our own Lexer superclass by means of import.
|
||||
// Currently there is no other way to specify the superclass for the lexer.
|
||||
import org.eclipse.xtext.parser.antlr.Lexer;
|
||||
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class InternalPartialContentAssistTestLanguageLexer extends Lexer {
|
||||
public static final int RULE_ID=4;
|
||||
public static final int RULE_WS=9;
|
||||
public static final int RULE_STRING=6;
|
||||
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__11=11;
|
||||
public static final int RULE_ML_COMMENT=7;
|
||||
public static final int T__12=12;
|
||||
public static final int T__13=13;
|
||||
public static final int T__14=14;
|
||||
public static final int EOF=-1;
|
||||
|
||||
// delegates
|
||||
// delegators
|
||||
|
||||
public InternalPartialContentAssistTestLanguageLexer() {;}
|
||||
public InternalPartialContentAssistTestLanguageLexer(CharStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalPartialContentAssistTestLanguageLexer(CharStream input, RecognizerSharedState state) {
|
||||
super(input,state);
|
||||
|
||||
}
|
||||
public String getGrammarFileName() { return "InternalPartialContentAssistTestLanguage.g"; }
|
||||
|
||||
// $ANTLR start "T__11"
|
||||
public final void mT__11() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__11;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:11:7: ( 'type' )
|
||||
// InternalPartialContentAssistTestLanguage.g:11:9: 'type'
|
||||
{
|
||||
match("type");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__11"
|
||||
|
||||
// $ANTLR start "T__12"
|
||||
public final void mT__12() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__12;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:12:7: ( 'extends' )
|
||||
// InternalPartialContentAssistTestLanguage.g:12:9: 'extends'
|
||||
{
|
||||
match("extends");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__12"
|
||||
|
||||
// $ANTLR start "T__13"
|
||||
public final void mT__13() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__13;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:13:7: ( '{' )
|
||||
// InternalPartialContentAssistTestLanguage.g:13:9: '{'
|
||||
{
|
||||
match('{');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__13"
|
||||
|
||||
// $ANTLR start "T__14"
|
||||
public final void mT__14() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__14;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:14:7: ( '}' )
|
||||
// InternalPartialContentAssistTestLanguage.g:14:9: '}'
|
||||
{
|
||||
match('}');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__14"
|
||||
|
||||
// $ANTLR start "T__15"
|
||||
public final void mT__15() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__15;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:15:7: ( 'int' )
|
||||
// InternalPartialContentAssistTestLanguage.g:15:9: 'int'
|
||||
{
|
||||
match("int");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__15"
|
||||
|
||||
// $ANTLR start "T__16"
|
||||
public final void mT__16() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__16;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:16:7: ( 'bool' )
|
||||
// InternalPartialContentAssistTestLanguage.g:16:9: 'bool'
|
||||
{
|
||||
match("bool");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__16"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:218:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalPartialContentAssistTestLanguage.g:218:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:218:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0=='^') ) {
|
||||
alt1=1;
|
||||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:218:11: '^'
|
||||
{
|
||||
match('^');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:218:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
int LA2_0 = input.LA(1);
|
||||
|
||||
if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='Z')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='z')) ) {
|
||||
alt2=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt2) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:
|
||||
{
|
||||
if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop2;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ID"
|
||||
|
||||
// $ANTLR start "RULE_INT"
|
||||
public final void mRULE_INT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_INT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:220:10: ( ( '0' .. '9' )+ )
|
||||
// InternalPartialContentAssistTestLanguage.g:220:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:220:12: ( '0' .. '9' )+
|
||||
int cnt3=0;
|
||||
loop3:
|
||||
do {
|
||||
int alt3=2;
|
||||
int LA3_0 = input.LA(1);
|
||||
|
||||
if ( ((LA3_0>='0' && LA3_0<='9')) ) {
|
||||
alt3=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:220:13: '0' .. '9'
|
||||
{
|
||||
matchRange('0','9');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
if ( cnt3 >= 1 ) break loop3;
|
||||
EarlyExitException eee =
|
||||
new EarlyExitException(3, input);
|
||||
throw eee;
|
||||
}
|
||||
cnt3++;
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_INT"
|
||||
|
||||
// $ANTLR start "RULE_STRING"
|
||||
public final void mRULE_STRING() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_STRING;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:222:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:222:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:222:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
int alt6=2;
|
||||
int LA6_0 = input.LA(1);
|
||||
|
||||
if ( (LA6_0=='\"') ) {
|
||||
alt6=1;
|
||||
}
|
||||
else if ( (LA6_0=='\'') ) {
|
||||
alt6=2;
|
||||
}
|
||||
else {
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException("", 6, 0, input);
|
||||
|
||||
throw nvae;
|
||||
}
|
||||
switch (alt6) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalPartialContentAssistTestLanguage.g:222:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=3;
|
||||
int LA4_0 = input.LA(1);
|
||||
|
||||
if ( (LA4_0=='\\') ) {
|
||||
alt4=1;
|
||||
}
|
||||
else if ( ((LA4_0>='\u0000' && LA4_0<='!')||(LA4_0>='#' && LA4_0<='[')||(LA4_0>=']' && LA4_0<='\uFFFF')) ) {
|
||||
alt4=2;
|
||||
}
|
||||
|
||||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop4;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match('\"');
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalPartialContentAssistTestLanguage.g:222:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
loop5:
|
||||
do {
|
||||
int alt5=3;
|
||||
int LA5_0 = input.LA(1);
|
||||
|
||||
if ( (LA5_0=='\\') ) {
|
||||
alt5=1;
|
||||
}
|
||||
else if ( ((LA5_0>='\u0000' && LA5_0<='&')||(LA5_0>='(' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) {
|
||||
alt5=2;
|
||||
}
|
||||
|
||||
|
||||
switch (alt5) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:222:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop5;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match('\'');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_STRING"
|
||||
|
||||
// $ANTLR start "RULE_ML_COMMENT"
|
||||
public final void mRULE_ML_COMMENT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ML_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:224:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalPartialContentAssistTestLanguage.g:224:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:224:24: ( options {greedy=false; } : . )*
|
||||
loop7:
|
||||
do {
|
||||
int alt7=2;
|
||||
int LA7_0 = input.LA(1);
|
||||
|
||||
if ( (LA7_0=='*') ) {
|
||||
int LA7_1 = input.LA(2);
|
||||
|
||||
if ( (LA7_1=='/') ) {
|
||||
alt7=2;
|
||||
}
|
||||
else if ( ((LA7_1>='\u0000' && LA7_1<='.')||(LA7_1>='0' && LA7_1<='\uFFFF')) ) {
|
||||
alt7=1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if ( ((LA7_0>='\u0000' && LA7_0<=')')||(LA7_0>='+' && LA7_0<='\uFFFF')) ) {
|
||||
alt7=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt7) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:224:52: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop7;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
match("*/");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ML_COMMENT"
|
||||
|
||||
// $ANTLR start "RULE_SL_COMMENT"
|
||||
public final void mRULE_SL_COMMENT() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_SL_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:226:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalPartialContentAssistTestLanguage.g:226:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:226:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
loop8:
|
||||
do {
|
||||
int alt8=2;
|
||||
int LA8_0 = input.LA(1);
|
||||
|
||||
if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) {
|
||||
alt8=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt8) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:226: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();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop8;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:226:40: ( ( '\\r' )? '\\n' )?
|
||||
int alt10=2;
|
||||
int LA10_0 = input.LA(1);
|
||||
|
||||
if ( (LA10_0=='\n'||LA10_0=='\r') ) {
|
||||
alt10=1;
|
||||
}
|
||||
switch (alt10) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:226:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:226:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
if ( (LA9_0=='\r') ) {
|
||||
alt9=1;
|
||||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:226:41: '\\r'
|
||||
{
|
||||
match('\r');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
match('\n');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_SL_COMMENT"
|
||||
|
||||
// $ANTLR start "RULE_WS"
|
||||
public final void mRULE_WS() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_WS;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:228:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalPartialContentAssistTestLanguage.g:228:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:228:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
int cnt11=0;
|
||||
loop11:
|
||||
do {
|
||||
int alt11=2;
|
||||
int LA11_0 = input.LA(1);
|
||||
|
||||
if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) {
|
||||
alt11=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt11) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:
|
||||
{
|
||||
if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
|
||||
input.consume();
|
||||
|
||||
}
|
||||
else {
|
||||
MismatchedSetException mse = new MismatchedSetException(null,input);
|
||||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
if ( cnt11 >= 1 ) break loop11;
|
||||
EarlyExitException eee =
|
||||
new EarlyExitException(11, input);
|
||||
throw eee;
|
||||
}
|
||||
cnt11++;
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_WS"
|
||||
|
||||
// $ANTLR start "RULE_ANY_OTHER"
|
||||
public final void mRULE_ANY_OTHER() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ANY_OTHER;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalPartialContentAssistTestLanguage.g:230:16: ( . )
|
||||
// InternalPartialContentAssistTestLanguage.g:230:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalPartialContentAssistTestLanguage.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;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:10: T__11
|
||||
{
|
||||
mT__11();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:16: T__12
|
||||
{
|
||||
mT__12();
|
||||
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:22: T__13
|
||||
{
|
||||
mT__13();
|
||||
|
||||
}
|
||||
break;
|
||||
case 4 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:28: T__14
|
||||
{
|
||||
mT__14();
|
||||
|
||||
}
|
||||
break;
|
||||
case 5 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:34: T__15
|
||||
{
|
||||
mT__15();
|
||||
|
||||
}
|
||||
break;
|
||||
case 6 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:40: T__16
|
||||
{
|
||||
mT__16();
|
||||
|
||||
}
|
||||
break;
|
||||
case 7 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:46: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 8 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:54: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 9 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:63: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 10 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:75: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 11 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:91: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 12 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:107: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 13 :
|
||||
// InternalPartialContentAssistTestLanguage.g:1:115: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\2\20\2\uffff\2\20\1\16\2\uffff\3\16\2\uffff\1\20\1\uffff\1\20\2\uffff\2\20\5\uffff\2\20\1\41\1\20\1\43\1\20\1\uffff\1\45\1\uffff\1\20\1\uffff\1\20\1\50\1\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\51\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\171\1\170\2\uffff\1\156\1\157\1\101\2\uffff\2\0\1\52\2\uffff\1\160\1\uffff\1\164\2\uffff\1\164\1\157\5\uffff\2\145\1\60\1\154\1\60\1\156\1\uffff\1\60\1\uffff\1\144\1\uffff\1\163\1\60\1\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\171\1\170\2\uffff\1\156\1\157\1\172\2\uffff\2\uffff\1\57\2\uffff\1\160\1\uffff\1\164\2\uffff\1\164\1\157\5\uffff\2\145\1\172\1\154\1\172\1\156\1\uffff\1\172\1\uffff\1\144\1\uffff\1\163\1\172\1\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\3\uffff\1\3\1\4\3\uffff\1\7\1\10\3\uffff\1\14\1\15\1\uffff\1\7\1\uffff\1\3\1\4\2\uffff\1\10\1\11\1\12\1\13\1\14\6\uffff\1\5\1\uffff\1\1\1\uffff\1\6\2\uffff\1\2";
|
||||
static final String DFA12_specialS =
|
||||
"\1\1\11\uffff\1\0\1\2\35\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\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\10\1\6\2\10\1\2\3\10\1\5\12\10\1\1\6\10\1\3\1\16\1\4\uff82\16",
|
||||
"\1\17",
|
||||
"\1\21",
|
||||
"",
|
||||
"",
|
||||
"\1\24",
|
||||
"\1\25",
|
||||
"\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"",
|
||||
"",
|
||||
"\0\27",
|
||||
"\0\27",
|
||||
"\1\30\4\uffff\1\31",
|
||||
"",
|
||||
"",
|
||||
"\1\33",
|
||||
"",
|
||||
"\1\34",
|
||||
"",
|
||||
"",
|
||||
"\1\35",
|
||||
"\1\36",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\37",
|
||||
"\1\40",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"\1\42",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"\1\44",
|
||||
"",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
"",
|
||||
"\1\46",
|
||||
"",
|
||||
"\1\47",
|
||||
"\12\20\7\uffff\32\20\4\uffff\1\20\1\uffff\32\20",
|
||||
""
|
||||
};
|
||||
|
||||
static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS);
|
||||
static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS);
|
||||
static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS);
|
||||
static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS);
|
||||
static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS);
|
||||
static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS);
|
||||
static final short[][] DFA12_transition;
|
||||
|
||||
static {
|
||||
int numStates = DFA12_transitionS.length;
|
||||
DFA12_transition = new short[numStates][];
|
||||
for (int i=0; i<numStates; i++) {
|
||||
DFA12_transition[i] = DFA.unpackEncodedString(DFA12_transitionS[i]);
|
||||
}
|
||||
}
|
||||
|
||||
class DFA12 extends DFA {
|
||||
|
||||
public DFA12(BaseRecognizer recognizer) {
|
||||
this.recognizer = recognizer;
|
||||
this.decisionNumber = 12;
|
||||
this.eot = DFA12_eot;
|
||||
this.eof = DFA12_eof;
|
||||
this.min = DFA12_min;
|
||||
this.max = DFA12_max;
|
||||
this.accept = DFA12_accept;
|
||||
this.special = DFA12_special;
|
||||
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 );";
|
||||
}
|
||||
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
|
||||
IntStream input = _input;
|
||||
int _s = s;
|
||||
switch ( s ) {
|
||||
case 0 :
|
||||
int LA12_10 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_10>='\u0000' && LA12_10<='\uFFFF')) ) {s = 23;}
|
||||
|
||||
else s = 14;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( (LA12_0=='t') ) {s = 1;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 2;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 3;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='i') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0=='b') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 7;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='s')||(LA12_0>='u' && LA12_0<='z')) ) {s = 8;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 9;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 12;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {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>='~' && LA12_0<='\uFFFF')) ) {s = 14;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_11 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_11>='\u0000' && LA12_11<='\uFFFF')) ) {s = 23;}
|
||||
|
||||
else s = 14;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
}
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException(getDescription(), 12, _s, input);
|
||||
error(nvae);
|
||||
throw nvae;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,469 @@
|
|||
package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal;
|
||||
|
||||
import org.eclipse.xtext.*;
|
||||
import org.eclipse.xtext.parser.*;
|
||||
import org.eclipse.xtext.parser.impl.*;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
|
||||
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
|
||||
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class InternalPartialContentAssistTestLanguageParser extends AbstractInternalAntlrParser {
|
||||
public static final String[] tokenNames = new String[] {
|
||||
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'type'", "'extends'", "'{'", "'}'", "'int'", "'bool'"
|
||||
};
|
||||
public static final int RULE_ID=4;
|
||||
public static final int RULE_WS=9;
|
||||
public static final int RULE_STRING=6;
|
||||
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__11=11;
|
||||
public static final int RULE_ML_COMMENT=7;
|
||||
public static final int T__12=12;
|
||||
public static final int T__13=13;
|
||||
public static final int T__14=14;
|
||||
public static final int EOF=-1;
|
||||
|
||||
// delegates
|
||||
// delegators
|
||||
|
||||
|
||||
public InternalPartialContentAssistTestLanguageParser(TokenStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalPartialContentAssistTestLanguageParser(TokenStream input, RecognizerSharedState state) {
|
||||
super(input, state);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String[] getTokenNames() { return InternalPartialContentAssistTestLanguageParser.tokenNames; }
|
||||
public String getGrammarFileName() { return "InternalPartialContentAssistTestLanguage.g"; }
|
||||
|
||||
|
||||
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public InternalPartialContentAssistTestLanguageParser(TokenStream input, PartialContentAssistTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "TypeDeclaration";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PartialContentAssistTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleTypeDeclaration"
|
||||
// InternalPartialContentAssistTestLanguage.g:68:1: entryRuleTypeDeclaration returns [EObject current=null] : iv_ruleTypeDeclaration= ruleTypeDeclaration EOF ;
|
||||
public final EObject entryRuleTypeDeclaration() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject iv_ruleTypeDeclaration = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalPartialContentAssistTestLanguage.g:68:56: (iv_ruleTypeDeclaration= ruleTypeDeclaration EOF )
|
||||
// InternalPartialContentAssistTestLanguage.g:69:2: iv_ruleTypeDeclaration= ruleTypeDeclaration EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getTypeDeclarationRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_ruleTypeDeclaration=ruleTypeDeclaration();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_ruleTypeDeclaration;
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRuleTypeDeclaration"
|
||||
|
||||
|
||||
// $ANTLR start "ruleTypeDeclaration"
|
||||
// InternalPartialContentAssistTestLanguage.g:75:1: ruleTypeDeclaration returns [EObject current=null] : (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' ) ;
|
||||
public final EObject ruleTypeDeclaration() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
Token otherlv_0=null;
|
||||
Token lv_name_1_0=null;
|
||||
Token otherlv_2=null;
|
||||
Token otherlv_3=null;
|
||||
Token otherlv_4=null;
|
||||
Token otherlv_6=null;
|
||||
EObject lv_properties_5_0 = null;
|
||||
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalPartialContentAssistTestLanguage.g:81:2: ( (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:82:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:82:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' )
|
||||
// InternalPartialContentAssistTestLanguage.g:83:3: otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}'
|
||||
{
|
||||
otherlv_0=(Token)match(input,11,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_0, grammarAccess.getTypeDeclarationAccess().getTypeKeyword_0());
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:87:3: ( (lv_name_1_0= RULE_ID ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:88:4: (lv_name_1_0= RULE_ID )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:88:4: (lv_name_1_0= RULE_ID )
|
||||
// InternalPartialContentAssistTestLanguage.g:89:5: lv_name_1_0= RULE_ID
|
||||
{
|
||||
lv_name_1_0=(Token)match(input,RULE_ID,FOLLOW_4);
|
||||
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getTypeDeclarationAccess().getNameIDTerminalRuleCall_1_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:105:3: (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0==12) ) {
|
||||
alt1=1;
|
||||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:106:4: otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) )
|
||||
{
|
||||
otherlv_2=(Token)match(input,12,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0());
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:110:4: ( (otherlv_3= RULE_ID ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:111:5: (otherlv_3= RULE_ID )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:111:5: (otherlv_3= RULE_ID )
|
||||
// InternalPartialContentAssistTestLanguage.g:112:6: otherlv_3= RULE_ID
|
||||
{
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
|
||||
otherlv_3=(Token)match(input,RULE_ID,FOLLOW_5);
|
||||
|
||||
newLeafNode(otherlv_3, grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
otherlv_4=(Token)match(input,13,FOLLOW_6);
|
||||
|
||||
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3());
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:128:3: ( (lv_properties_5_0= ruleProperty ) )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
int LA2_0 = input.LA(1);
|
||||
|
||||
if ( ((LA2_0>=15 && LA2_0<=16)) ) {
|
||||
alt2=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt2) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:129:4: (lv_properties_5_0= ruleProperty )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:129:4: (lv_properties_5_0= ruleProperty )
|
||||
// InternalPartialContentAssistTestLanguage.g:130:5: lv_properties_5_0= ruleProperty
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0());
|
||||
|
||||
pushFollow(FOLLOW_6);
|
||||
lv_properties_5_0=ruleProperty();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"properties",
|
||||
lv_properties_5_0,
|
||||
"org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage.Property");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop2;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
otherlv_6=(Token)match(input,14,FOLLOW_2);
|
||||
|
||||
newLeafNode(otherlv_6, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "ruleTypeDeclaration"
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleProperty"
|
||||
// InternalPartialContentAssistTestLanguage.g:155:1: entryRuleProperty returns [EObject current=null] : iv_ruleProperty= ruleProperty EOF ;
|
||||
public final EObject entryRuleProperty() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject iv_ruleProperty = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalPartialContentAssistTestLanguage.g:155:49: (iv_ruleProperty= ruleProperty EOF )
|
||||
// InternalPartialContentAssistTestLanguage.g:156:2: iv_ruleProperty= ruleProperty EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPropertyRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_ruleProperty=ruleProperty();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_ruleProperty;
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRuleProperty"
|
||||
|
||||
|
||||
// $ANTLR start "ruleProperty"
|
||||
// InternalPartialContentAssistTestLanguage.g:162:1: ruleProperty returns [EObject current=null] : ( ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) ) ( (lv_name_1_0= RULE_ID ) ) ) ;
|
||||
public final EObject ruleProperty() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
Token lv_type_0_1=null;
|
||||
Token lv_type_0_2=null;
|
||||
Token lv_name_1_0=null;
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalPartialContentAssistTestLanguage.g:168:2: ( ( ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) ) ( (lv_name_1_0= RULE_ID ) ) ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:169:2: ( ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) ) ( (lv_name_1_0= RULE_ID ) ) )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:169:2: ( ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) ) ( (lv_name_1_0= RULE_ID ) ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:170:3: ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) ) ( (lv_name_1_0= RULE_ID ) )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:170:3: ( ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:171:4: ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:171:4: ( (lv_type_0_1= 'int' | lv_type_0_2= 'bool' ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:172:5: (lv_type_0_1= 'int' | lv_type_0_2= 'bool' )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:172:5: (lv_type_0_1= 'int' | lv_type_0_2= 'bool' )
|
||||
int alt3=2;
|
||||
int LA3_0 = input.LA(1);
|
||||
|
||||
if ( (LA3_0==15) ) {
|
||||
alt3=1;
|
||||
}
|
||||
else if ( (LA3_0==16) ) {
|
||||
alt3=2;
|
||||
}
|
||||
else {
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException("", 3, 0, input);
|
||||
|
||||
throw nvae;
|
||||
}
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalPartialContentAssistTestLanguage.g:173:6: lv_type_0_1= 'int'
|
||||
{
|
||||
lv_type_0_1=(Token)match(input,15,FOLLOW_3);
|
||||
|
||||
newLeafNode(lv_type_0_1, grammarAccess.getPropertyAccess().getTypeIntKeyword_0_0_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed(current, "type", lv_type_0_1, null);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalPartialContentAssistTestLanguage.g:184:6: lv_type_0_2= 'bool'
|
||||
{
|
||||
lv_type_0_2=(Token)match(input,16,FOLLOW_3);
|
||||
|
||||
newLeafNode(lv_type_0_2, grammarAccess.getPropertyAccess().getTypeBoolKeyword_0_0_1());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed(current, "type", lv_type_0_2, null);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// InternalPartialContentAssistTestLanguage.g:197:3: ( (lv_name_1_0= RULE_ID ) )
|
||||
// InternalPartialContentAssistTestLanguage.g:198:4: (lv_name_1_0= RULE_ID )
|
||||
{
|
||||
// InternalPartialContentAssistTestLanguage.g:198:4: (lv_name_1_0= RULE_ID )
|
||||
// InternalPartialContentAssistTestLanguage.g:199:5: lv_name_1_0= RULE_ID
|
||||
{
|
||||
lv_name_1_0=(Token)match(input,RULE_ID,FOLLOW_2);
|
||||
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_1_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getPropertyRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "ruleProperty"
|
||||
|
||||
// Delegated rules
|
||||
|
||||
|
||||
|
||||
|
||||
public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L});
|
||||
public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L});
|
||||
public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000010L});
|
||||
public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000003000L});
|
||||
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000002000L});
|
||||
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x000000000001C000L});
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage;
|
||||
|
||||
import org.eclipse.emf.ecore.EFactory;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Factory</b> for the model.
|
||||
* It provides a create method for each non-abstract class of the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage
|
||||
* @generated
|
||||
*/
|
||||
public interface PartialContentAssistTestLanguageFactory extends EFactory
|
||||
{
|
||||
/**
|
||||
* The singleton instance of the factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
PartialContentAssistTestLanguageFactory eINSTANCE = org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguageFactoryImpl.init();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Type Declaration</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Type Declaration</em>'.
|
||||
* @generated
|
||||
*/
|
||||
TypeDeclaration createTypeDeclaration();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Property</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Property</em>'.
|
||||
* @generated
|
||||
*/
|
||||
Property createProperty();
|
||||
|
||||
/**
|
||||
* Returns the package supported by this factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the package supported by this factory.
|
||||
* @generated
|
||||
*/
|
||||
PartialContentAssistTestLanguagePackage getPartialContentAssistTestLanguagePackage();
|
||||
|
||||
} //PartialContentAssistTestLanguageFactory
|
|
@ -0,0 +1,308 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage;
|
||||
|
||||
import org.eclipse.emf.ecore.EAttribute;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Package</b> for the model.
|
||||
* It contains accessors for the meta objects to represent
|
||||
* <ul>
|
||||
* <li>each class,</li>
|
||||
* <li>each feature of each class,</li>
|
||||
* <li>each enum,</li>
|
||||
* <li>and each data type</li>
|
||||
* </ul>
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguageFactory
|
||||
* @model kind="package"
|
||||
* @generated
|
||||
*/
|
||||
public interface PartialContentAssistTestLanguagePackage extends EPackage
|
||||
{
|
||||
/**
|
||||
* The package name.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNAME = "partialContentAssistTestLanguage";
|
||||
|
||||
/**
|
||||
* The package namespace URI.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNS_URI = "http://www.eclipse.org/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage";
|
||||
|
||||
/**
|
||||
* The package namespace name.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNS_PREFIX = "partialContentAssistTestLanguage";
|
||||
|
||||
/**
|
||||
* The singleton instance of the package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
PartialContentAssistTestLanguagePackage eINSTANCE = org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguagePackageImpl.init();
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl <em>Type Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguagePackageImpl#getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
int TYPE_DECLARATION = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__NAME = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Super Type</b></em>' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__SUPER_TYPE = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Properties</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__PROPERTIES = 2;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Type Declaration</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION_FEATURE_COUNT = 3;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl <em>Property</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguagePackageImpl#getProperty()
|
||||
* @generated
|
||||
*/
|
||||
int PROPERTY = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Type</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROPERTY__TYPE = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROPERTY__NAME = 1;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Property</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROPERTY_FEATURE_COUNT = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration <em>Type Declaration</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Type Declaration</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration
|
||||
* @generated
|
||||
*/
|
||||
EClass getTypeDeclaration();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getName()
|
||||
* @see #getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getTypeDeclaration_Name();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the reference '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the reference '<em>Super Type</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getSuperType()
|
||||
* @see #getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EReference getTypeDeclaration_SuperType();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getProperties <em>Properties</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Properties</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getProperties()
|
||||
* @see #getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EReference getTypeDeclaration_Properties();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property <em>Property</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Property</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property
|
||||
* @generated
|
||||
*/
|
||||
EClass getProperty();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getType <em>Type</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Type</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getType()
|
||||
* @see #getProperty()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getProperty_Type();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getName()
|
||||
* @see #getProperty()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getProperty_Name();
|
||||
|
||||
/**
|
||||
* Returns the factory that creates the instances of the model.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the factory that creates the instances of the model.
|
||||
* @generated
|
||||
*/
|
||||
PartialContentAssistTestLanguageFactory getPartialContentAssistTestLanguageFactory();
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* Defines literals for the meta objects that represent
|
||||
* <ul>
|
||||
* <li>each class,</li>
|
||||
* <li>each feature of each class,</li>
|
||||
* <li>each enum,</li>
|
||||
* <li>and each data type</li>
|
||||
* </ul>
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
interface Literals
|
||||
{
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl <em>Type Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguagePackageImpl#getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EClass TYPE_DECLARATION = eINSTANCE.getTypeDeclaration();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute TYPE_DECLARATION__NAME = eINSTANCE.getTypeDeclaration_Name();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Super Type</b></em>' reference feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference TYPE_DECLARATION__SUPER_TYPE = eINSTANCE.getTypeDeclaration_SuperType();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Properties</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference TYPE_DECLARATION__PROPERTIES = eINSTANCE.getTypeDeclaration_Properties();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl <em>Property</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PartialContentAssistTestLanguagePackageImpl#getProperty()
|
||||
* @generated
|
||||
*/
|
||||
EClass PROPERTY = eINSTANCE.getProperty();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Type</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute PROPERTY__TYPE = eINSTANCE.getProperty_Type();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute PROPERTY__NAME = eINSTANCE.getProperty_Name();
|
||||
|
||||
}
|
||||
|
||||
} //PartialContentAssistTestLanguagePackage
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Property</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getType <em>Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getName <em>Name</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getProperty()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface Property extends EObject
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Type</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Type</em>' attribute isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Type</em>' attribute.
|
||||
* @see #setType(String)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getProperty_Type()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getType();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getType <em>Type</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Type</em>' attribute.
|
||||
* @see #getType()
|
||||
* @generated
|
||||
*/
|
||||
void setType(String value);
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Name</em>' attribute isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Name</em>' attribute.
|
||||
* @see #setName(String)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getProperty_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property#getName <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Name</em>' attribute.
|
||||
* @see #getName()
|
||||
* @generated
|
||||
*/
|
||||
void setName(String value);
|
||||
|
||||
} // Property
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Type Declaration</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getProperties <em>Properties</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getTypeDeclaration()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface TypeDeclaration extends EObject
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Name</em>' attribute isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Name</em>' attribute.
|
||||
* @see #setName(String)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getTypeDeclaration_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getName <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Name</em>' attribute.
|
||||
* @see #getName()
|
||||
* @generated
|
||||
*/
|
||||
void setName(String value);
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Super Type</b></em>' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Super Type</em>' reference isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Super Type</em>' reference.
|
||||
* @see #setSuperType(TypeDeclaration)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getTypeDeclaration_SuperType()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
TypeDeclaration getSuperType();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Super Type</em>' reference.
|
||||
* @see #getSuperType()
|
||||
* @generated
|
||||
*/
|
||||
void setSuperType(TypeDeclaration value);
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Properties</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Properties</em>' containment reference list isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Properties</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#getTypeDeclaration_Properties()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<Property> getProperties();
|
||||
|
||||
} // TypeDeclaration
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.EFactoryImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.plugin.EcorePlugin;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.*;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Factory</b>.
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public class PartialContentAssistTestLanguageFactoryImpl extends EFactoryImpl implements PartialContentAssistTestLanguageFactory
|
||||
{
|
||||
/**
|
||||
* Creates the default factory implementation.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public static PartialContentAssistTestLanguageFactory init()
|
||||
{
|
||||
try
|
||||
{
|
||||
PartialContentAssistTestLanguageFactory thePartialContentAssistTestLanguageFactory = (PartialContentAssistTestLanguageFactory)EPackage.Registry.INSTANCE.getEFactory(PartialContentAssistTestLanguagePackage.eNS_URI);
|
||||
if (thePartialContentAssistTestLanguageFactory != null)
|
||||
{
|
||||
return thePartialContentAssistTestLanguageFactory;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
EcorePlugin.INSTANCE.log(exception);
|
||||
}
|
||||
return new PartialContentAssistTestLanguageFactoryImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PartialContentAssistTestLanguageFactoryImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public EObject create(EClass eClass)
|
||||
{
|
||||
switch (eClass.getClassifierID())
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION: return createTypeDeclaration();
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY: return createProperty();
|
||||
default:
|
||||
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public TypeDeclaration createTypeDeclaration()
|
||||
{
|
||||
TypeDeclarationImpl typeDeclaration = new TypeDeclarationImpl();
|
||||
return typeDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Property createProperty()
|
||||
{
|
||||
PropertyImpl property = new PropertyImpl();
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PartialContentAssistTestLanguagePackage getPartialContentAssistTestLanguagePackage()
|
||||
{
|
||||
return (PartialContentAssistTestLanguagePackage)getEPackage();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @deprecated
|
||||
* @generated
|
||||
*/
|
||||
@Deprecated
|
||||
public static PartialContentAssistTestLanguagePackage getPackage()
|
||||
{
|
||||
return PartialContentAssistTestLanguagePackage.eINSTANCE;
|
||||
}
|
||||
|
||||
} //PartialContentAssistTestLanguageFactoryImpl
|
|
@ -0,0 +1,261 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl;
|
||||
|
||||
import org.eclipse.emf.ecore.EAttribute;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.EPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguageFactory;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Package</b>.
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public class PartialContentAssistTestLanguagePackageImpl extends EPackageImpl implements PartialContentAssistTestLanguagePackage
|
||||
{
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass typeDeclarationEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass propertyEClass = null;
|
||||
|
||||
/**
|
||||
* Creates an instance of the model <b>Package</b>, registered with
|
||||
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
|
||||
* package URI value.
|
||||
* <p>Note: the correct way to create the package is via the static
|
||||
* factory method {@link #init init()}, which also performs
|
||||
* initialization of the package, or returns the registered package,
|
||||
* if one already exists.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.emf.ecore.EPackage.Registry
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage#eNS_URI
|
||||
* @see #init()
|
||||
* @generated
|
||||
*/
|
||||
private PartialContentAssistTestLanguagePackageImpl()
|
||||
{
|
||||
super(eNS_URI, PartialContentAssistTestLanguageFactory.eINSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private static boolean isInited = false;
|
||||
|
||||
/**
|
||||
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
|
||||
*
|
||||
* <p>This method is used to initialize {@link PartialContentAssistTestLanguagePackage#eINSTANCE} when that field is accessed.
|
||||
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #eNS_URI
|
||||
* @see #createPackageContents()
|
||||
* @see #initializePackageContents()
|
||||
* @generated
|
||||
*/
|
||||
public static PartialContentAssistTestLanguagePackage init()
|
||||
{
|
||||
if (isInited) return (PartialContentAssistTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(PartialContentAssistTestLanguagePackage.eNS_URI);
|
||||
|
||||
// Obtain or create and register package
|
||||
PartialContentAssistTestLanguagePackageImpl thePartialContentAssistTestLanguagePackage = (PartialContentAssistTestLanguagePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PartialContentAssistTestLanguagePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PartialContentAssistTestLanguagePackageImpl());
|
||||
|
||||
isInited = true;
|
||||
|
||||
// Create package meta-data objects
|
||||
thePartialContentAssistTestLanguagePackage.createPackageContents();
|
||||
|
||||
// Initialize created meta-data
|
||||
thePartialContentAssistTestLanguagePackage.initializePackageContents();
|
||||
|
||||
// Mark meta-data to indicate it can't be changed
|
||||
thePartialContentAssistTestLanguagePackage.freeze();
|
||||
|
||||
|
||||
// Update the registry and return the package
|
||||
EPackage.Registry.INSTANCE.put(PartialContentAssistTestLanguagePackage.eNS_URI, thePartialContentAssistTestLanguagePackage);
|
||||
return thePartialContentAssistTestLanguagePackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getTypeDeclaration()
|
||||
{
|
||||
return typeDeclarationEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getTypeDeclaration_Name()
|
||||
{
|
||||
return (EAttribute)typeDeclarationEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getTypeDeclaration_SuperType()
|
||||
{
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getTypeDeclaration_Properties()
|
||||
{
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getProperty()
|
||||
{
|
||||
return propertyEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getProperty_Type()
|
||||
{
|
||||
return (EAttribute)propertyEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getProperty_Name()
|
||||
{
|
||||
return (EAttribute)propertyEClass.getEStructuralFeatures().get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PartialContentAssistTestLanguageFactory getPartialContentAssistTestLanguageFactory()
|
||||
{
|
||||
return (PartialContentAssistTestLanguageFactory)getEFactoryInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private boolean isCreated = false;
|
||||
|
||||
/**
|
||||
* Creates the meta-model objects for the package. This method is
|
||||
* guarded to have no affect on any invocation but its first.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void createPackageContents()
|
||||
{
|
||||
if (isCreated) return;
|
||||
isCreated = true;
|
||||
|
||||
// Create classes and their features
|
||||
typeDeclarationEClass = createEClass(TYPE_DECLARATION);
|
||||
createEAttribute(typeDeclarationEClass, TYPE_DECLARATION__NAME);
|
||||
createEReference(typeDeclarationEClass, TYPE_DECLARATION__SUPER_TYPE);
|
||||
createEReference(typeDeclarationEClass, TYPE_DECLARATION__PROPERTIES);
|
||||
|
||||
propertyEClass = createEClass(PROPERTY);
|
||||
createEAttribute(propertyEClass, PROPERTY__TYPE);
|
||||
createEAttribute(propertyEClass, PROPERTY__NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private boolean isInitialized = false;
|
||||
|
||||
/**
|
||||
* Complete the initialization of the package and its meta-model. This
|
||||
* method is guarded to have no affect on any invocation but its first.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void initializePackageContents()
|
||||
{
|
||||
if (isInitialized) return;
|
||||
isInitialized = true;
|
||||
|
||||
// Initialize package
|
||||
setName(eNAME);
|
||||
setNsPrefix(eNS_PREFIX);
|
||||
setNsURI(eNS_URI);
|
||||
|
||||
// Create type parameters
|
||||
|
||||
// Set bounds for type parameters
|
||||
|
||||
// Add supertypes to classes
|
||||
|
||||
// Initialize classes and features; add operations and parameters
|
||||
initEClass(typeDeclarationEClass, TypeDeclaration.class, "TypeDeclaration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getTypeDeclaration_Name(), ecorePackage.getEString(), "name", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getTypeDeclaration_SuperType(), this.getTypeDeclaration(), null, "superType", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getTypeDeclaration_Properties(), this.getProperty(), null, "properties", null, 0, -1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(propertyEClass, Property.class, "Property", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getProperty_Type(), ecorePackage.getEString(), "type", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEAttribute(getProperty_Name(), ecorePackage.getEString(), "name", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
// Create resource
|
||||
createResource(eNS_URI);
|
||||
}
|
||||
|
||||
} //PartialContentAssistTestLanguagePackageImpl
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.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.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Property</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl#getType <em>Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.PropertyImpl#getName <em>Name</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class PropertyImpl extends MinimalEObjectImpl.Container implements Property
|
||||
{
|
||||
/**
|
||||
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getType()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final String TYPE_EDEFAULT = null;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getType()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected String type = TYPE_EDEFAULT;
|
||||
|
||||
/**
|
||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final String NAME_EDEFAULT = null;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected String name = NAME_EDEFAULT;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected PropertyImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return PartialContentAssistTestLanguagePackage.Literals.PROPERTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setType(String newType)
|
||||
{
|
||||
String oldType = type;
|
||||
type = newType;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PartialContentAssistTestLanguagePackage.PROPERTY__TYPE, oldType, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setName(String newName)
|
||||
{
|
||||
String oldName = name;
|
||||
name = newName;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PartialContentAssistTestLanguagePackage.PROPERTY__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public Object eGet(int featureID, boolean resolve, boolean coreType)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__TYPE:
|
||||
return getType();
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__NAME:
|
||||
return getName();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eSet(int featureID, Object newValue)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__TYPE:
|
||||
setType((String)newValue);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__TYPE:
|
||||
setType(TYPE_EDEFAULT);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__TYPE:
|
||||
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (eIsProxy()) return super.toString();
|
||||
|
||||
StringBuffer result = new StringBuffer(super.toString());
|
||||
result.append(" (type: ");
|
||||
result.append(type);
|
||||
result.append(", name: ");
|
||||
result.append(name);
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
} //PropertyImpl
|
|
@ -0,0 +1,310 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
import org.eclipse.emf.common.notify.NotificationChain;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.InternalEObject;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Type Declaration</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl#getSuperType <em>Super Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.impl.TypeDeclarationImpl#getProperties <em>Properties</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements TypeDeclaration
|
||||
{
|
||||
/**
|
||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final String NAME_EDEFAULT = null;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected String name = NAME_EDEFAULT;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getSuperType() <em>Super Type</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getSuperType()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected TypeDeclaration superType;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getProperties()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<Property> properties;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected TypeDeclarationImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return PartialContentAssistTestLanguagePackage.Literals.TYPE_DECLARATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setName(String newName)
|
||||
{
|
||||
String oldName = name;
|
||||
name = newName;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public TypeDeclaration getSuperType()
|
||||
{
|
||||
if (superType != null && superType.eIsProxy())
|
||||
{
|
||||
InternalEObject oldSuperType = (InternalEObject)superType;
|
||||
superType = (TypeDeclaration)eResolveProxy(oldSuperType);
|
||||
if (superType != oldSuperType)
|
||||
{
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE, oldSuperType, superType));
|
||||
}
|
||||
}
|
||||
return superType;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public TypeDeclaration basicGetSuperType()
|
||||
{
|
||||
return superType;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setSuperType(TypeDeclaration newSuperType)
|
||||
{
|
||||
TypeDeclaration oldSuperType = superType;
|
||||
superType = newSuperType;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE, oldSuperType, superType));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<Property> getProperties()
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new EObjectContainmentEList<Property>(Property.class, this, PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
|
||||
return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, 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 PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
return getName();
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
if (resolve) return getSuperType();
|
||||
return basicGetSuperType();
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
|
||||
return getProperties();
|
||||
}
|
||||
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 PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
setSuperType((TypeDeclaration)newValue);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
|
||||
getProperties().clear();
|
||||
getProperties().addAll((Collection<? extends Property>)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
setSuperType((TypeDeclaration)null);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
|
||||
getProperties().clear();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
return superType != null;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
|
||||
return properties != null && !properties.isEmpty();
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (eIsProxy()) return super.toString();
|
||||
|
||||
StringBuffer result = new StringBuffer(super.toString());
|
||||
result.append(" (name: ");
|
||||
result.append(name);
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
} //TypeDeclarationImpl
|
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.util;
|
||||
|
||||
import org.eclipse.emf.common.notify.Adapter;
|
||||
import org.eclipse.emf.common.notify.Notifier;
|
||||
|
||||
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.*;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Adapter Factory</b> for the model.
|
||||
* It provides an adapter <code>createXXX</code> method for each class of the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage
|
||||
* @generated
|
||||
*/
|
||||
public class PartialContentAssistTestLanguageAdapterFactory extends AdapterFactoryImpl
|
||||
{
|
||||
/**
|
||||
* The cached model package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static PartialContentAssistTestLanguagePackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the adapter factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PartialContentAssistTestLanguageAdapterFactory()
|
||||
{
|
||||
if (modelPackage == null)
|
||||
{
|
||||
modelPackage = PartialContentAssistTestLanguagePackage.eINSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this factory is applicable for the type of the object.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @return whether this factory is applicable for the type of the object.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean isFactoryForType(Object object)
|
||||
{
|
||||
if (object == modelPackage)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (object instanceof EObject)
|
||||
{
|
||||
return ((EObject)object).eClass().getEPackage() == modelPackage;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The switch that delegates to the <code>createXXX</code> methods.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected PartialContentAssistTestLanguageSwitch<Adapter> modelSwitch =
|
||||
new PartialContentAssistTestLanguageSwitch<Adapter>()
|
||||
{
|
||||
@Override
|
||||
public Adapter caseTypeDeclaration(TypeDeclaration object)
|
||||
{
|
||||
return createTypeDeclarationAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseProperty(Property object)
|
||||
{
|
||||
return createPropertyAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter defaultCase(EObject object)
|
||||
{
|
||||
return createEObjectAdapter();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an adapter for the <code>target</code>.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param target the object to adapt.
|
||||
* @return the adapter for the <code>target</code>.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public Adapter createAdapter(Notifier target)
|
||||
{
|
||||
return modelSwitch.doSwitch((EObject)target);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration <em>Type Declaration</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.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createTypeDeclarationAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property <em>Property</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.ide.tests.testlanguage.partialContentAssistTestLanguage.Property
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createPropertyAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for the default case.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createEObjectAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
} //PartialContentAssistTestLanguageAdapterFactory
|
|
@ -0,0 +1,147 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.util;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
|
||||
import org.eclipse.emf.ecore.util.Switch;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.*;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Switch</b> for the model's inheritance hierarchy.
|
||||
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
|
||||
* to invoke the <code>caseXXX</code> method for each class of the model,
|
||||
* starting with the actual class of the object
|
||||
* and proceeding up the inheritance hierarchy
|
||||
* until a non-null result is returned,
|
||||
* which is the result of the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage
|
||||
* @generated
|
||||
*/
|
||||
public class PartialContentAssistTestLanguageSwitch<T> extends Switch<T>
|
||||
{
|
||||
/**
|
||||
* The cached model package
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static PartialContentAssistTestLanguagePackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the switch.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PartialContentAssistTestLanguageSwitch()
|
||||
{
|
||||
if (modelPackage == null)
|
||||
{
|
||||
modelPackage = PartialContentAssistTestLanguagePackage.eINSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this is a switch for the given package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param ePackage the package in question.
|
||||
* @return whether this is a switch for the given package.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected boolean isSwitchFor(EPackage ePackage)
|
||||
{
|
||||
return ePackage == modelPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Override
|
||||
protected T doSwitch(int classifierID, EObject theEObject)
|
||||
{
|
||||
switch (classifierID)
|
||||
{
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION:
|
||||
{
|
||||
TypeDeclaration typeDeclaration = (TypeDeclaration)theEObject;
|
||||
T result = caseTypeDeclaration(typeDeclaration);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY:
|
||||
{
|
||||
Property property = (Property)theEObject;
|
||||
T result = caseProperty(property);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
default: return defaultCase(theEObject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Type Declaration</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>Type Declaration</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseTypeDeclaration(TypeDeclaration object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Property</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>Property</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseProperty(Property object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch, but this is the last case anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public T defaultCase(EObject object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
} //PartialContentAssistTestLanguageSwitch
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.scoping;
|
||||
|
||||
import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider;
|
||||
|
||||
public abstract class AbstractPartialContentAssistTestLanguageScopeProvider extends DelegatingScopeProvider {
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.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.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.TypeDeclaration;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.serializer.ISerializationContext;
|
||||
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageSemanticSequencer extends AbstractDelegatingSemanticSequencer {
|
||||
|
||||
@Inject
|
||||
private PartialContentAssistTestLanguageGrammarAccess 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 == PartialContentAssistTestLanguagePackage.eINSTANCE)
|
||||
switch (semanticObject.eClass().getClassifierID()) {
|
||||
case PartialContentAssistTestLanguagePackage.PROPERTY:
|
||||
sequence_Property(context, (Property) semanticObject);
|
||||
return;
|
||||
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION:
|
||||
sequence_TypeDeclaration(context, (TypeDeclaration) semanticObject);
|
||||
return;
|
||||
}
|
||||
if (errorAcceptor != null)
|
||||
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Property returns Property
|
||||
*
|
||||
* Constraint:
|
||||
* ((type='int' | type='bool') name=ID)
|
||||
*/
|
||||
protected void sequence_Property(ISerializationContext context, Property semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* TypeDeclaration returns TypeDeclaration
|
||||
*
|
||||
* Constraint:
|
||||
* (name=ID superType=[TypeDeclaration|ID]? properties+=Property*)
|
||||
*/
|
||||
protected void sequence_TypeDeclaration(ISerializationContext context, TypeDeclaration semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.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.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
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 PartialContentAssistTestLanguageSyntacticSequencer extends AbstractSyntacticSequencer {
|
||||
|
||||
protected PartialContentAssistTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Inject
|
||||
protected void init(IGrammarAccess access) {
|
||||
grammarAccess = (PartialContentAssistTestLanguageGrammarAccess) 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,235 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.services;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
import org.eclipse.xtext.Alternatives;
|
||||
import org.eclipse.xtext.Assignment;
|
||||
import org.eclipse.xtext.CrossReference;
|
||||
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 PartialContentAssistTestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
||||
|
||||
public class TypeDeclarationElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage.TypeDeclaration");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final Keyword cTypeKeyword_0 = (Keyword)cGroup.eContents().get(0);
|
||||
private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1);
|
||||
private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0);
|
||||
private final Group cGroup_2 = (Group)cGroup.eContents().get(2);
|
||||
private final Keyword cExtendsKeyword_2_0 = (Keyword)cGroup_2.eContents().get(0);
|
||||
private final Assignment cSuperTypeAssignment_2_1 = (Assignment)cGroup_2.eContents().get(1);
|
||||
private final CrossReference cSuperTypeTypeDeclarationCrossReference_2_1_0 = (CrossReference)cSuperTypeAssignment_2_1.eContents().get(0);
|
||||
private final RuleCall cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1 = (RuleCall)cSuperTypeTypeDeclarationCrossReference_2_1_0.eContents().get(1);
|
||||
private final Keyword cLeftCurlyBracketKeyword_3 = (Keyword)cGroup.eContents().get(3);
|
||||
private final Assignment cPropertiesAssignment_4 = (Assignment)cGroup.eContents().get(4);
|
||||
private final RuleCall cPropertiesPropertyParserRuleCall_4_0 = (RuleCall)cPropertiesAssignment_4.eContents().get(0);
|
||||
private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
|
||||
|
||||
//TypeDeclaration:
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
// properties+=Property*
|
||||
// '}';
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'type' name=ID ('extends' superType=[TypeDeclaration])? '{' properties+=Property* '}'
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//'type'
|
||||
public Keyword getTypeKeyword_0() { return cTypeKeyword_0; }
|
||||
|
||||
//name=ID
|
||||
public Assignment getNameAssignment_1() { return cNameAssignment_1; }
|
||||
|
||||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
|
||||
|
||||
//('extends' superType=[TypeDeclaration])?
|
||||
public Group getGroup_2() { return cGroup_2; }
|
||||
|
||||
//'extends'
|
||||
public Keyword getExtendsKeyword_2_0() { return cExtendsKeyword_2_0; }
|
||||
|
||||
//superType=[TypeDeclaration]
|
||||
public Assignment getSuperTypeAssignment_2_1() { return cSuperTypeAssignment_2_1; }
|
||||
|
||||
//[TypeDeclaration]
|
||||
public CrossReference getSuperTypeTypeDeclarationCrossReference_2_1_0() { return cSuperTypeTypeDeclarationCrossReference_2_1_0; }
|
||||
|
||||
//ID
|
||||
public RuleCall getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1() { return cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1; }
|
||||
|
||||
//'{'
|
||||
public Keyword getLeftCurlyBracketKeyword_3() { return cLeftCurlyBracketKeyword_3; }
|
||||
|
||||
//properties+=Property*
|
||||
public Assignment getPropertiesAssignment_4() { return cPropertiesAssignment_4; }
|
||||
|
||||
//Property
|
||||
public RuleCall getPropertiesPropertyParserRuleCall_4_0() { return cPropertiesPropertyParserRuleCall_4_0; }
|
||||
|
||||
//'}'
|
||||
public Keyword getRightCurlyBracketKeyword_5() { return cRightCurlyBracketKeyword_5; }
|
||||
}
|
||||
public class PropertyElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage.Property");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final Assignment cTypeAssignment_0 = (Assignment)cGroup.eContents().get(0);
|
||||
private final Alternatives cTypeAlternatives_0_0 = (Alternatives)cTypeAssignment_0.eContents().get(0);
|
||||
private final Keyword cTypeIntKeyword_0_0_0 = (Keyword)cTypeAlternatives_0_0.eContents().get(0);
|
||||
private final Keyword cTypeBoolKeyword_0_0_1 = (Keyword)cTypeAlternatives_0_0.eContents().get(1);
|
||||
private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1);
|
||||
private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0);
|
||||
|
||||
//Property:
|
||||
// type=("int" | "bool") name=ID;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//type=("int" | "bool") name=ID
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//type=("int" | "bool")
|
||||
public Assignment getTypeAssignment_0() { return cTypeAssignment_0; }
|
||||
|
||||
//("int" | "bool")
|
||||
public Alternatives getTypeAlternatives_0_0() { return cTypeAlternatives_0_0; }
|
||||
|
||||
//"int"
|
||||
public Keyword getTypeIntKeyword_0_0_0() { return cTypeIntKeyword_0_0_0; }
|
||||
|
||||
//"bool"
|
||||
public Keyword getTypeBoolKeyword_0_0_1() { return cTypeBoolKeyword_0_0_1; }
|
||||
|
||||
//name=ID
|
||||
public Assignment getNameAssignment_1() { return cNameAssignment_1; }
|
||||
|
||||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
|
||||
}
|
||||
|
||||
|
||||
private final TypeDeclarationElements pTypeDeclaration;
|
||||
private final PropertyElements pProperty;
|
||||
|
||||
private final Grammar grammar;
|
||||
|
||||
private final TerminalsGrammarAccess gaTerminals;
|
||||
|
||||
@Inject
|
||||
public PartialContentAssistTestLanguageGrammarAccess(GrammarProvider grammarProvider,
|
||||
TerminalsGrammarAccess gaTerminals) {
|
||||
this.grammar = internalFindGrammar(grammarProvider);
|
||||
this.gaTerminals = gaTerminals;
|
||||
this.pTypeDeclaration = new TypeDeclarationElements();
|
||||
this.pProperty = new PropertyElements();
|
||||
}
|
||||
|
||||
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
|
||||
Grammar grammar = grammarProvider.getGrammar(this);
|
||||
while (grammar != null) {
|
||||
if ("org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage".equals(grammar.getName())) {
|
||||
return grammar;
|
||||
}
|
||||
List<Grammar> grammars = grammar.getUsedGrammars();
|
||||
if (!grammars.isEmpty()) {
|
||||
grammar = grammars.iterator().next();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return grammar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Grammar getGrammar() {
|
||||
return grammar;
|
||||
}
|
||||
|
||||
|
||||
public TerminalsGrammarAccess getTerminalsGrammarAccess() {
|
||||
return gaTerminals;
|
||||
}
|
||||
|
||||
|
||||
//TypeDeclaration:
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
// properties+=Property*
|
||||
// '}';
|
||||
public TypeDeclarationElements getTypeDeclarationAccess() {
|
||||
return pTypeDeclaration;
|
||||
}
|
||||
|
||||
public ParserRule getTypeDeclarationRule() {
|
||||
return getTypeDeclarationAccess().getRule();
|
||||
}
|
||||
|
||||
//Property:
|
||||
// type=("int" | "bool") name=ID;
|
||||
public PropertyElements getPropertyAccess() {
|
||||
return pProperty;
|
||||
}
|
||||
|
||||
public ParserRule getPropertyRule() {
|
||||
return getPropertyAccess().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();
|
||||
}
|
||||
}
|
|
@ -350,7 +350,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
}
|
||||
|
||||
//terminal ML_COMMENT:
|
||||
// '/ *'->'* /';
|
||||
// '/*'->'*/';
|
||||
public TerminalRule getML_COMMENTRule() {
|
||||
return gaTerminals.getML_COMMENTRule();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.tests;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testing.GlobalRegistries;
|
||||
import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento;
|
||||
import org.eclipse.xtext.testing.IInjectorProvider;
|
||||
import org.eclipse.xtext.testing.IRegistryConfigurator;
|
||||
|
||||
public class PartialContentAssistTestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator {
|
||||
|
||||
protected GlobalStateMemento stateBeforeInjectorCreation;
|
||||
protected GlobalStateMemento stateAfterInjectorCreation;
|
||||
protected Injector injector;
|
||||
|
||||
static {
|
||||
GlobalRegistries.initializeDefaults();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Injector getInjector() {
|
||||
if (injector == null) {
|
||||
stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
|
||||
this.injector = internalCreateInjector();
|
||||
stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
|
||||
}
|
||||
return injector;
|
||||
}
|
||||
|
||||
protected Injector internalCreateInjector() {
|
||||
return new PartialContentAssistTestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(createRuntimeModule());
|
||||
}
|
||||
}.createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
|
||||
protected PartialContentAssistTestLanguageRuntimeModule createRuntimeModule() {
|
||||
// make it work also with Maven/Tycho and OSGI
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672
|
||||
return new PartialContentAssistTestLanguageRuntimeModule() {
|
||||
@Override
|
||||
public ClassLoader bindClassLoaderToInstance() {
|
||||
return PartialContentAssistTestLanguageInjectorProvider.class
|
||||
.getClassLoader();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreRegistry() {
|
||||
stateBeforeInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRegistry() {
|
||||
getInjector();
|
||||
stateAfterInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.tests;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testing.GlobalRegistries;
|
||||
import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento;
|
||||
import org.eclipse.xtext.testing.IInjectorProvider;
|
||||
import org.eclipse.xtext.testing.IRegistryConfigurator;
|
||||
|
||||
public class TestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator {
|
||||
|
||||
protected GlobalStateMemento stateBeforeInjectorCreation;
|
||||
protected GlobalStateMemento stateAfterInjectorCreation;
|
||||
protected Injector injector;
|
||||
|
||||
static {
|
||||
GlobalRegistries.initializeDefaults();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Injector getInjector() {
|
||||
if (injector == null) {
|
||||
stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
|
||||
this.injector = internalCreateInjector();
|
||||
stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
|
||||
}
|
||||
return injector;
|
||||
}
|
||||
|
||||
protected Injector internalCreateInjector() {
|
||||
return new TestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(createRuntimeModule());
|
||||
}
|
||||
}.createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
|
||||
protected TestLanguageRuntimeModule createRuntimeModule() {
|
||||
// make it work also with Maven/Tycho and OSGI
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672
|
||||
return new TestLanguageRuntimeModule() {
|
||||
@Override
|
||||
public ClassLoader bindClassLoaderToInstance() {
|
||||
return TestLanguageInjectorProvider.class
|
||||
.getClassLoader();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreRegistry() {
|
||||
stateBeforeInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRegistry() {
|
||||
getInjector();
|
||||
stateAfterInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.validation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
|
||||
|
||||
public abstract class AbstractPartialContentAssistTestLanguageValidator extends AbstractDeclarativeValidator {
|
||||
|
||||
@Override
|
||||
protected List<EPackage> getEPackages() {
|
||||
List<EPackage> result = new ArrayList<EPackage>();
|
||||
result.add(org.eclipse.xtext.ide.tests.testlanguage.partialContentAssistTestLanguage.PartialContentAssistTestLanguagePackage.eINSTANCE);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,13 +20,19 @@ Workflow {
|
|||
project = StandardProjectConfig {
|
||||
baseName = baseName
|
||||
rootPath = rootPath
|
||||
genericIde = {
|
||||
enabled = true
|
||||
runtime = {
|
||||
src = "${rootPath}/${baseName}/testlang-src"
|
||||
srcGen = "${rootPath}/${baseName}/testlang-src-gen"
|
||||
name = baseName
|
||||
}
|
||||
runtime = {
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
name = baseName
|
||||
src = "${rootPath}/${baseName}/testlang-src"
|
||||
srcGen = "${rootPath}/${baseName}/testlang-src-gen"
|
||||
}
|
||||
genericIde = {
|
||||
enabled = true
|
||||
name = baseName
|
||||
src = "${rootPath}/${baseName}/testlang-src"
|
||||
srcGen = "${rootPath}/${baseName}/testlang-src-gen"
|
||||
}
|
||||
|
@ -55,6 +61,25 @@ Workflow {
|
|||
validator = {
|
||||
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
|
||||
}
|
||||
junitSupport = {
|
||||
generateStub = false
|
||||
}
|
||||
}
|
||||
language = StandardLanguage {
|
||||
name = "org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage"
|
||||
fileExtensions = "partialcontentassisttestlang"
|
||||
serializer = {
|
||||
generateStub = false
|
||||
}
|
||||
validator = {
|
||||
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
|
||||
}
|
||||
junitSupport = {
|
||||
generateStub = false
|
||||
}
|
||||
parserGenerator = {
|
||||
partialParsing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
grammar org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage with org.eclipse.xtext.common.Terminals
|
||||
|
||||
generate partialContentAssistTestLanguage "http://www.eclipse.org/xtext/ide/tests/testlanguage/PartialContentAssistTestLanguage"
|
||||
|
||||
TypeDeclaration:
|
||||
'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
properties+=Property*
|
||||
'}';
|
||||
|
||||
Property:
|
||||
type=("int" | "bool") name=ID
|
||||
;
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.PartialContentAssistTestLanguageIdeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.tests.PartialContentAssistTestLanguageInjectorProvider;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
public class PartialContentAssistTestLanguageIdeInjectorProvider
|
||||
extends PartialContentAssistTestLanguageInjectorProvider {
|
||||
@Override
|
||||
protected Injector internalCreateInjector() {
|
||||
return new TestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(createRuntimeModule(), new PartialContentAssistTestLanguageIdeModule());
|
||||
}
|
||||
}.createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage
|
||||
|
||||
|
||||
/**
|
||||
* Use this class to register components to be used at runtime / without the Equinox extension registry.
|
||||
*/
|
||||
class PartialContentAssistTestLanguageRuntimeModule extends AbstractPartialContentAssistTestLanguageRuntimeModule {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage
|
||||
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages without Equinox extension registry.
|
||||
*/
|
||||
class PartialContentAssistTestLanguageStandaloneSetup extends PartialContentAssistTestLanguageStandaloneSetupGenerated {
|
||||
|
||||
def static void doSetup() {
|
||||
new PartialContentAssistTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.tests.TestLanguageInjectorProvider;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
public class TestLanguageIdeInjectorProvider extends TestLanguageInjectorProvider {
|
||||
@Override
|
||||
protected Injector internalCreateInjector() {
|
||||
return new TestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(createRuntimeModule(), new TestLanguageIdeModule());
|
||||
}
|
||||
}.createInjectorAndDoEMFRegistration();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.generator
|
||||
|
||||
import org.eclipse.emf.ecore.resource.Resource
|
||||
import org.eclipse.xtext.generator.AbstractGenerator
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2
|
||||
import org.eclipse.xtext.generator.IGeneratorContext
|
||||
|
||||
/**
|
||||
* Generates code from your model files on save.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
|
||||
*/
|
||||
class PartialContentAssistTestLanguageGenerator extends AbstractGenerator {
|
||||
|
||||
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
|
||||
// fsa.generateFile('greetings.txt', 'People to greet: ' +
|
||||
// resource.allContents
|
||||
// .filter(Greeting)
|
||||
// .map[name]
|
||||
// .join(', '))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide
|
||||
|
||||
|
||||
/**
|
||||
* Use this class to register ide components.
|
||||
*/
|
||||
class PartialContentAssistTestLanguageIdeModule extends AbstractPartialContentAssistTestLanguageIdeModule {
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide
|
||||
|
||||
import com.google.inject.Guice
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageRuntimeModule
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageStandaloneSetup
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages without Equinox extension registry.
|
||||
*/
|
||||
class PartialContentAssistTestLanguageIdeSetup extends PartialContentAssistTestLanguageStandaloneSetup {
|
||||
|
||||
override createInjector() {
|
||||
Guice.createInjector(new PartialContentAssistTestLanguageRuntimeModule, new PartialContentAssistTestLanguageIdeModule)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.scoping
|
||||
|
||||
|
||||
/**
|
||||
* This class contains custom scoping description.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
|
||||
* on how and when to use it.
|
||||
*/
|
||||
class PartialContentAssistTestLanguageScopeProvider extends AbstractPartialContentAssistTestLanguageScopeProvider {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.validation
|
||||
|
||||
|
||||
/**
|
||||
* This class contains custom validation rules.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
|
||||
*/
|
||||
class PartialContentAssistTestLanguageValidator extends AbstractPartialContentAssistTestLanguageValidator {
|
||||
|
||||
// public static val INVALID_NAME = 'invalidName'
|
||||
//
|
||||
// @Check
|
||||
// def checkGreetingStartsWithCapital(Greeting greeting) {
|
||||
// if (!Character.isUpperCase(greeting.name.charAt(0))) {
|
||||
// warning('Name should start with a capital',
|
||||
// PartialContentAssistTestLanguagePackage.Literals.GREETING__NAME,
|
||||
// INVALID_NAME)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,235 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
|
||||
import org.eclipse.xtext.ide.tests.editor.contentassist.ContentAssistContextTestHelper;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.TestLanguageIdeInjectorProvider;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
import org.eclipse.xtext.testing.XtextRunner;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner.class)
|
||||
@InjectWith(TestLanguageIdeInjectorProvider.class)
|
||||
@SuppressWarnings("all")
|
||||
public class ContentAssistContextFactoryTest {
|
||||
@Inject
|
||||
@Extension
|
||||
private ContentAssistContextTestHelper _contentAssistContextTestHelper;
|
||||
|
||||
@Inject
|
||||
private ContentAssistContextFactory factory;
|
||||
|
||||
@Inject
|
||||
private TestLanguageGrammarAccess grammar;
|
||||
|
||||
@Test
|
||||
public void testSimple1() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type Foo <|>{");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'extends\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'{\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple2() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("<|>int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: TypeDeclaration:properties+= *");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: TypeDeclaration:properties+=Property");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:type= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Property:type=Type");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Type:TypeReference");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: TypeReference:typeRef= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Type:PrimitiveType");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: PrimitiveType:name= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'string\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'int\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'boolean\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'}\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeginning() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("<|>type Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Model:types+= *");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Model:types+=TypeDeclaration");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'type\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: <AbstractElement not contained in AbstractRule!>:Model");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomEntryPoint() {
|
||||
ParserRule _propertyRule = this.grammar.getPropertyRule();
|
||||
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("int <|>bar");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Type:arrayDiemensions+= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: Type:arrayDiemensions+=\'[\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:name= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Property:name=ID");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomEntryPointBeginning() {
|
||||
ParserRule _propertyRule = this.grammar.getPropertyRule();
|
||||
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("<|>int bar");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:type= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Property:type=Type");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Type:TypeReference");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: TypeReference:typeRef= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Type:PrimitiveType");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: PrimitiveType:name= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'string\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'int\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PrimitiveType:name=\'boolean\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: <AbstractElement not contained in AbstractRule!>:Type");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
|
||||
import org.eclipse.xtext.resource.FileExtensionProvider;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.testing.validation.ValidationTestHelper;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.eclipse.xtext.util.TextRegion;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Conversions;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Pair;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class ContentAssistContextTestHelper {
|
||||
@Inject
|
||||
private FileExtensionProvider fileExtension;
|
||||
|
||||
@Inject
|
||||
private IResourceFactory resFactory;
|
||||
|
||||
@Inject
|
||||
private ValidationTestHelper validator;
|
||||
|
||||
@Accessors
|
||||
private String document;
|
||||
|
||||
@Accessors
|
||||
private ParserRule entryPoint;
|
||||
|
||||
@Accessors
|
||||
private String cursor = "<|>";
|
||||
|
||||
private XtextResource parse(final String doc) {
|
||||
try {
|
||||
String _primaryFileExtension = this.fileExtension.getPrimaryFileExtension();
|
||||
String _plus = ("dummy." + _primaryFileExtension);
|
||||
final URI uri = URI.createURI(_plus);
|
||||
Resource _createResource = this.resFactory.createResource(uri);
|
||||
final XtextResource res = ((XtextResource) _createResource);
|
||||
XtextResourceSet _xtextResourceSet = new XtextResourceSet();
|
||||
EList<Resource> _resources = _xtextResourceSet.getResources();
|
||||
_resources.add(res);
|
||||
if ((this.entryPoint != null)) {
|
||||
res.setEntryPoint(this.entryPoint);
|
||||
}
|
||||
StringInputStream _stringInputStream = new StringInputStream(doc);
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
res.load(_stringInputStream, _emptyMap);
|
||||
this.validator.assertNoErrors(res);
|
||||
return res;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
public String firstSetGrammarElementsToString(final ContentAssistContextFactory factory) {
|
||||
final int offset = this.document.indexOf(this.cursor);
|
||||
Preconditions.checkArgument((offset >= 0), "you forgot to provide a cursor");
|
||||
final String doc = this.document.replace(this.cursor, "");
|
||||
final XtextResource res = this.parse(doc);
|
||||
ExecutorService _newCachedThreadPool = Executors.newCachedThreadPool();
|
||||
factory.setPool(_newCachedThreadPool);
|
||||
TextRegion _textRegion = new TextRegion(0, 0);
|
||||
final ContentAssistContext[] ctxs = factory.create(doc, _textRegion, offset, res);
|
||||
GrammarElementTitleSwitch _grammarElementTitleSwitch = new GrammarElementTitleSwitch();
|
||||
GrammarElementTitleSwitch _showAssignments = _grammarElementTitleSwitch.showAssignments();
|
||||
GrammarElementTitleSwitch _showQualified = _showAssignments.showQualified();
|
||||
final GrammarElementTitleSwitch f = _showQualified.showRule();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
{
|
||||
Iterable<Pair<Integer, ContentAssistContext>> _indexed = IterableExtensions.<ContentAssistContext>indexed(((Iterable<? extends ContentAssistContext>)Conversions.doWrapArray(ctxs)));
|
||||
for(final Pair<Integer, ContentAssistContext> ctx : _indexed) {
|
||||
_builder.append("context");
|
||||
Integer _key = ctx.getKey();
|
||||
_builder.append(_key, "");
|
||||
_builder.append(" {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
ContentAssistContext _value = ctx.getValue();
|
||||
ImmutableList<AbstractElement> _firstSetGrammarElements = _value.getFirstSetGrammarElements();
|
||||
for(final AbstractElement ele : _firstSetGrammarElements) {
|
||||
_builder.append("\t");
|
||||
EClass _eClass = ele.eClass();
|
||||
String _name = _eClass.getName();
|
||||
_builder.append(_name, "\t");
|
||||
_builder.append(": ");
|
||||
String _apply = f.apply(ele);
|
||||
_builder.append(_apply, "\t");
|
||||
_builder.newLineIfNotEmpty();
|
||||
}
|
||||
}
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
}
|
||||
}
|
||||
return _builder.toString();
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getDocument() {
|
||||
return this.document;
|
||||
}
|
||||
|
||||
public void setDocument(final String document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ParserRule getEntryPoint() {
|
||||
return this.entryPoint;
|
||||
}
|
||||
|
||||
public void setEntryPoint(final ParserRule entryPoint) {
|
||||
this.entryPoint = entryPoint;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getCursor() {
|
||||
return this.cursor;
|
||||
}
|
||||
|
||||
public void setCursor(final String cursor) {
|
||||
this.cursor = cursor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory;
|
||||
import org.eclipse.xtext.ide.tests.editor.contentassist.ContentAssistContextTestHelper;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageIdeInjectorProvider;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.PartialContentAssistTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
import org.eclipse.xtext.testing.XtextRunner;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner.class)
|
||||
@InjectWith(PartialContentAssistTestLanguageIdeInjectorProvider.class)
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageContextFactoryTest {
|
||||
@Inject
|
||||
@Extension
|
||||
private ContentAssistContextTestHelper _contentAssistContextTestHelper;
|
||||
|
||||
@Inject
|
||||
private ContentAssistContextFactory factory;
|
||||
|
||||
@Inject
|
||||
private PartialContentAssistTestLanguageGrammarAccess grammar;
|
||||
|
||||
@Test
|
||||
public void testConfig() {
|
||||
Assert.assertTrue((this.factory instanceof PartialContentAssistContextFactory));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple1() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type Foo <|>{");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'extends\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'{\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple2() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("type Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("<|>int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: TypeDeclaration:properties+= *");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: TypeDeclaration:properties+=Property");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:type= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: Property:type=\'int\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: Property:type=\'bool\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'}\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeginning() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("<|>type Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("int bar");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'type\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: <AbstractElement not contained in AbstractRule!>:TypeDeclaration");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomEntryPoint() {
|
||||
ParserRule _propertyRule = this.grammar.getPropertyRule();
|
||||
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("int <|>bar");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:name= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Property:name=ID");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomEntryPointBeginning() {
|
||||
ParserRule _propertyRule = this.grammar.getPropertyRule();
|
||||
this._contentAssistContextTestHelper.setEntryPoint(_propertyRule);
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("<|>int bar");
|
||||
_builder.newLine();
|
||||
this._contentAssistContextTestHelper.setDocument(_builder.toString());
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Property:type= ");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: Property:type=\'int\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: Property:type=\'bool\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: <AbstractElement not contained in AbstractRule!>:Property");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
String _string = _builder_1.toString();
|
||||
String _firstSetGrammarElementsToString = this._contentAssistContextTestHelper.firstSetGrammarElementsToString(this.factory);
|
||||
Assert.assertEquals(_string, _firstSetGrammarElementsToString);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.editor.contentassist.antlr;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class CustomEntryPointContentAssistTest {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.AbstractPartialContentAssistTestLanguageRuntimeModule;
|
||||
|
||||
/**
|
||||
* Use this class to register components to be used at runtime / without the Equinox extension registry.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageRuntimeModule extends AbstractPartialContentAssistTestLanguageRuntimeModule {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageStandaloneSetupGenerated;
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages without Equinox extension registry.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageStandaloneSetup extends PartialContentAssistTestLanguageStandaloneSetupGenerated {
|
||||
public static void doSetup() {
|
||||
PartialContentAssistTestLanguageStandaloneSetup _partialContentAssistTestLanguageStandaloneSetup = new PartialContentAssistTestLanguageStandaloneSetup();
|
||||
_partialContentAssistTestLanguageStandaloneSetup.createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.generator;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.generator.AbstractGenerator;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.generator.IGeneratorContext;
|
||||
|
||||
/**
|
||||
* Generates code from your model files on save.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageGenerator extends AbstractGenerator {
|
||||
@Override
|
||||
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.AbstractPartialContentAssistTestLanguageIdeModule;
|
||||
|
||||
/**
|
||||
* Use this class to register ide components.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageIdeModule extends AbstractPartialContentAssistTestLanguageIdeModule {
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.PartialContentAssistTestLanguageIdeModule;
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages without Equinox extension registry.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageIdeSetup extends PartialContentAssistTestLanguageStandaloneSetup {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
PartialContentAssistTestLanguageRuntimeModule _partialContentAssistTestLanguageRuntimeModule = new PartialContentAssistTestLanguageRuntimeModule();
|
||||
PartialContentAssistTestLanguageIdeModule _partialContentAssistTestLanguageIdeModule = new PartialContentAssistTestLanguageIdeModule();
|
||||
return Guice.createInjector(_partialContentAssistTestLanguageRuntimeModule, _partialContentAssistTestLanguageIdeModule);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.scoping;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.scoping.AbstractPartialContentAssistTestLanguageScopeProvider;
|
||||
|
||||
/**
|
||||
* This class contains custom scoping description.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
|
||||
* on how and when to use it.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageScopeProvider extends AbstractPartialContentAssistTestLanguageScopeProvider {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.validation;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.validation.AbstractPartialContentAssistTestLanguageValidator;
|
||||
|
||||
/**
|
||||
* This class contains custom validation rules.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class PartialContentAssistTestLanguageValidator extends AbstractPartialContentAssistTestLanguageValidator {
|
||||
}
|
|
@ -14,6 +14,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.antlr.runtime.ANTLRStringStream;
|
||||
import org.antlr.runtime.BaseRecognizer;
|
||||
|
@ -22,17 +23,22 @@ import org.antlr.runtime.RecognizerSharedState;
|
|||
import org.antlr.runtime.Token;
|
||||
import org.antlr.runtime.TokenSource;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.AbstractRule;
|
||||
import org.eclipse.xtext.Alternatives;
|
||||
import org.eclipse.xtext.CompoundElement;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.UnorderedGroup;
|
||||
import org.eclipse.xtext.ide.LexerIdeBindings;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.ObservableXtextTokenStream.StreamListener;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.InfiniteRecursion;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser;
|
||||
import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper;
|
||||
import org.eclipse.xtext.xtext.RuleNames;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
@ -41,7 +47,7 @@ import com.google.inject.name.Named;
|
|||
/**
|
||||
* @since 2.9
|
||||
*/
|
||||
public abstract class AbstractContentAssistParser implements IContentAssistParser {
|
||||
public abstract class AbstractContentAssistParser implements IContentAssistParser, IPartialEditingContentAssistParser {
|
||||
|
||||
@Inject
|
||||
@Named(LexerIdeBindings.CONTENT_ASSIST)
|
||||
|
@ -53,6 +59,25 @@ public abstract class AbstractContentAssistParser implements IContentAssistParse
|
|||
@Inject
|
||||
private RequiredRuleNameComputer requiredRuleNameComputer;
|
||||
|
||||
@Inject
|
||||
private RuleNames ruleNames;
|
||||
|
||||
private AbstractRule entryRule;
|
||||
|
||||
@Inject
|
||||
private void initEntryRule(IGrammarAccess grammar) {
|
||||
initializeFor(grammar.getGrammar().getRules().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeFor(AbstractRule rule) {
|
||||
this.entryRule = rule;
|
||||
}
|
||||
|
||||
public AbstractRule getEntryRule() {
|
||||
return entryRule;
|
||||
}
|
||||
|
||||
protected TokenSource createTokenSource(String input) {
|
||||
return createLexer(new ANTLRStringStream(input));
|
||||
}
|
||||
|
@ -299,10 +324,44 @@ public abstract class AbstractContentAssistParser implements IContentAssistParse
|
|||
}
|
||||
|
||||
protected abstract String getRuleName(AbstractElement element);
|
||||
|
||||
|
||||
protected abstract AbstractInternalContentAssistParser createParser();
|
||||
|
||||
protected abstract Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser);
|
||||
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
return getFollowElements(parser, entryRule);
|
||||
}
|
||||
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser,
|
||||
AbstractRule rule) {
|
||||
String ruleName = ruleNames.getAntlrRuleName(rule);
|
||||
return getFollowElements(parser, ruleName);
|
||||
}
|
||||
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser, String ruleName) {
|
||||
try {
|
||||
Preconditions.checkNotNull(ruleName);
|
||||
Method method = parser.getClass().getMethod(ruleName);
|
||||
method.setAccessible(true);
|
||||
try {
|
||||
method.invoke(parser);
|
||||
} catch (InvocationTargetException targetException) {
|
||||
if ((targetException.getCause() instanceof InfiniteRecursion)) {
|
||||
throw (InfiniteRecursion) targetException.getCause();
|
||||
}
|
||||
throw new RuntimeException(targetException);
|
||||
}
|
||||
Set<FollowElement> result = parser.getFollowElements();
|
||||
return result;
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (SecurityException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String[] getInitialHiddenTokens();
|
||||
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.editor.contentassist.antlr;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import org.antlr.runtime.TokenSource;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
@ -26,6 +23,7 @@ import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.InfiniteRecursi
|
|||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper;
|
||||
import org.eclipse.xtext.xtext.RuleNames;
|
||||
|
@ -70,6 +68,7 @@ public abstract class AbstractPartialContentAssistParser extends AbstractContent
|
|||
} else {
|
||||
String text = parseResult.getRootNode().getText();
|
||||
String parseMe = text.substring(0, offset);
|
||||
initializeFor(NodeModelUtils.getEntryParserRule(parseResult.getRootNode()));
|
||||
Collection<FollowElement> followElements = getFollowElements(parseMe, strict);
|
||||
return followElements;
|
||||
}
|
||||
|
@ -141,8 +140,7 @@ public abstract class AbstractPartialContentAssistParser extends AbstractContent
|
|||
return null;
|
||||
}
|
||||
|
||||
protected Collection<FollowElement> getFollowElements(
|
||||
AbstractInternalContentAssistParser parser,
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser,
|
||||
AbstractElement entryPoint) {
|
||||
String ruleName = getRuleName(entryPoint);
|
||||
if (ruleName == null) {
|
||||
|
@ -157,27 +155,6 @@ public abstract class AbstractPartialContentAssistParser extends AbstractContent
|
|||
if (ruleName == null) {
|
||||
throw new IllegalStateException("entryPoint: " + entryPoint);
|
||||
}
|
||||
try {
|
||||
Method method = parser.getClass().getMethod(ruleName);
|
||||
method.setAccessible(true);
|
||||
try {
|
||||
method.invoke(parser);
|
||||
} catch (InvocationTargetException targetException) {
|
||||
if ((targetException.getCause() instanceof InfiniteRecursion)) {
|
||||
throw (InfiniteRecursion) targetException.getCause();
|
||||
}
|
||||
throw new RuntimeException(targetException);
|
||||
}
|
||||
Set<FollowElement> result = parser.getFollowElements();
|
||||
return result;
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (SecurityException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return getFollowElements(parser, ruleName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.xtext.ide.LexerIdeBindings;
|
|||
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext.Builder;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser;
|
||||
import org.eclipse.xtext.nodemodel.BidiTreeIterator;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
|
@ -186,6 +187,9 @@ public class ContentAssistContextFactory implements Function<ContentAssistContex
|
|||
|
||||
protected void initializeNodeAndModelData() {
|
||||
rootNode = parseResult.getRootNode();
|
||||
if (parser instanceof IPartialEditingContentAssistParser) {
|
||||
((IPartialEditingContentAssistParser) parser).initializeFor(resource.getEntryPoint());
|
||||
}
|
||||
lastCompleteNode = new LeafNodeFinder(completionOffset, true).searchIn(rootNode);
|
||||
if (lastCompleteNode == null)
|
||||
lastCompleteNode = rootNode;
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
package org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.internal.InternalBeeLangTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.services.BeeLangTestLanguageGrammarAccess;
|
||||
|
||||
|
@ -313,18 +309,7 @@ public class BeeLangTestLanguageParser extends AbstractContentAssistParser {
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalBeeLangTestLanguageParser typedParser = (InternalBeeLangTestLanguageParser) parser;
|
||||
typedParser.entryRuleModel();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
package org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.internal.InternalExBeeLangTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.services.ExBeeLangTestLanguageGrammarAccess;
|
||||
|
||||
|
@ -313,18 +309,7 @@ public class ExBeeLangTestLanguageParser extends AbstractContentAssistParser {
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalExBeeLangTestLanguageParser typedParser = (InternalExBeeLangTestLanguageParser) parser;
|
||||
typedParser.entryRuleDelegateModel();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
package org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.internal.InternalSimpleBeeLangTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.backtracking.services.SimpleBeeLangTestLanguageGrammarAccess;
|
||||
|
||||
|
@ -313,18 +309,7 @@ public class SimpleBeeLangTestLanguageParser extends AbstractContentAssistParser
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalSimpleBeeLangTestLanguageParser typedParser = (InternalSimpleBeeLangTestLanguageParser) parser;
|
||||
typedParser.entryRuleDelegateModel();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
package org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr.internal.InternalNoJdtTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.noJdt.services.NoJdtTestLanguageGrammarAccess;
|
||||
|
||||
|
@ -45,18 +41,7 @@ public class NoJdtTestLanguageParser extends AbstractContentAssistParser {
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalNoJdtTestLanguageParser typedParser = (InternalNoJdtTestLanguageParser) parser;
|
||||
typedParser.entryRuleModel();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
package org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr.internal.InternalXtextGrammarTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.xtextgrammar.services.XtextGrammarTestLanguageGrammarAccess;
|
||||
|
||||
|
@ -164,18 +160,7 @@ public class XtextGrammarTestLanguageParser extends AbstractContentAssistParser
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
|
||||
try {
|
||||
InternalXtextGrammarTestLanguageParser typedParser = (InternalXtextGrammarTestLanguageParser) parser;
|
||||
typedParser.entryRuleGrammar();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(RecognitionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.io.StringReader;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.nodemodel.BidiTreeIterator;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
|
@ -23,7 +24,10 @@ import org.eclipse.xtext.serializer.impl.Serializer;
|
|||
import org.eclipse.xtext.testlanguages.LookaheadTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.PartialParserTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetupGenerated;
|
||||
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.services.ReferenceGrammarTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.testlanguages.services.SimpleExpressionsTestLanguageGrammarAccess;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -409,5 +413,29 @@ public class PartialParserTest extends AbstractPartialParserTest {
|
|||
resource.update(1, 2, "");
|
||||
assertEquals("t", resource.getParseResult().getRootNode().getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preserveEntryParserRuleOnFullyReparse1() throws Exception {
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetupGenerated.class);
|
||||
ParserRule rule = get(ReferenceGrammarTestLanguageGrammarAccess.class).getKindRule();
|
||||
String model = "kind (Fritz 12)";
|
||||
checkFullReparse(rule, model);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preserveEntryParserRuleOnFullyReparse2() throws Exception {
|
||||
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
|
||||
ParserRule rule = get(SimpleExpressionsTestLanguageGrammarAccess.class).getMultiplicationRule();
|
||||
String model = "1 * 2";
|
||||
checkFullReparse(rule, model);
|
||||
}
|
||||
|
||||
private void checkFullReparse(ParserRule rule, String model) {
|
||||
IParseResult oldParseResult = getParser().parse(rule, new StringReader(model));
|
||||
IParseResult partialParseResult = reparse(oldParseResult, 0, model.length(), " " + model + " ");
|
||||
String oldNodeModel = NodeModelUtils.compactDump(oldParseResult.getRootNode(), false);
|
||||
String partialNodeModel = NodeModelUtils.compactDump(partialParseResult.getRootNode(), false);
|
||||
assertEquals(oldNodeModel, partialNodeModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io/) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.resource
|
||||
|
||||
import org.eclipse.emf.common.util.URI
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup
|
||||
import org.eclipse.xtext.testlanguages.services.ReferenceGrammarTestLanguageGrammarAccess
|
||||
import org.eclipse.xtext.tests.AbstractXtextTests
|
||||
import org.eclipse.xtext.util.StringInputStream
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
class SetEntryPointOnXtextResourceTest extends AbstractXtextTests {
|
||||
|
||||
@Test def void test1() {
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetup)
|
||||
val model = "kind (Hugo 13)"
|
||||
|
||||
val kindRule = get(ReferenceGrammarTestLanguageGrammarAccess).kindRule
|
||||
val resource = createResource()
|
||||
|
||||
// test 1: parse and assume there are no errors
|
||||
resource.entryPoint = kindRule
|
||||
resource.load(new StringInputStream(model), emptyMap)
|
||||
assertTrue(resource.errors.isEmpty)
|
||||
assertEquals(kindRule, NodeModelUtils.getEntryParserRule(resource.parseResult.rootNode))
|
||||
|
||||
// test 2: update and assume node model does not change
|
||||
val originalNodeModel = NodeModelUtils.compactDump(resource.parseResult.rootNode, false)
|
||||
resource.update(0, model.length, " " + model + " ")
|
||||
val reparsedNodeModel = NodeModelUtils.compactDump(resource.parseResult.rootNode, false)
|
||||
assertEquals(originalNodeModel, reparsedNodeModel)
|
||||
|
||||
// test 3: change parser rule
|
||||
val erwachsenerRule = get(ReferenceGrammarTestLanguageGrammarAccess).erwachsenerRule
|
||||
resource.entryPoint = erwachsenerRule
|
||||
resource.update(0, model.length, "erwachsener (Peter 30)")
|
||||
assertEquals(erwachsenerRule, NodeModelUtils.getEntryParserRule(resource.parseResult.rootNode))
|
||||
}
|
||||
|
||||
def private createResource() {
|
||||
get(IResourceFactory).createResource(URI.createURI("dummy." + currentFileExtension)) as XtextResource
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io/) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.resource;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.services.ReferenceGrammarTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.tests.AbstractXtextTests;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class SetEntryPointOnXtextResourceTest extends AbstractXtextTests {
|
||||
@Test
|
||||
public void test1() {
|
||||
try {
|
||||
this.with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
final String model = "kind (Hugo 13)";
|
||||
ReferenceGrammarTestLanguageGrammarAccess _get = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class);
|
||||
final ParserRule kindRule = _get.getKindRule();
|
||||
final XtextResource resource = this.createResource();
|
||||
resource.setEntryPoint(kindRule);
|
||||
StringInputStream _stringInputStream = new StringInputStream(model);
|
||||
Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap();
|
||||
resource.load(_stringInputStream, _emptyMap);
|
||||
EList<Resource.Diagnostic> _errors = resource.getErrors();
|
||||
boolean _isEmpty = _errors.isEmpty();
|
||||
Assert.assertTrue(_isEmpty);
|
||||
IParseResult _parseResult = resource.getParseResult();
|
||||
ICompositeNode _rootNode = _parseResult.getRootNode();
|
||||
ParserRule _entryParserRule = NodeModelUtils.getEntryParserRule(_rootNode);
|
||||
Assert.assertEquals(kindRule, _entryParserRule);
|
||||
IParseResult _parseResult_1 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_1 = _parseResult_1.getRootNode();
|
||||
final String originalNodeModel = NodeModelUtils.compactDump(_rootNode_1, false);
|
||||
int _length = model.length();
|
||||
resource.update(0, _length, ((" " + model) + " "));
|
||||
IParseResult _parseResult_2 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_2 = _parseResult_2.getRootNode();
|
||||
final String reparsedNodeModel = NodeModelUtils.compactDump(_rootNode_2, false);
|
||||
Assert.assertEquals(originalNodeModel, reparsedNodeModel);
|
||||
ReferenceGrammarTestLanguageGrammarAccess _get_1 = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class);
|
||||
final ParserRule erwachsenerRule = _get_1.getErwachsenerRule();
|
||||
resource.setEntryPoint(erwachsenerRule);
|
||||
int _length_1 = model.length();
|
||||
resource.update(0, _length_1, "erwachsener (Peter 30)");
|
||||
IParseResult _parseResult_3 = resource.getParseResult();
|
||||
ICompositeNode _rootNode_3 = _parseResult_3.getRootNode();
|
||||
ParserRule _entryParserRule_1 = NodeModelUtils.getEntryParserRule(_rootNode_3);
|
||||
Assert.assertEquals(erwachsenerRule, _entryParserRule_1);
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
private XtextResource createResource() {
|
||||
IResourceFactory _get = this.<IResourceFactory>get(IResourceFactory.class);
|
||||
String _currentFileExtension = this.getCurrentFileExtension();
|
||||
String _plus = ("dummy." + _currentFileExtension);
|
||||
URI _createURI = URI.createURI(_plus);
|
||||
Resource _createResource = _get.createResource(_createURI);
|
||||
return ((XtextResource) _createResource);
|
||||
}
|
||||
}
|
|
@ -10,11 +10,9 @@ package org.eclipse.xtext.xtext.generator.parser.antlr
|
|||
import com.google.inject.Inject
|
||||
import com.google.inject.name.Names
|
||||
import java.io.InputStream
|
||||
import java.util.Collection
|
||||
import java.util.HashMap
|
||||
import java.util.Map
|
||||
import org.antlr.runtime.CharStream
|
||||
import org.antlr.runtime.RecognitionException
|
||||
import org.antlr.runtime.Token
|
||||
import org.antlr.runtime.TokenSource
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
|
@ -38,6 +36,7 @@ import org.eclipse.xtext.parser.antlr.UnorderedGroupHelper
|
|||
import org.eclipse.xtext.parser.antlr.XtextTokenStream
|
||||
import org.eclipse.xtext.parsetree.reconstr.ITokenSerializer
|
||||
import org.eclipse.xtext.parsetree.reconstr.impl.IgnoreCaseKeywordSerializer
|
||||
import org.eclipse.xtext.serializer.tokens.IKeywordSerializer
|
||||
import org.eclipse.xtext.xtext.generator.Issues
|
||||
import org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessExtensions
|
||||
import org.eclipse.xtext.xtext.generator.model.FileAccessFactory
|
||||
|
@ -51,7 +50,6 @@ import org.eclipse.xtext.xtext.generator.util.SyntheticTerminalDetector
|
|||
import static extension org.eclipse.xtext.GrammarUtil.*
|
||||
import static extension org.eclipse.xtext.xtext.generator.model.TypeReference.*
|
||||
import static extension org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil.*
|
||||
import org.eclipse.xtext.serializer.tokens.IKeywordSerializer
|
||||
|
||||
class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
|
||||
|
||||
|
@ -340,18 +338,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
|
|||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected «Collection»<«"org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement".typeRef»> getFollowElements(«grammar.internalParserSuperClass» parser) {
|
||||
try {
|
||||
«grammar.internalParserClass» typedParser = («grammar.internalParserClass») parser;
|
||||
typedParser.«grammar.allParserRules.head.originalElement.entryRuleName»();
|
||||
return typedParser.getFollowElements();
|
||||
} catch(«RecognitionException» ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { «FOR hidden : grammar.initialHiddenTokens SEPARATOR ", "»"«hidden»"«ENDFOR» };
|
||||
|
@ -489,6 +476,12 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
|
|||
.to(«grammar.lexerClass».class);
|
||||
''')
|
||||
.addTypeToType('org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser'.typeRef, grammar.parserClass)
|
||||
if (partialParsing) {
|
||||
rtBindings.addTypeToType(
|
||||
"org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory".typeRef,
|
||||
"org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory".typeRef
|
||||
)
|
||||
}
|
||||
rtBindings.contributeTo(language.ideGenModule)
|
||||
}
|
||||
|
||||
|
@ -539,12 +532,6 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 {
|
|||
.addConfiguredBinding("ContentAssistLexerProvider", '''
|
||||
binder.bind(«caLexerClass».class).toProvider(«LexerProvider».create(«caLexerClass».class));
|
||||
''')
|
||||
if (partialParsing) {
|
||||
uiBindings.addTypeToType(
|
||||
"org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory".typeRef,
|
||||
"org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory".typeRef
|
||||
)
|
||||
}
|
||||
uiBindings.contributeTo(language.eclipsePluginGenModule)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.antlr.runtime.CharStream;
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.antlr.runtime.Token;
|
||||
import org.antlr.runtime.TokenSource;
|
||||
import org.eclipse.xtend.lib.annotations.AccessorType;
|
||||
|
@ -984,62 +983,7 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
_builder.append("\t");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("@Override");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("protected ");
|
||||
_builder.append(Collection.class, "\t");
|
||||
_builder.append("<");
|
||||
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement");
|
||||
_builder.append(_typeRef, "\t");
|
||||
_builder.append("> getFollowElements(");
|
||||
Grammar _grammar_12 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _internalParserSuperClass = naming.getInternalParserSuperClass(_grammar_12);
|
||||
_builder.append(_internalParserSuperClass, "\t");
|
||||
_builder.append(" parser) {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t\t");
|
||||
_builder.append("try {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
Grammar _grammar_13 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _internalParserClass_3 = naming.getInternalParserClass(_grammar_13);
|
||||
_builder.append(_internalParserClass_3, "\t\t\t");
|
||||
_builder.append(" typedParser = (");
|
||||
Grammar _grammar_14 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _internalParserClass_4 = naming.getInternalParserClass(_grammar_14);
|
||||
_builder.append(_internalParserClass_4, "\t\t\t");
|
||||
_builder.append(") parser;");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("typedParser.");
|
||||
Grammar _grammar_15 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
List<ParserRule> _allParserRules = GrammarUtil.allParserRules(_grammar_15);
|
||||
ParserRule _head = IterableExtensions.<ParserRule>head(_allParserRules);
|
||||
ParserRule _originalElement = AntlrGrammarGenUtil.<ParserRule>getOriginalElement(_head);
|
||||
String _entryRuleName = XtextAntlrGeneratorFragment2.this.grammarUtil.entryRuleName(_originalElement);
|
||||
_builder.append(_entryRuleName, "\t\t\t");
|
||||
_builder.append("();");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("return typedParser.getFollowElements();");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t");
|
||||
_builder.append("} catch(");
|
||||
_builder.append(RecognitionException.class, "\t\t");
|
||||
_builder.append(" ex) {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("throw new RuntimeException(ex);");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("@Override");
|
||||
|
@ -1050,8 +994,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
_builder.append("\t\t");
|
||||
_builder.append("return new String[] { ");
|
||||
{
|
||||
Grammar _grammar_16 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
List<String> _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(_grammar_16);
|
||||
Grammar _grammar_12 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
List<String> _initialHiddenTokens = XtextAntlrGeneratorFragment2.this.grammarUtil.initialHiddenTokens(_grammar_12);
|
||||
boolean _hasElements = false;
|
||||
for(final String hidden : _initialHiddenTokens) {
|
||||
if (!_hasElements) {
|
||||
|
@ -1072,8 +1016,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("public ");
|
||||
Grammar _grammar_17 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_17);
|
||||
Grammar _grammar_13 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _grammarAccess_1 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_13);
|
||||
_builder.append(_grammarAccess_1, "\t");
|
||||
_builder.append(" getGrammarAccess() {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
|
@ -1086,8 +1030,8 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("public void setGrammarAccess(");
|
||||
Grammar _grammar_18 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_18);
|
||||
Grammar _grammar_14 = XtextAntlrGeneratorFragment2.this.getGrammar();
|
||||
TypeReference _grammarAccess_2 = XtextAntlrGeneratorFragment2.this.grammarUtil.getGrammarAccess(_grammar_14);
|
||||
_builder.append(_grammarAccess_2, "\t");
|
||||
_builder.append(" grammarAccess) {");
|
||||
_builder.newLineIfNotEmpty();
|
||||
|
@ -1487,6 +1431,11 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
Grammar _grammar = this.getGrammar();
|
||||
TypeReference _parserClass = naming.getParserClass(_grammar);
|
||||
final GuiceModuleAccess.BindingFactory rtBindings = _addConfiguredBinding.addTypeToType(_typeRef, _parserClass);
|
||||
if (this.partialParsing) {
|
||||
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory");
|
||||
TypeReference _typeRef_2 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory");
|
||||
rtBindings.addTypeToType(_typeRef_1, _typeRef_2);
|
||||
}
|
||||
IXtextGeneratorLanguage _language = this.getLanguage();
|
||||
GuiceModuleAccess _ideGenModule = _language.getIdeGenModule();
|
||||
rtBindings.contributeTo(_ideGenModule);
|
||||
|
@ -1616,11 +1565,6 @@ public class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment
|
|||
}
|
||||
};
|
||||
final GuiceModuleAccess.BindingFactory uiBindings = _addTypeToType_2.addConfiguredBinding("ContentAssistLexerProvider", _client_3);
|
||||
if (this.partialParsing) {
|
||||
TypeReference _typeRef_4 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory");
|
||||
TypeReference _typeRef_5 = TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory");
|
||||
uiBindings.addTypeToType(_typeRef_4, _typeRef_5);
|
||||
}
|
||||
IXtextGeneratorLanguage _language = this.getLanguage();
|
||||
GuiceModuleAccess _eclipsePluginGenModule = _language.getEclipsePluginGenModule();
|
||||
uiBindings.contributeTo(_eclipsePluginGenModule);
|
||||
|
|
|
@ -104,6 +104,8 @@ public class GrammarElementTitleSwitch extends XtextSwitch<String> implements Fu
|
|||
if (!showQualified && !showRule)
|
||||
return result;
|
||||
AbstractRule rule = GrammarUtil.containingRule(ele);
|
||||
if (rule == null)
|
||||
return "<AbstractElement not contained in AbstractRule!>:" + result;
|
||||
if (!showQualified)
|
||||
return result + ":" + rule.getName();
|
||||
GrammarElementTitleSwitch others = copy();
|
||||
|
|
|
@ -427,5 +427,20 @@ public class NodeModelUtils extends InternalNodeModelUtils {
|
|||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static ParserRule getEntryParserRule(INode node) {
|
||||
ICompositeNode root = node.getRootNode();
|
||||
EObject ge1 = root.getGrammarElement();
|
||||
if (ge1 instanceof ParserRule) {
|
||||
return (ParserRule) ge1;
|
||||
} else if (ge1 instanceof Action) {
|
||||
INode firstChild = root.getFirstChild();
|
||||
EObject ge2 = firstChild.getGrammarElement();
|
||||
if (ge2 instanceof ParserRule) {
|
||||
return (ParserRule) ge2;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No Root Parser Rule found; The Node Model is broken.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -215,8 +215,10 @@ public class PartialParsingHelper implements IPartialParsingHelper {
|
|||
|
||||
protected IParseResult fullyReparse(IParser parser, IParseResult previousParseResult, ReplaceRegion replaceRegion) {
|
||||
unloadSemanticObject(previousParseResult.getRootASTElement());
|
||||
ICompositeNode node = previousParseResult.getRootNode();
|
||||
ParserRule parserRule = NodeModelUtils.getEntryParserRule(node);
|
||||
String reparseRegion = insertChangeIntoReplaceRegion(previousParseResult.getRootNode(), replaceRegion);
|
||||
return parser.parse(new StringReader(reparseRegion));
|
||||
return parser.parse(parserRule, new StringReader(reparseRegion));
|
||||
}
|
||||
|
||||
public void unloadNode(INode node) {
|
||||
|
|
|
@ -27,10 +27,12 @@ import org.eclipse.emf.common.util.URI;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
|
||||
import org.eclipse.xtext.Constants;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.diagnostics.Severity;
|
||||
import org.eclipse.xtext.linking.ILinker;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.SyntaxErrorMessage;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IEncodingProvider;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parser.IParser;
|
||||
|
@ -84,6 +86,8 @@ public class XtextResource extends ResourceImpl {
|
|||
protected volatile boolean isUpdating = false;
|
||||
|
||||
private IParser parser;
|
||||
|
||||
private ParserRule entryPoint;
|
||||
|
||||
@Inject
|
||||
private ILinker linker;
|
||||
|
@ -163,11 +167,16 @@ public class XtextResource extends ResourceImpl {
|
|||
public IParseResult getParseResult() {
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException {
|
||||
setEncodingFromOptions(options);
|
||||
IParseResult result = parser.parse(createReader(inputStream));
|
||||
IParseResult result;
|
||||
if (entryPoint == null) {
|
||||
result = parser.parse(createReader(inputStream));
|
||||
} else {
|
||||
result = parser.parse(entryPoint, createReader(inputStream));
|
||||
}
|
||||
updateInternalState(this.parseResult, result);
|
||||
}
|
||||
|
||||
|
@ -250,7 +259,15 @@ public class XtextResource extends ResourceImpl {
|
|||
isUpdating = true;
|
||||
IParseResult oldParseResult = parseResult;
|
||||
ReplaceRegion replaceRegion = new ReplaceRegion(new TextRegion(offset, replacedTextLength), newText);
|
||||
IParseResult newParseResult = parser.reparse(oldParseResult, replaceRegion);
|
||||
IParseResult newParseResult;
|
||||
ParserRule oldEntryPoint = NodeModelUtils.getEntryParserRule(oldParseResult.getRootNode());
|
||||
if (entryPoint == null || entryPoint == oldEntryPoint) {
|
||||
newParseResult = parser.reparse(oldParseResult, replaceRegion);
|
||||
} else {
|
||||
StringBuilder builder = new StringBuilder(oldParseResult.getRootNode().getText());
|
||||
replaceRegion.applyTo(builder);
|
||||
newParseResult = parser.parse(entryPoint, new StringReader(builder.toString()));
|
||||
}
|
||||
updateInternalState(oldParseResult, newParseResult);
|
||||
} finally {
|
||||
isUpdating = false;
|
||||
|
@ -404,7 +421,7 @@ public class XtextResource extends ResourceImpl {
|
|||
}
|
||||
diagnostics.add(new XtextSyntaxDiagnostic(error));
|
||||
}
|
||||
|
||||
|
||||
public IParser getParser() {
|
||||
return parser;
|
||||
}
|
||||
|
@ -412,6 +429,17 @@ public class XtextResource extends ResourceImpl {
|
|||
public void setParser(IParser parser) {
|
||||
this.parser = parser;
|
||||
}
|
||||
|
||||
public ParserRule getEntryPoint() {
|
||||
if (entryPoint == null && parseResult != null) {
|
||||
entryPoint = NodeModelUtils.getEntryParserRule(parseResult.getRootNode());
|
||||
}
|
||||
return entryPoint;
|
||||
}
|
||||
|
||||
public void setEntryPoint(ParserRule parserRule) {
|
||||
this.entryPoint = parserRule;
|
||||
}
|
||||
|
||||
public IConcreteSyntaxValidator getConcreteSyntaxValidator() {
|
||||
return validator;
|
||||
|
|
Loading…
Reference in a new issue