mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
[refactoring] moved test language to testlanguages
This commit is contained in:
parent
007cb435fc
commit
57c80717cf
70 changed files with 10565 additions and 21 deletions
2
org.eclipse.xtext.ide.tests/src-gen/Foo.java
Normal file
2
org.eclipse.xtext.ide.tests/src-gen/Foo.java
Normal file
|
@ -0,0 +1,2 @@
|
|||
public class Foo {
|
||||
}
|
11
org.eclipse.xtext.ide.tests/src-gen/Test.java
Normal file
11
org.eclipse.xtext.ide.tests/src-gen/Test.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
public class Test {
|
||||
private Test foo;
|
||||
|
||||
public void setFoo(Test foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
public Test getFoo() {
|
||||
return this.foo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2017 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.importHandling
|
||||
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Provider
|
||||
import org.eclipse.xtext.ide.serializer.impl.ChangeSerializer
|
||||
import org.eclipse.xtext.testing.InjectWith
|
||||
import org.eclipse.xtext.testing.XtextRunner
|
||||
import org.eclipse.xtext.testing.util.InMemoryURIHandler
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.tests.FileAwareTestLanguageIdeInjectorProvider
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner)
|
||||
@InjectWith(FileAwareTestLanguageIdeInjectorProvider)
|
||||
class FileAwareTestLanguageImportTest {
|
||||
|
||||
@Inject Provider<ChangeSerializer> serializerProvider
|
||||
@Inject extension ImportTestHelper
|
||||
|
||||
@Test
|
||||
def void testRenameGlobal1() {
|
||||
val fs = new InMemoryURIHandler()
|
||||
fs += "inmemory:/file1.fileawaretestlanguage" -> '''
|
||||
package pkg1
|
||||
|
||||
element Foo {
|
||||
}
|
||||
'''
|
||||
fs += "inmemory:/file2.fileawaretestlanguage" -> '''
|
||||
package pkg2
|
||||
|
||||
import pkg1.Foo
|
||||
|
||||
element Bar {
|
||||
ref Foo
|
||||
}
|
||||
'''
|
||||
|
||||
val rs = fs.createResourceSet
|
||||
val model = rs.contents("inmemory:/file1.fileawaretestlanguage", PackageDeclaration)
|
||||
|
||||
val serializer = serializerProvider.get()
|
||||
serializer.beginRecordChanges(model.eResource)
|
||||
model.name = "newpackage"
|
||||
Assert.assertEquals(1, model.eResource.resourceSet.resources.size)
|
||||
serializer.endRecordChangesToTextDocuments === '''
|
||||
---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
package <8:4|newpackage>
|
||||
|
||||
element Foo {
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
8 4 "pkg1" -> "newpackage"
|
||||
---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
package pkg2
|
||||
|
||||
import <21:8|newpackage.Foo>
|
||||
|
||||
element Bar {
|
||||
ref Foo
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
21 8 "pkg1.Foo" -> "newpackage.Foo"
|
||||
'''
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testMoveToNewPackage() {
|
||||
val fs = new InMemoryURIHandler()
|
||||
fs += "inmemory:/file1.fileawaretestlanguage" -> '''
|
||||
package pkg1
|
||||
|
||||
element Foo {
|
||||
}
|
||||
'''
|
||||
fs += "inmemory:/file2.fileawaretestlanguage" -> '''
|
||||
package pkg1
|
||||
|
||||
element Bar {
|
||||
ref Foo
|
||||
}
|
||||
'''
|
||||
|
||||
val rs = fs.createResourceSet
|
||||
val model = rs.contents("inmemory:/file1.fileawaretestlanguage", PackageDeclaration)
|
||||
|
||||
val serializer = serializerProvider.get()
|
||||
serializer.beginRecordChanges(model.eResource)
|
||||
model.name = "newpackage"
|
||||
Assert.assertEquals(1, model.eResource.resourceSet.resources.size)
|
||||
serializer.endRecordChangesToTextDocuments === '''
|
||||
---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
package <8:4|newpackage>
|
||||
|
||||
element Foo {
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
8 4 "pkg1" -> "newpackage"
|
||||
---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
<0:39|package pkg1
|
||||
|
||||
import newpackage.Foo
|
||||
|
||||
element Bar {
|
||||
ref Foo
|
||||
}
|
||||
>
|
||||
--------------------------------------------------------------------------------
|
||||
0 39 "package pkg1\n\nele..." -> "package pkg1\n\nimp..."
|
||||
'''
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testMoveIntoLocalPackage() {
|
||||
val fs = new InMemoryURIHandler()
|
||||
fs += "inmemory:/file1.fileawaretestlanguage" -> '''
|
||||
package other
|
||||
|
||||
element Foo {
|
||||
}
|
||||
'''
|
||||
fs += "inmemory:/file2.fileawaretestlanguage" -> '''
|
||||
package pkg1
|
||||
|
||||
import other.Foo
|
||||
|
||||
element Bar {
|
||||
ref Foo
|
||||
}
|
||||
'''
|
||||
|
||||
val rs = fs.createResourceSet
|
||||
val model = rs.contents("inmemory:/file1.fileawaretestlanguage", PackageDeclaration)
|
||||
|
||||
val serializer = serializerProvider.get()
|
||||
serializer.beginRecordChanges(model.eResource)
|
||||
model.name = "pkg1"
|
||||
Assert.assertEquals(1, model.eResource.resourceSet.resources.size)
|
||||
serializer.endRecordChangesToTextDocuments === '''
|
||||
---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
package <8:5|pkg1>
|
||||
|
||||
element Foo {
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
8 5 "other" -> "pkg1"
|
||||
---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------
|
||||
package pkg1<12:20|
|
||||
|
||||
>element Bar {
|
||||
ref Foo
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
12 20 "\n\nimport other.Foo\n\n" -> "\n\n"
|
||||
'''
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2017 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.importHandling
|
||||
|
||||
import com.google.common.base.Preconditions
|
||||
import com.google.inject.Inject
|
||||
import java.util.Collection
|
||||
import org.eclipse.emf.common.util.URI
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil
|
||||
import org.eclipse.xtext.formatting2.debug.TextRegionAccessToString
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess
|
||||
import org.eclipse.xtext.ide.serializer.IChangeSerializer
|
||||
import org.eclipse.xtext.ide.serializer.IEmfResourceChange
|
||||
import org.eclipse.xtext.ide.serializer.debug.TextDocumentChangeToString
|
||||
import org.eclipse.xtext.ide.serializer.impl.TextDocumentChange
|
||||
import org.eclipse.xtext.resource.IResourceDescription
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
import org.eclipse.xtext.resource.XtextResourceSet
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsData
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider
|
||||
import org.eclipse.xtext.testing.util.InMemoryURIHandler
|
||||
import org.eclipse.xtext.testing.validation.ValidationTestHelper
|
||||
import org.eclipse.xtext.util.CollectionBasedAcceptor
|
||||
import org.junit.Assert
|
||||
|
||||
/**
|
||||
* TODO: de-duplicate with /xtext-core/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/serializer/ChangeSerializerTestHelper.xtend
|
||||
*
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
class ImportTestHelper {
|
||||
@Inject IResourceDescription.Manager rdManager
|
||||
@Inject ValidationTestHelper validator
|
||||
|
||||
def void ===(Collection<IEmfResourceChange> actual, CharSequence expected) {
|
||||
val actualString = new TextDocumentChangeToString().add(actual).toString
|
||||
Assert.assertEquals(expected.toString.trim, actualString.trim)
|
||||
}
|
||||
|
||||
def void ===(ITextRegionAccess actual, CharSequence expected) {
|
||||
val actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation().toString
|
||||
Assert.assertEquals(expected.toString.trim, actualString.trim)
|
||||
}
|
||||
|
||||
def void +=(InMemoryURIHandler handler, Pair<String, String> file) {
|
||||
val f = handler.getInMemoryFile(URI.createURI(file.key))
|
||||
f.contents = file.value.bytes
|
||||
f.exists = true
|
||||
}
|
||||
|
||||
def ResourceSet createResourceSet(InMemoryURIHandler fs) {
|
||||
val idx = new XtextResourceSet
|
||||
idx.getURIConverter.getURIHandlers.add(0, fs)
|
||||
for (f : fs.files.values) {
|
||||
idx.getResource(f.uri, true)
|
||||
}
|
||||
EcoreUtil.resolveAll(idx)
|
||||
idx.resources.filter(XtextResource).forEach[validator.assertNoErrors(it)]
|
||||
val rsd = idx.resources.map[rdManager.getResourceDescription(it)]
|
||||
val data = new ResourceDescriptionsData(rsd)
|
||||
|
||||
val r = new XtextResourceSet
|
||||
r.getLoadOptions().put(ResourceDescriptionsProvider.LIVE_SCOPE, Boolean.TRUE);
|
||||
r.getURIConverter.getURIHandlers.add(0, fs)
|
||||
ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(r, data)
|
||||
return r;
|
||||
}
|
||||
|
||||
def <T> T contents(ResourceSet rs, String fileName, Class<T> type) {
|
||||
val result = rs.getResource(URI.createURI(fileName), true).contents.filter(type).head
|
||||
Preconditions.checkNotNull(result)
|
||||
return result
|
||||
}
|
||||
|
||||
def ITextRegionAccess endRecordChangesToTextRegions(IChangeSerializer ser) {
|
||||
return ser.endRecordChangesToTextDocuments.filter(TextDocumentChange).head.textRegionAccess
|
||||
}
|
||||
|
||||
def Collection<IEmfResourceChange> endRecordChangesToTextDocuments(IChangeSerializer ser) {
|
||||
val list = newArrayList()
|
||||
ser.endRecordChanges(CollectionBasedAcceptor.of(list))
|
||||
return list
|
||||
}
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
/**
|
||||
* Copyright (c) 2017 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.importHandling;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.util.Collection;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.serializer.IEmfResourceChange;
|
||||
import org.eclipse.xtext.ide.serializer.impl.ChangeSerializer;
|
||||
import org.eclipse.xtext.ide.tests.importHandling.ImportTestHelper;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
import org.eclipse.xtext.testing.XtextRunner;
|
||||
import org.eclipse.xtext.testing.util.InMemoryURIHandler;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.tests.FileAwareTestLanguageIdeInjectorProvider;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner.class)
|
||||
@InjectWith(FileAwareTestLanguageIdeInjectorProvider.class)
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageImportTest {
|
||||
@Inject
|
||||
private Provider<ChangeSerializer> serializerProvider;
|
||||
|
||||
@Inject
|
||||
@Extension
|
||||
private ImportTestHelper _importTestHelper;
|
||||
|
||||
@Test
|
||||
public void testRenameGlobal1() {
|
||||
final InMemoryURIHandler fs = new InMemoryURIHandler();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package pkg1");
|
||||
_builder.newLine();
|
||||
_builder.newLine();
|
||||
_builder.append("element Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
Pair<String, String> _mappedTo = Pair.<String, String>of("inmemory:/file1.fileawaretestlanguage", _builder.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("package pkg2");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("import pkg1.Foo");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("element Bar {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("ref Foo");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("inmemory:/file2.fileawaretestlanguage", _builder_1.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo_1);
|
||||
final ResourceSet rs = this._importTestHelper.createResourceSet(fs);
|
||||
final PackageDeclaration model = this._importTestHelper.<PackageDeclaration>contents(rs, "inmemory:/file1.fileawaretestlanguage", PackageDeclaration.class);
|
||||
final ChangeSerializer serializer = this.serializerProvider.get();
|
||||
serializer.beginRecordChanges(model.eResource());
|
||||
model.setName("newpackage");
|
||||
Assert.assertEquals(1, model.eResource().getResourceSet().getResources().size());
|
||||
Collection<IEmfResourceChange> _endRecordChangesToTextDocuments = this._importTestHelper.endRecordChangesToTextDocuments(serializer);
|
||||
StringConcatenation _builder_2 = new StringConcatenation();
|
||||
_builder_2.append("---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("package <8:4|newpackage>");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("element Foo {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("8 4 \"pkg1\" -> \"newpackage\"");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("package pkg2");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("import <21:8|newpackage.Foo>");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("element Bar {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("\t");
|
||||
_builder_2.append("ref Foo");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("21 8 \"pkg1.Foo\" -> \"newpackage.Foo\"");
|
||||
_builder_2.newLine();
|
||||
this._importTestHelper.operator_tripleEquals(_endRecordChangesToTextDocuments, _builder_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoveToNewPackage() {
|
||||
final InMemoryURIHandler fs = new InMemoryURIHandler();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package pkg1");
|
||||
_builder.newLine();
|
||||
_builder.newLine();
|
||||
_builder.append("element Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
Pair<String, String> _mappedTo = Pair.<String, String>of("inmemory:/file1.fileawaretestlanguage", _builder.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("package pkg1");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("element Bar {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("ref Foo");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("inmemory:/file2.fileawaretestlanguage", _builder_1.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo_1);
|
||||
final ResourceSet rs = this._importTestHelper.createResourceSet(fs);
|
||||
final PackageDeclaration model = this._importTestHelper.<PackageDeclaration>contents(rs, "inmemory:/file1.fileawaretestlanguage", PackageDeclaration.class);
|
||||
final ChangeSerializer serializer = this.serializerProvider.get();
|
||||
serializer.beginRecordChanges(model.eResource());
|
||||
model.setName("newpackage");
|
||||
Assert.assertEquals(1, model.eResource().getResourceSet().getResources().size());
|
||||
Collection<IEmfResourceChange> _endRecordChangesToTextDocuments = this._importTestHelper.endRecordChangesToTextDocuments(serializer);
|
||||
StringConcatenation _builder_2 = new StringConcatenation();
|
||||
_builder_2.append("---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("package <8:4|newpackage>");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("element Foo {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("8 4 \"pkg1\" -> \"newpackage\"");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("<0:39|package pkg1");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("import newpackage.Foo");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("element Bar {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("\t");
|
||||
_builder_2.append("ref Foo");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append(">");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("0 39 \"package pkg1\\n\\nele...\" -> \"package pkg1\\n\\nimp...\"");
|
||||
_builder_2.newLine();
|
||||
this._importTestHelper.operator_tripleEquals(_endRecordChangesToTextDocuments, _builder_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoveIntoLocalPackage() {
|
||||
final InMemoryURIHandler fs = new InMemoryURIHandler();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package other");
|
||||
_builder.newLine();
|
||||
_builder.newLine();
|
||||
_builder.append("element Foo {");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
Pair<String, String> _mappedTo = Pair.<String, String>of("inmemory:/file1.fileawaretestlanguage", _builder.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("package pkg1");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("import other.Foo");
|
||||
_builder_1.newLine();
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("element Bar {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("ref Foo");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("}");
|
||||
_builder_1.newLine();
|
||||
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("inmemory:/file2.fileawaretestlanguage", _builder_1.toString());
|
||||
this._importTestHelper.operator_add(fs, _mappedTo_1);
|
||||
final ResourceSet rs = this._importTestHelper.createResourceSet(fs);
|
||||
final PackageDeclaration model = this._importTestHelper.<PackageDeclaration>contents(rs, "inmemory:/file1.fileawaretestlanguage", PackageDeclaration.class);
|
||||
final ChangeSerializer serializer = this.serializerProvider.get();
|
||||
serializer.beginRecordChanges(model.eResource());
|
||||
model.setName("pkg1");
|
||||
Assert.assertEquals(1, model.eResource().getResourceSet().getResources().size());
|
||||
Collection<IEmfResourceChange> _endRecordChangesToTextDocuments = this._importTestHelper.endRecordChangesToTextDocuments(serializer);
|
||||
StringConcatenation _builder_2 = new StringConcatenation();
|
||||
_builder_2.append("---------------- inmemory:/file1.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("package <8:5|pkg1>");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("element Foo {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("8 5 \"other\" -> \"pkg1\"");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("---------------- inmemory:/file2.fileawaretestlanguage (syntax: <offset|text>) ----------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("package pkg1<12:20|");
|
||||
_builder_2.newLine();
|
||||
_builder_2.newLine();
|
||||
_builder_2.append(">element Bar {");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("\t");
|
||||
_builder_2.append("ref Foo");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("--------------------------------------------------------------------------------");
|
||||
_builder_2.newLine();
|
||||
_builder_2.append("12 20 \"\\n\\nimport other.Foo\\n\\n\" -> \"\\n\\n\"");
|
||||
_builder_2.newLine();
|
||||
this._importTestHelper.operator_tripleEquals(_endRecordChangesToTextDocuments, _builder_2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* Copyright (c) 2017 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.importHandling;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.formatting2.debug.TextRegionAccessToString;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
|
||||
import org.eclipse.xtext.ide.serializer.IChangeSerializer;
|
||||
import org.eclipse.xtext.ide.serializer.IEmfResourceChange;
|
||||
import org.eclipse.xtext.ide.serializer.debug.TextDocumentChangeToString;
|
||||
import org.eclipse.xtext.ide.serializer.impl.TextDocumentChange;
|
||||
import org.eclipse.xtext.resource.IResourceDescription;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsData;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
|
||||
import org.eclipse.xtext.testing.util.InMemoryURIHandler;
|
||||
import org.eclipse.xtext.testing.validation.ValidationTestHelper;
|
||||
import org.eclipse.xtext.util.CollectionBasedAcceptor;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.ListExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Pair;
|
||||
import org.junit.Assert;
|
||||
|
||||
/**
|
||||
* TODO: de-duplicate with /xtext-core/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/serializer/ChangeSerializerTestHelper.xtend
|
||||
*
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class ImportTestHelper {
|
||||
@Inject
|
||||
private IResourceDescription.Manager rdManager;
|
||||
|
||||
@Inject
|
||||
private ValidationTestHelper validator;
|
||||
|
||||
public void operator_tripleEquals(final Collection<IEmfResourceChange> actual, final CharSequence expected) {
|
||||
final String actualString = new TextDocumentChangeToString().add(actual).toString();
|
||||
Assert.assertEquals(expected.toString().trim(), actualString.trim());
|
||||
}
|
||||
|
||||
public void operator_tripleEquals(final ITextRegionAccess actual, final CharSequence expected) {
|
||||
final String actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation().toString();
|
||||
Assert.assertEquals(expected.toString().trim(), actualString.trim());
|
||||
}
|
||||
|
||||
public void operator_add(final InMemoryURIHandler handler, final Pair<String, String> file) {
|
||||
final InMemoryURIHandler.InMemFile f = handler.getInMemoryFile(URI.createURI(file.getKey()));
|
||||
f.setContents(file.getValue().getBytes());
|
||||
f.setExists(true);
|
||||
}
|
||||
|
||||
public ResourceSet createResourceSet(final InMemoryURIHandler fs) {
|
||||
final XtextResourceSet idx = new XtextResourceSet();
|
||||
idx.getURIConverter().getURIHandlers().add(0, fs);
|
||||
Collection<InMemoryURIHandler.InMemFile> _values = fs.getFiles().values();
|
||||
for (final InMemoryURIHandler.InMemFile f : _values) {
|
||||
idx.getResource(f.getUri(), true);
|
||||
}
|
||||
EcoreUtil.resolveAll(idx);
|
||||
final Consumer<XtextResource> _function = (XtextResource it) -> {
|
||||
this.validator.assertNoErrors(it);
|
||||
};
|
||||
Iterables.<XtextResource>filter(idx.getResources(), XtextResource.class).forEach(_function);
|
||||
final Function1<Resource, IResourceDescription> _function_1 = (Resource it) -> {
|
||||
return this.rdManager.getResourceDescription(it);
|
||||
};
|
||||
final List<IResourceDescription> rsd = ListExtensions.<Resource, IResourceDescription>map(idx.getResources(), _function_1);
|
||||
final ResourceDescriptionsData data = new ResourceDescriptionsData(rsd);
|
||||
final XtextResourceSet r = new XtextResourceSet();
|
||||
r.getLoadOptions().put(ResourceDescriptionsProvider.LIVE_SCOPE, Boolean.TRUE);
|
||||
r.getURIConverter().getURIHandlers().add(0, fs);
|
||||
ResourceDescriptionsData.ResourceSetAdapter.installResourceDescriptionsData(r, data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public <T extends Object> T contents(final ResourceSet rs, final String fileName, final Class<T> type) {
|
||||
final T result = IterableExtensions.<T>head(Iterables.<T>filter(rs.getResource(URI.createURI(fileName), true).getContents(), type));
|
||||
Preconditions.<T>checkNotNull(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ITextRegionAccess endRecordChangesToTextRegions(final IChangeSerializer ser) {
|
||||
return IterableExtensions.<TextDocumentChange>head(Iterables.<TextDocumentChange>filter(this.endRecordChangesToTextDocuments(ser), TextDocumentChange.class)).getTextRegionAccess();
|
||||
}
|
||||
|
||||
public Collection<IEmfResourceChange> endRecordChangesToTextDocuments(final IChangeSerializer ser) {
|
||||
final ArrayList<IEmfResourceChange> list = CollectionLiterals.<IEmfResourceChange>newArrayList();
|
||||
ser.endRecordChanges(CollectionBasedAcceptor.<IEmfResourceChange>of(list));
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ import org.eclipse.xtext.ide.serializer.IChangeSerializer
|
|||
import org.eclipse.xtext.resource.IResourceServiceProvider
|
||||
import java.util.Map
|
||||
import static org.eclipse.xtext.ide.refactoring.RefactoringIssueAcceptor.Severity.*
|
||||
import org.apache.log4j.Logger
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
|
@ -26,6 +27,8 @@ import static org.eclipse.xtext.ide.refactoring.RefactoringIssueAcceptor.Severit
|
|||
*/
|
||||
@FinalFieldsConstructor
|
||||
class MoveResourceContext {
|
||||
|
||||
static val LOG = Logger.getLogger(MoveResourceContext)
|
||||
|
||||
@Accessors(PUBLIC_GETTER) val List<ResourceURIChange> fileChanges
|
||||
@Accessors(PUBLIC_GETTER) val List<ResourceURIChange> folderChanges
|
||||
|
@ -45,6 +48,7 @@ class MoveResourceContext {
|
|||
modifications.put(resource, modification)
|
||||
} catch (Throwable t) {
|
||||
issueAcceptor.add(ERROR, 'Error loading resource ' + uri?.toString, t)
|
||||
LOG.error(t)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +58,7 @@ class MoveResourceContext {
|
|||
value.modify(key)
|
||||
} catch (Throwable t) {
|
||||
issueAcceptor.add(ERROR, 'Error executing modification on resource ' + key?.URI?.toString, t)
|
||||
LOG.error(t)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.google.inject.Inject;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
|
@ -43,6 +44,8 @@ public class MoveResourceContext {
|
|||
}
|
||||
}
|
||||
|
||||
private final static Logger LOG = Logger.getLogger(MoveResourceContext.class);
|
||||
|
||||
@Accessors(AccessorType.PUBLIC_GETTER)
|
||||
private final List<ResourceURIChange> fileChanges;
|
||||
|
||||
|
@ -79,6 +82,7 @@ public class MoveResourceContext {
|
|||
}
|
||||
String _plus = ("Error loading resource " + _string);
|
||||
this.issueAcceptor.add(RefactoringIssueAcceptor.Severity.ERROR, _plus, t);
|
||||
MoveResourceContext.LOG.error(t);
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
|
@ -104,6 +108,7 @@ public class MoveResourceContext {
|
|||
}
|
||||
String _plus = ("Error executing modification on resource " + _string);
|
||||
this.issueAcceptor.add(RefactoringIssueAcceptor.Severity.ERROR, _plus, t);
|
||||
MoveResourceContext.LOG.error(t);
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Common Xtext Testlanguages for UI and Runtime - IDE Features
|
||||
Bundle-SymbolicName: org.eclipse.xtext.testlanguages.ide;singleton:=true
|
||||
Bundle-Version: 2.13.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-Vendor: Eclipse Xtext
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.lexer,
|
||||
org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr
|
||||
Require-Bundle: org.eclipse.xtext.ide;visibility:=reexport,
|
||||
org.eclipse.xtext.testlanguages,
|
||||
org.antlr.runtime
|
||||
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Common Xtext Testlanguages for UI and Runtime - IDE Features
|
||||
Bundle-SymbolicName: org.eclipse.xtext.testlanguages.ide;singleton:=true
|
||||
Bundle-Version: 2.13.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-Vendor: Eclipse Xtext
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.backtracking.ide.contentassist.antlr.lexer,
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide,
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide.refactoring,
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide.tests,
|
||||
org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.noJdt.ide.contentassist.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.ide.contentassist.antlr.internal
|
||||
Require-Bundle: org.eclipse.xtext.ide;visibility:=reexport,
|
||||
org.eclipse.xtext.testlanguages,
|
||||
org.antlr.runtime,
|
||||
org.eclipse.xtend.lib;bundle-version="2.13.0"
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@ org.eclipse.xtext.testlanguages.backtracking.ide.SimpleBeeLangTestLanguageIdeSet
|
|||
org.eclipse.xtext.testlanguages.backtracking.ide.ExBeeLangTestLanguageIdeSetup
|
||||
org.eclipse.xtext.testlanguages.noJdt.ide.NoJdtTestLanguageIdeSetup
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.ide.XtextGrammarTestLanguageIdeSetup
|
||||
org.eclipse.xtext.testlanguages.fileAware.ide.FileAwareTestLanguageIdeSetup
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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.FQNPrefixMatcher;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
|
||||
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.contentassist.antlr.FileAwareTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.contentassist.antlr.internal.InternalFileAwareTestLanguageLexer;
|
||||
|
||||
/**
|
||||
* Manual modifications go to {@link FileAwareTestLanguageIdeModule}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractFileAwareTestLanguageIdeModule 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(InternalFileAwareTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IContentAssistParser> bindIContentAssistParser() {
|
||||
return FileAwareTestLanguageParser.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends IProposalConflictHelper> bindIProposalConflictHelper() {
|
||||
return AntlrProposalConflictHelper.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
|
||||
public Class<? extends IPrefixMatcher> bindIPrefixMatcher() {
|
||||
return FQNPrefixMatcher.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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.AbstractContentAssistParser;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.contentassist.antlr.internal.InternalFileAwareTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
public class FileAwareTestLanguageParser extends AbstractContentAssistParser {
|
||||
|
||||
@Inject
|
||||
private FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
private Map<AbstractElement, String> nameMappings;
|
||||
|
||||
@Override
|
||||
protected InternalFileAwareTestLanguageParser createParser() {
|
||||
InternalFileAwareTestLanguageParser result = new InternalFileAwareTestLanguageParser(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.getElementAccess().getAlternatives_3(), "rule__Element__Alternatives_3");
|
||||
put(grammarAccess.getPackageDeclarationAccess().getGroup(), "rule__PackageDeclaration__Group__0");
|
||||
put(grammarAccess.getImportAccess().getGroup(), "rule__Import__Group__0");
|
||||
put(grammarAccess.getElementAccess().getGroup(), "rule__Element__Group__0");
|
||||
put(grammarAccess.getElementAccess().getGroup_3_1(), "rule__Element__Group_3_1__0");
|
||||
put(grammarAccess.getQualifiedNameAccess().getGroup(), "rule__QualifiedName__Group__0");
|
||||
put(grammarAccess.getQualifiedNameAccess().getGroup_1(), "rule__QualifiedName__Group_1__0");
|
||||
put(grammarAccess.getPackageDeclarationAccess().getNameAssignment_1(), "rule__PackageDeclaration__NameAssignment_1");
|
||||
put(grammarAccess.getPackageDeclarationAccess().getImportsAssignment_2(), "rule__PackageDeclaration__ImportsAssignment_2");
|
||||
put(grammarAccess.getPackageDeclarationAccess().getContentsAssignment_3(), "rule__PackageDeclaration__ContentsAssignment_3");
|
||||
put(grammarAccess.getImportAccess().getElementAssignment_1(), "rule__Import__ElementAssignment_1");
|
||||
put(grammarAccess.getElementAccess().getNameAssignment_1(), "rule__Element__NameAssignment_1");
|
||||
put(grammarAccess.getElementAccess().getContentsAssignment_3_0(), "rule__Element__ContentsAssignment_3_0");
|
||||
put(grammarAccess.getElementAccess().getRefAssignment_3_1_1(), "rule__Element__RefAssignment_3_1_1");
|
||||
}
|
||||
};
|
||||
}
|
||||
return nameMappings.get(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getInitialHiddenTokens() {
|
||||
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
|
||||
}
|
||||
|
||||
public FileAwareTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return this.grammarAccess;
|
||||
}
|
||||
|
||||
public void setGrammarAccess(FileAwareTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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 PartialFileAwareTestLanguageContentAssistParser extends FileAwareTestLanguageParser 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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,757 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
grammar InternalFileAwareTestLanguage;
|
||||
|
||||
options {
|
||||
superClass=AbstractInternalContentAssistParser;
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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.testlanguages.fileAware.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.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
}
|
||||
@parser::members {
|
||||
private FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public void setGrammarAccess(FileAwareTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Grammar getGrammar() {
|
||||
return grammarAccess.getGrammar();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getValueForTokenName(String tokenName) {
|
||||
return tokenName;
|
||||
}
|
||||
}
|
||||
|
||||
// Entry rule entryRulePackageDeclaration
|
||||
entryRulePackageDeclaration
|
||||
:
|
||||
{ before(grammarAccess.getPackageDeclarationRule()); }
|
||||
rulePackageDeclaration
|
||||
{ after(grammarAccess.getPackageDeclarationRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule PackageDeclaration
|
||||
rulePackageDeclaration
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getGroup()); }
|
||||
(rule__PackageDeclaration__Group__0)
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
// Entry rule entryRuleImport
|
||||
entryRuleImport
|
||||
:
|
||||
{ before(grammarAccess.getImportRule()); }
|
||||
ruleImport
|
||||
{ after(grammarAccess.getImportRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule Import
|
||||
ruleImport
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getImportAccess().getGroup()); }
|
||||
(rule__Import__Group__0)
|
||||
{ after(grammarAccess.getImportAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
// Entry rule entryRuleElement
|
||||
entryRuleElement
|
||||
:
|
||||
{ before(grammarAccess.getElementRule()); }
|
||||
ruleElement
|
||||
{ after(grammarAccess.getElementRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule Element
|
||||
ruleElement
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getGroup()); }
|
||||
(rule__Element__Group__0)
|
||||
{ after(grammarAccess.getElementAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
// Entry rule entryRuleQualifiedName
|
||||
entryRuleQualifiedName
|
||||
:
|
||||
{ before(grammarAccess.getQualifiedNameRule()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getQualifiedNameRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule QualifiedName
|
||||
ruleQualifiedName
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getQualifiedNameAccess().getGroup()); }
|
||||
(rule__QualifiedName__Group__0)
|
||||
{ after(grammarAccess.getQualifiedNameAccess().getGroup()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Alternatives_3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getContentsAssignment_3_0()); }
|
||||
(rule__Element__ContentsAssignment_3_0)
|
||||
{ after(grammarAccess.getElementAccess().getContentsAssignment_3_0()); }
|
||||
)
|
||||
|
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getGroup_3_1()); }
|
||||
(rule__Element__Group_3_1__0)
|
||||
{ after(grammarAccess.getElementAccess().getGroup_3_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__0__Impl
|
||||
rule__PackageDeclaration__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getPackageKeyword_0()); }
|
||||
'package'
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getPackageKeyword_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__1__Impl
|
||||
rule__PackageDeclaration__Group__2
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getNameAssignment_1()); }
|
||||
(rule__PackageDeclaration__NameAssignment_1)
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getNameAssignment_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__2
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__2__Impl
|
||||
rule__PackageDeclaration__Group__3
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__2__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getImportsAssignment_2()); }
|
||||
(rule__PackageDeclaration__ImportsAssignment_2)*
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getImportsAssignment_2()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__3__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__3__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getContentsAssignment_3()); }
|
||||
(rule__PackageDeclaration__ContentsAssignment_3)*
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getContentsAssignment_3()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__Import__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Import__Group__0__Impl
|
||||
rule__Import__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Import__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getImportAccess().getImportKeyword_0()); }
|
||||
'import'
|
||||
{ after(grammarAccess.getImportAccess().getImportKeyword_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Import__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Import__Group__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Import__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getImportAccess().getElementAssignment_1()); }
|
||||
(rule__Import__ElementAssignment_1)
|
||||
{ after(grammarAccess.getImportAccess().getElementAssignment_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__Element__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group__0__Impl
|
||||
rule__Element__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getElementKeyword_0()); }
|
||||
'element'
|
||||
{ after(grammarAccess.getElementAccess().getElementKeyword_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group__1__Impl
|
||||
rule__Element__Group__2
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getNameAssignment_1()); }
|
||||
(rule__Element__NameAssignment_1)
|
||||
{ after(grammarAccess.getElementAccess().getNameAssignment_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__2
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group__2__Impl
|
||||
rule__Element__Group__3
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__2__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getLeftCurlyBracketKeyword_2()); }
|
||||
'{'
|
||||
{ after(grammarAccess.getElementAccess().getLeftCurlyBracketKeyword_2()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group__3__Impl
|
||||
rule__Element__Group__4
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__3__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getAlternatives_3()); }
|
||||
(rule__Element__Alternatives_3)*
|
||||
{ after(grammarAccess.getElementAccess().getAlternatives_3()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__4
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group__4__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group__4__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getRightCurlyBracketKeyword_4()); }
|
||||
'}'
|
||||
{ after(grammarAccess.getElementAccess().getRightCurlyBracketKeyword_4()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__Element__Group_3_1__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group_3_1__0__Impl
|
||||
rule__Element__Group_3_1__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group_3_1__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getRefKeyword_3_1_0()); }
|
||||
'ref'
|
||||
{ after(grammarAccess.getElementAccess().getRefKeyword_3_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group_3_1__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__Element__Group_3_1__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__Group_3_1__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getRefAssignment_3_1_1()); }
|
||||
(rule__Element__RefAssignment_3_1_1)
|
||||
{ after(grammarAccess.getElementAccess().getRefAssignment_3_1_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__QualifiedName__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__QualifiedName__Group__0__Impl
|
||||
rule__QualifiedName__Group__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__QualifiedName__Group__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getQualifiedNameAccess().getGroup_1()); }
|
||||
(rule__QualifiedName__Group_1__0)*
|
||||
{ after(grammarAccess.getQualifiedNameAccess().getGroup_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__QualifiedName__Group_1__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__QualifiedName__Group_1__0__Impl
|
||||
rule__QualifiedName__Group_1__1
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group_1__0__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0()); }
|
||||
'.'
|
||||
{ after(grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group_1__1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__QualifiedName__Group_1__1__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__QualifiedName__Group_1__1__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__PackageDeclaration__NameAssignment_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getNameQualifiedNameParserRuleCall_1_0()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getNameQualifiedNameParserRuleCall_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__ImportsAssignment_2
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getImportsImportParserRuleCall_2_0()); }
|
||||
ruleImport
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getImportsImportParserRuleCall_2_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__ContentsAssignment_3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getContentsElementParserRuleCall_3_0()); }
|
||||
ruleElement
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getContentsElementParserRuleCall_3_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Import__ElementAssignment_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getImportAccess().getElementElementCrossReference_1_0()); }
|
||||
(
|
||||
{ before(grammarAccess.getImportAccess().getElementElementQualifiedNameParserRuleCall_1_0_1()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getImportAccess().getElementElementQualifiedNameParserRuleCall_1_0_1()); }
|
||||
)
|
||||
{ after(grammarAccess.getImportAccess().getElementElementCrossReference_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__NameAssignment_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__ContentsAssignment_3_0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getContentsElementParserRuleCall_3_0_0()); }
|
||||
ruleElement
|
||||
{ after(grammarAccess.getElementAccess().getContentsElementParserRuleCall_3_0_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Element__RefAssignment_3_1_1
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getRefElementCrossReference_3_1_1_0()); }
|
||||
(
|
||||
{ before(grammarAccess.getElementAccess().getRefElementQualifiedNameParserRuleCall_3_1_1_0_1()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getElementAccess().getRefElementQualifiedNameParserRuleCall_3_1_1_0_1()); }
|
||||
)
|
||||
{ after(grammarAccess.getElementAccess().getRefElementCrossReference_3_1_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,21 @@
|
|||
'.'=17
|
||||
'element'=13
|
||||
'import'=12
|
||||
'package'=11
|
||||
'ref'=16
|
||||
'{'=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
|
||||
T__17=17
|
|
@ -0,0 +1,960 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.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 InternalFileAwareTestLanguageLexer 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 T__17=17;
|
||||
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 InternalFileAwareTestLanguageLexer() {;}
|
||||
public InternalFileAwareTestLanguageLexer(CharStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalFileAwareTestLanguageLexer(CharStream input, RecognizerSharedState state) {
|
||||
super(input,state);
|
||||
|
||||
}
|
||||
public String getGrammarFileName() { return "InternalFileAwareTestLanguage.g"; }
|
||||
|
||||
// $ANTLR start "T__11"
|
||||
public final void mT__11() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__11;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:11:7: ( 'package' )
|
||||
// InternalFileAwareTestLanguage.g:11:9: 'package'
|
||||
{
|
||||
match("package");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:12:7: ( 'import' )
|
||||
// InternalFileAwareTestLanguage.g:12:9: 'import'
|
||||
{
|
||||
match("import");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:13:7: ( 'element' )
|
||||
// InternalFileAwareTestLanguage.g:13:9: 'element'
|
||||
{
|
||||
match("element");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:14:7: ( '{' )
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:15:7: ( '}' )
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:16:7: ( 'ref' )
|
||||
// InternalFileAwareTestLanguage.g:16:9: 'ref'
|
||||
{
|
||||
match("ref");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__16"
|
||||
|
||||
// $ANTLR start "T__17"
|
||||
public final void mT__17() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__17;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:17:7: ( '.' )
|
||||
// InternalFileAwareTestLanguage.g:17:9: '.'
|
||||
{
|
||||
match('.');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__17"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:745:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalFileAwareTestLanguage.g:745:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:745:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0=='^') ) {
|
||||
alt1=1;
|
||||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:745: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;}
|
||||
|
||||
// InternalFileAwareTestLanguage.g:745: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 :
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:747:10: ( ( '0' .. '9' )+ )
|
||||
// InternalFileAwareTestLanguage.g:747:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:747: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 :
|
||||
// InternalFileAwareTestLanguage.g:747: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;
|
||||
// InternalFileAwareTestLanguage.g:749:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalFileAwareTestLanguage.g:749:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:749: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 :
|
||||
// InternalFileAwareTestLanguage.g:749:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalFileAwareTestLanguage.g:749: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 :
|
||||
// InternalFileAwareTestLanguage.g:749:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:749: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 :
|
||||
// InternalFileAwareTestLanguage.g:749:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalFileAwareTestLanguage.g:749: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 :
|
||||
// InternalFileAwareTestLanguage.g:749:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:749: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;
|
||||
// InternalFileAwareTestLanguage.g:751:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalFileAwareTestLanguage.g:751:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalFileAwareTestLanguage.g:751: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 :
|
||||
// InternalFileAwareTestLanguage.g:751: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;
|
||||
// InternalFileAwareTestLanguage.g:753:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalFileAwareTestLanguage.g:753:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalFileAwareTestLanguage.g:753: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 :
|
||||
// InternalFileAwareTestLanguage.g:753: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);
|
||||
|
||||
// InternalFileAwareTestLanguage.g:753: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 :
|
||||
// InternalFileAwareTestLanguage.g:753:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:753:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
if ( (LA9_0=='\r') ) {
|
||||
alt9=1;
|
||||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:753: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;
|
||||
// InternalFileAwareTestLanguage.g:755:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalFileAwareTestLanguage.g:755:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:755: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 :
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:757:16: ( . )
|
||||
// InternalFileAwareTestLanguage.g:757:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalFileAwareTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=14;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:1:10: T__11
|
||||
{
|
||||
mT__11();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:1:16: T__12
|
||||
{
|
||||
mT__12();
|
||||
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
// InternalFileAwareTestLanguage.g:1:22: T__13
|
||||
{
|
||||
mT__13();
|
||||
|
||||
}
|
||||
break;
|
||||
case 4 :
|
||||
// InternalFileAwareTestLanguage.g:1:28: T__14
|
||||
{
|
||||
mT__14();
|
||||
|
||||
}
|
||||
break;
|
||||
case 5 :
|
||||
// InternalFileAwareTestLanguage.g:1:34: T__15
|
||||
{
|
||||
mT__15();
|
||||
|
||||
}
|
||||
break;
|
||||
case 6 :
|
||||
// InternalFileAwareTestLanguage.g:1:40: T__16
|
||||
{
|
||||
mT__16();
|
||||
|
||||
}
|
||||
break;
|
||||
case 7 :
|
||||
// InternalFileAwareTestLanguage.g:1:46: T__17
|
||||
{
|
||||
mT__17();
|
||||
|
||||
}
|
||||
break;
|
||||
case 8 :
|
||||
// InternalFileAwareTestLanguage.g:1:52: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 9 :
|
||||
// InternalFileAwareTestLanguage.g:1:60: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 10 :
|
||||
// InternalFileAwareTestLanguage.g:1:69: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 11 :
|
||||
// InternalFileAwareTestLanguage.g:1:81: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 12 :
|
||||
// InternalFileAwareTestLanguage.g:1:97: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 13 :
|
||||
// InternalFileAwareTestLanguage.g:1:113: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 14 :
|
||||
// InternalFileAwareTestLanguage.g:1:121: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\3\21\2\uffff\1\21\1\uffff\1\17\2\uffff\3\17\2\uffff\1\21\1\uffff\2\21\2\uffff\1\21\6\uffff\3\21\1\44\3\21\1\uffff\4\21\1\54\1\21\1\56\1\uffff\1\57\2\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\60\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\141\1\155\1\154\2\uffff\1\145\1\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\143\1\uffff\1\160\1\145\2\uffff\1\146\6\uffff\1\153\1\157\1\155\1\60\1\141\1\162\1\145\1\uffff\1\147\1\164\1\156\1\145\1\60\1\164\1\60\1\uffff\1\60\2\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\141\1\155\1\154\2\uffff\1\145\1\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\143\1\uffff\1\160\1\145\2\uffff\1\146\6\uffff\1\153\1\157\1\155\1\172\1\141\1\162\1\145\1\uffff\1\147\1\164\1\156\1\145\1\172\1\164\1\172\1\uffff\1\172\2\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\4\uffff\1\4\1\5\1\uffff\1\7\1\uffff\1\10\1\11\3\uffff\1\15\1\16\1\uffff\1\10\2\uffff\1\4\1\5\1\uffff\1\7\1\11\1\12\1\13\1\14\1\15\7\uffff\1\6\7\uffff\1\2\1\uffff\1\1\1\3";
|
||||
static final String DFA12_specialS =
|
||||
"\1\1\12\uffff\1\0\1\2\43\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\11\17\2\16\2\17\1\16\22\17\1\16\1\17\1\13\4\17\1\14\6\17\1\7\1\15\12\12\7\17\32\11\3\17\1\10\1\11\1\17\4\11\1\3\3\11\1\2\6\11\1\1\1\11\1\6\10\11\1\4\1\17\1\5\uff82\17",
|
||||
"\1\20",
|
||||
"\1\22",
|
||||
"\1\23",
|
||||
"",
|
||||
"",
|
||||
"\1\26",
|
||||
"",
|
||||
"\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
"",
|
||||
"\0\31",
|
||||
"\0\31",
|
||||
"\1\32\4\uffff\1\33",
|
||||
"",
|
||||
"",
|
||||
"\1\35",
|
||||
"",
|
||||
"\1\36",
|
||||
"\1\37",
|
||||
"",
|
||||
"",
|
||||
"\1\40",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\41",
|
||||
"\1\42",
|
||||
"\1\43",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"\1\45",
|
||||
"\1\46",
|
||||
"\1\47",
|
||||
"",
|
||||
"\1\50",
|
||||
"\1\51",
|
||||
"\1\52",
|
||||
"\1\53",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"\1\55",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
||||
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 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
|
||||
}
|
||||
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
|
||||
IntStream input = _input;
|
||||
int _s = s;
|
||||
switch ( s ) {
|
||||
case 0 :
|
||||
int LA12_11 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_11>='\u0000' && LA12_11<='\uFFFF')) ) {s = 25;}
|
||||
|
||||
else s = 15;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( (LA12_0=='p') ) {s = 1;}
|
||||
|
||||
else if ( (LA12_0=='i') ) {s = 2;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 3;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0=='r') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='.') ) {s = 7;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 8;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||(LA12_0>='a' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='o')||LA12_0=='q'||(LA12_0>='s' && LA12_0<='z')) ) {s = 9;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 12;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 13;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 14;}
|
||||
|
||||
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 = 15;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_12 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_12>='\u0000' && LA12_12<='\uFFFF')) ) {s = 25;}
|
||||
|
||||
else s = 15;
|
||||
|
||||
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,23 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.ide;
|
||||
|
||||
import org.eclipse.xtext.ide.refactoring.XtextMoveResourceStrategy;
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdater;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.refactoring.FileAwareTestLanguageMoveResourceStrategy;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.refactoring.FileAwareTestLanguageReferenceUpdater;
|
||||
|
||||
/**
|
||||
* Use this class to register ide components.
|
||||
*/
|
||||
public class FileAwareTestLanguageIdeModule extends AbstractFileAwareTestLanguageIdeModule {
|
||||
|
||||
public Class<? extends XtextMoveResourceStrategy> bindXtextMoveParticipantStrategy() {
|
||||
return FileAwareTestLanguageMoveResourceStrategy.class;
|
||||
}
|
||||
|
||||
public Class<? extends IReferenceUpdater> bindReferenceUpdater() {
|
||||
return FileAwareTestLanguageReferenceUpdater.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.ide;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.util.Modules2;
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages as language servers.
|
||||
*/
|
||||
public class FileAwareTestLanguageIdeSetup extends FileAwareTestLanguageStandaloneSetup {
|
||||
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(Modules2.mixin(new FileAwareTestLanguageRuntimeModule(), new FileAwareTestLanguageIdeModule()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.refactoring
|
||||
|
||||
import org.eclipse.xtext.ide.refactoring.MoveResourceContext
|
||||
import org.eclipse.xtext.ide.refactoring.XtextMoveResourceStrategy
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider
|
||||
|
||||
class FileAwareTestLanguageMoveResourceStrategy implements XtextMoveResourceStrategy {
|
||||
|
||||
@Inject IResourceServiceProvider resourceServiceProvider
|
||||
|
||||
override applyMove(MoveResourceContext context) {
|
||||
for (change : context.fileChanges) {
|
||||
if(resourceServiceProvider.canHandle(change.newURI)) {
|
||||
context.addModification(change.oldURI, [ resource |
|
||||
resource.URI = change.newURI
|
||||
val rootElement = resource.contents.head
|
||||
if (rootElement instanceof PackageDeclaration) {
|
||||
val newPackage = change.newURI.trimSegments(1).segmentsList.drop(2).join('.')
|
||||
rootElement.name = newPackage
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.refactoring
|
||||
|
||||
import javax.inject.Inject
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdaterContext
|
||||
import org.eclipse.xtext.ide.serializer.impl.ReferenceUpdater
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwareFactory
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element
|
||||
|
||||
class FileAwareTestLanguageReferenceUpdater extends ReferenceUpdater {
|
||||
|
||||
@Inject IQualifiedNameProvider names
|
||||
extension FileAwareFactory = FileAwareFactory.eINSTANCE
|
||||
|
||||
override update(IReferenceUpdaterContext context) {
|
||||
super.update(context)
|
||||
val pkg = context.resource.contents.head as PackageDeclaration
|
||||
val pkgName = names.getFullyQualifiedName(pkg)
|
||||
val actual = pkg.imports.toMap[element]
|
||||
val targets = context.updatableReferences.map[targetEObject].filter(Element)
|
||||
val expected = targets.filter[names.getFullyQualifiedName(it).skipLast(1) != pkgName].toSet
|
||||
val toAdd = expected.filter[!actual.containsKey(it)].toSet
|
||||
val toDelete = actual.filter[!expected.contains($0)]
|
||||
if (!toAdd.isEmpty || !toDelete.isEmpty) {
|
||||
context.modifyModel [
|
||||
toDelete.values.forEach[EcoreUtil.remove(it)]
|
||||
toAdd.forEach[e|pkg.imports += createImport => [element = e]]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.tests
|
||||
|
||||
import com.google.inject.Injector
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.FileAwareTestLanguageIdeSetup
|
||||
import org.eclipse.xtext.testlanguages.fileAware.tests.FileAwareTestLanguageInjectorProvider
|
||||
|
||||
class FileAwareTestLanguageIdeInjectorProvider extends FileAwareTestLanguageInjectorProvider {
|
||||
|
||||
override Injector internalCreateInjector() {
|
||||
return new FileAwareTestLanguageIdeSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.refactoring;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.ide.refactoring.MoveResourceContext;
|
||||
import org.eclipse.xtext.ide.refactoring.ResourceModification;
|
||||
import org.eclipse.xtext.ide.refactoring.ResourceURIChange;
|
||||
import org.eclipse.xtext.ide.refactoring.XtextMoveResourceStrategy;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageMoveResourceStrategy implements XtextMoveResourceStrategy {
|
||||
@Inject
|
||||
private IResourceServiceProvider resourceServiceProvider;
|
||||
|
||||
@Override
|
||||
public void applyMove(final MoveResourceContext context) {
|
||||
List<ResourceURIChange> _fileChanges = context.getFileChanges();
|
||||
for (final ResourceURIChange change : _fileChanges) {
|
||||
boolean _canHandle = this.resourceServiceProvider.canHandle(change.getNewURI());
|
||||
if (_canHandle) {
|
||||
final ResourceModification _function = (Resource resource) -> {
|
||||
resource.setURI(change.getNewURI());
|
||||
final EObject rootElement = IterableExtensions.<EObject>head(resource.getContents());
|
||||
if ((rootElement instanceof PackageDeclaration)) {
|
||||
final String newPackage = IterableExtensions.join(IterableExtensions.<String>drop(change.getNewURI().trimSegments(1).segmentsList(), 2), ".");
|
||||
((PackageDeclaration)rootElement).setName(newPackage);
|
||||
}
|
||||
};
|
||||
context.addModification(change.getOldURI(), _function);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.refactoring;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdaterContext;
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IUpdatableReference;
|
||||
import org.eclipse.xtext.ide.serializer.impl.ReferenceUpdater;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwareFactory;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
|
||||
import org.eclipse.xtext.xbase.lib.Functions.Function2;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.ListExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.MapExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageReferenceUpdater extends ReferenceUpdater {
|
||||
@Inject
|
||||
private IQualifiedNameProvider names;
|
||||
|
||||
@Extension
|
||||
private FileAwareFactory _fileAwareFactory = FileAwareFactory.eINSTANCE;
|
||||
|
||||
@Override
|
||||
public void update(final IReferenceUpdaterContext context) {
|
||||
super.update(context);
|
||||
EObject _head = IterableExtensions.<EObject>head(context.getResource().getContents());
|
||||
final PackageDeclaration pkg = ((PackageDeclaration) _head);
|
||||
final QualifiedName pkgName = this.names.getFullyQualifiedName(pkg);
|
||||
final Function1<Import, Element> _function = (Import it) -> {
|
||||
return it.getElement();
|
||||
};
|
||||
final Map<Element, Import> actual = IterableExtensions.<Element, Import>toMap(pkg.getImports(), _function);
|
||||
final Function1<IUpdatableReference, EObject> _function_1 = (IUpdatableReference it) -> {
|
||||
return it.getTargetEObject();
|
||||
};
|
||||
final Iterable<Element> targets = Iterables.<Element>filter(ListExtensions.<IUpdatableReference, EObject>map(context.getUpdatableReferences(), _function_1), Element.class);
|
||||
final Function1<Element, Boolean> _function_2 = (Element it) -> {
|
||||
QualifiedName _skipLast = this.names.getFullyQualifiedName(it).skipLast(1);
|
||||
return Boolean.valueOf((!Objects.equal(_skipLast, pkgName)));
|
||||
};
|
||||
final Set<Element> expected = IterableExtensions.<Element>toSet(IterableExtensions.<Element>filter(targets, _function_2));
|
||||
final Function1<Element, Boolean> _function_3 = (Element it) -> {
|
||||
boolean _containsKey = actual.containsKey(it);
|
||||
return Boolean.valueOf((!_containsKey));
|
||||
};
|
||||
final Set<Element> toAdd = IterableExtensions.<Element>toSet(IterableExtensions.<Element>filter(expected, _function_3));
|
||||
final Function2<Element, Import, Boolean> _function_4 = (Element $0, Import $1) -> {
|
||||
boolean _contains = expected.contains($0);
|
||||
return Boolean.valueOf((!_contains));
|
||||
};
|
||||
final Map<Element, Import> toDelete = MapExtensions.<Element, Import>filter(actual, _function_4);
|
||||
if (((!toAdd.isEmpty()) || (!toDelete.isEmpty()))) {
|
||||
final Runnable _function_5 = () -> {
|
||||
final Consumer<Import> _function_6 = (Import it) -> {
|
||||
EcoreUtil.remove(it);
|
||||
};
|
||||
toDelete.values().forEach(_function_6);
|
||||
final Consumer<Element> _function_7 = (Element e) -> {
|
||||
EList<Import> _imports = pkg.getImports();
|
||||
Import _createImport = this._fileAwareFactory.createImport();
|
||||
final Procedure1<Import> _function_8 = (Import it) -> {
|
||||
it.setElement(e);
|
||||
};
|
||||
Import _doubleArrow = ObjectExtensions.<Import>operator_doubleArrow(_createImport, _function_8);
|
||||
_imports.add(_doubleArrow);
|
||||
};
|
||||
toAdd.forEach(_function_7);
|
||||
};
|
||||
context.modifyModel(_function_5);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.ide.tests;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.ide.FileAwareTestLanguageIdeSetup;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.tests.FileAwareTestLanguageInjectorProvider;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageIdeInjectorProvider extends FileAwareTestLanguageInjectorProvider {
|
||||
@Override
|
||||
public Injector internalCreateInjector() {
|
||||
return new FileAwareTestLanguageIdeSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
|
@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.xtext,
|
|||
org.antlr.runtime,
|
||||
org.eclipse.xtext.xbase.lib,
|
||||
org.eclipse.xtend.lib,
|
||||
org.eclipse.xtext.testing
|
||||
org.eclipse.xtext.testing,
|
||||
org.eclipse.xtext.xbase.testing
|
||||
Import-Package: org.apache.log4j;version="1.2.15",
|
||||
org.hamcrest.core,
|
||||
org.junit;version="4.5.0",
|
||||
|
@ -63,5 +64,18 @@ Export-Package: org.eclipse.xtext.testlanguages.backtracking,
|
|||
org.eclipse.xtext.testlanguages.xtextgrammar.validation,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest.impl,
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest.util
|
||||
org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest.util,
|
||||
org.eclipse.xtext.testlanguages.fileAware.serializer,
|
||||
org.eclipse.xtext.testlanguages.fileAware.fileAware,
|
||||
org.eclipse.xtext.testlanguages.fileAware.parser.antlr,
|
||||
org.eclipse.xtext.testlanguages.fileAware.formatting2,
|
||||
org.eclipse.xtext.testlanguages.fileAware.fileAware.impl,
|
||||
org.eclipse.xtext.testlanguages.fileAware.services,
|
||||
org.eclipse.xtext.testlanguages.fileAware.fileAware.util,
|
||||
org.eclipse.xtext.testlanguages.fileAware.parser.antlr.internal,
|
||||
org.eclipse.xtext.testlanguages.fileAware.validation,
|
||||
org.eclipse.xtext.testlanguages.fileAware.scoping,
|
||||
org.eclipse.xtext.testlanguages.fileAware,
|
||||
org.eclipse.xtext.testlanguages.fileAware.generator,
|
||||
org.eclipse.xtext.testlanguages.fileAware.tests;x-internal=true
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?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="fileAware" nsURI="http://www.eclipse.org/xtext/testlanguage/FileAware"
|
||||
nsPrefix="fileAware">
|
||||
<eClassifiers xsi:type="ecore:EClass" name="PackageDeclaration">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1"
|
||||
eType="#//Import" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1"
|
||||
eType="#//Element" containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Import">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="element" eType="#//Element"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Element">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1"
|
||||
eType="#//Element" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="ref" unique="false" upperBound="-1"
|
||||
eType="#//Element"/>
|
||||
</eClassifiers>
|
||||
</ecore:EPackage>
|
|
@ -0,0 +1,23 @@
|
|||
<?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="generated by Xtext" modelDirectory="/org.eclipse.xtext.testlanguages/src-gen"
|
||||
modelPluginID="org.eclipse.xtext.testlanguages" forceOverwrite="true" modelName="FileAwareTestLanguage"
|
||||
updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
|
||||
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.12">
|
||||
<genPackages prefix="FileAware" basePackage="org.eclipse.xtext.testlanguages.fileAware"
|
||||
disposableProviderFactory="true" fileExtensions="fileawaretestlanguage" ecorePackage="FileAwareTestLanguage.ecore#/">
|
||||
<genClasses ecoreClass="FileAwareTestLanguage.ecore#//PackageDeclaration">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute FileAwareTestLanguage.ecore#//PackageDeclaration/name"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileAwareTestLanguage.ecore#//PackageDeclaration/imports"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileAwareTestLanguage.ecore#//PackageDeclaration/contents"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="FileAwareTestLanguage.ecore#//Import">
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference FileAwareTestLanguage.ecore#//Import/element"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="FileAwareTestLanguage.ecore#//Element">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute FileAwareTestLanguage.ecore#//Element/name"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference FileAwareTestLanguage.ecore#//Element/contents"/>
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference FileAwareTestLanguage.ecore#//Element/ref"/>
|
||||
</genClasses>
|
||||
</genPackages>
|
||||
</genmodel:GenModel>
|
|
@ -19,4 +19,10 @@
|
|||
class = "org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest.XtextGrammarTestPackage"
|
||||
genModel = "model/generated/XtextGrammarTestLanguage.genmodel" />
|
||||
</extension>
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
<package
|
||||
uri = "http://www.eclipse.org/xtext/testlanguage/FileAware"
|
||||
class = "org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage"
|
||||
genModel = "model/generated/FileAwareTestLanguage.genmodel" />
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -19,4 +19,10 @@
|
|||
class = "org.eclipse.xtext.testlanguages.xtextgrammar.xtextGrammarTest.XtextGrammarTestPackage"
|
||||
genModel = "model/generated/XtextGrammarTestLanguage.genmodel" />
|
||||
</extension>
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
<package
|
||||
uri = "http://www.eclipse.org/xtext/testlanguage/FileAware"
|
||||
class = "org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage"
|
||||
genModel = "model/generated/FileAwareTestLanguage.genmodel" />
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware;
|
||||
|
||||
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.formatting2.FormatterPreferenceValuesProvider;
|
||||
import org.eclipse.xtext.formatting2.FormatterPreferences;
|
||||
import org.eclipse.xtext.formatting2.IFormatter2;
|
||||
import org.eclipse.xtext.generator.IGenerator2;
|
||||
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.preferences.IPreferenceValuesProvider;
|
||||
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;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.formatting2.FileAwareTestLanguageFormatter;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.generator.FileAwareTestLanguageGenerator;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.parser.antlr.FileAwareTestLanguageAntlrTokenFileProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.parser.antlr.FileAwareTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.parser.antlr.internal.InternalFileAwareTestLanguageLexer;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.scoping.FileAwareTestLanguageScopeProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.serializer.FileAwareTestLanguageSemanticSequencer;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.serializer.FileAwareTestLanguageSyntacticSequencer;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.validation.FileAwareTestLanguageValidator;
|
||||
|
||||
/**
|
||||
* Manual modifications go to {@link FileAwareTestLanguageRuntimeModule}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractFileAwareTestLanguageRuntimeModule extends DefaultRuntimeModule {
|
||||
|
||||
protected Properties properties = null;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder) {
|
||||
properties = tryBindProperties(binder, "org/eclipse/xtext/testlanguages/fileAware/FileAwareTestLanguage.properties");
|
||||
super.configure(binder);
|
||||
}
|
||||
|
||||
public void configureLanguageName(Binder binder) {
|
||||
binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage");
|
||||
}
|
||||
|
||||
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("fileawaretestlanguage");
|
||||
}
|
||||
|
||||
// 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 FileAwareTestLanguageGrammarAccess.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
|
||||
return FileAwareTestLanguageSemanticSequencer.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
|
||||
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
|
||||
return FileAwareTestLanguageSyntacticSequencer.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 FileAwareTestLanguageParser.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 FileAwareTestLanguageAntlrTokenFileProvider.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
|
||||
public Class<? extends Lexer> bindLexer() {
|
||||
return InternalFileAwareTestLanguageLexer.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 InternalFileAwareTestLanguageLexer> provideInternalFileAwareTestLanguageLexer() {
|
||||
return LexerProvider.create(InternalFileAwareTestLanguageLexer.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(InternalFileAwareTestLanguageLexer.class);
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2
|
||||
@SingletonBinding(eager=true)
|
||||
public Class<? extends FileAwareTestLanguageValidator> bindFileAwareTestLanguageValidator() {
|
||||
return FileAwareTestLanguageValidator.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
|
||||
public Class<? extends IScopeProvider> bindIScopeProvider() {
|
||||
return FileAwareTestLanguageScopeProvider.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 FileAwareTestLanguageGenerator.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
|
||||
public Class<? extends IFormatter2> bindIFormatter2() {
|
||||
return FileAwareTestLanguageFormatter.class;
|
||||
}
|
||||
|
||||
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
|
||||
public void configureFormatterPreferences(Binder binder) {
|
||||
binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware;
|
||||
|
||||
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.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageStandaloneSetupGenerated implements ISetup {
|
||||
|
||||
@Override
|
||||
public Injector createInjectorAndDoEMFRegistration() {
|
||||
TerminalsStandaloneSetup.doSetup();
|
||||
|
||||
Injector injector = createInjector();
|
||||
register(injector);
|
||||
return injector;
|
||||
}
|
||||
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(new FileAwareTestLanguageRuntimeModule());
|
||||
}
|
||||
|
||||
public void register(Injector injector) {
|
||||
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/testlanguage/FileAware")) {
|
||||
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/testlanguage/FileAware", FileAwarePackage.eINSTANCE);
|
||||
}
|
||||
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
|
||||
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
|
||||
|
||||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("fileawaretestlanguage", resourceFactory);
|
||||
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("fileawaretestlanguage", serviceProvider);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Element</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getContents <em>Contents</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getRef <em>Ref</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getElement()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface Element 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.testlanguages.fileAware.fileAware.FileAwarePackage#getElement_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#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>Contents</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Contents</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>Contents</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getElement_Contents()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<Element> getContents();
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Ref</b></em>' reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Ref</em>' reference list isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Ref</em>' reference list.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getElement_Ref()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
EList<Element> getRef();
|
||||
|
||||
} // Element
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware;
|
||||
|
||||
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.testlanguages.fileAware.fileAware.FileAwarePackage
|
||||
* @generated
|
||||
*/
|
||||
public interface FileAwareFactory extends EFactory
|
||||
{
|
||||
/**
|
||||
* The singleton instance of the factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
FileAwareFactory eINSTANCE = org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwareFactoryImpl.init();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Package Declaration</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Package Declaration</em>'.
|
||||
* @generated
|
||||
*/
|
||||
PackageDeclaration createPackageDeclaration();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Import</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Import</em>'.
|
||||
* @generated
|
||||
*/
|
||||
Import createImport();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Element</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Element</em>'.
|
||||
* @generated
|
||||
*/
|
||||
Element createElement();
|
||||
|
||||
/**
|
||||
* Returns the package supported by this factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the package supported by this factory.
|
||||
* @generated
|
||||
*/
|
||||
FileAwarePackage getFileAwarePackage();
|
||||
|
||||
} //FileAwareFactory
|
|
@ -0,0 +1,399 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware;
|
||||
|
||||
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.testlanguages.fileAware.fileAware.FileAwareFactory
|
||||
* @model kind="package"
|
||||
* @generated
|
||||
*/
|
||||
public interface FileAwarePackage extends EPackage
|
||||
{
|
||||
/**
|
||||
* The package name.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNAME = "fileAware";
|
||||
|
||||
/**
|
||||
* The package namespace URI.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNS_URI = "http://www.eclipse.org/xtext/testlanguage/FileAware";
|
||||
|
||||
/**
|
||||
* The package namespace name.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
String eNS_PREFIX = "fileAware";
|
||||
|
||||
/**
|
||||
* The singleton instance of the package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
FileAwarePackage eINSTANCE = org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl.init();
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl <em>Package Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
int PACKAGE_DECLARATION = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION__NAME = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Imports</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION__IMPORTS = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Contents</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION__CONTENTS = 2;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Package Declaration</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION_FEATURE_COUNT = 3;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ImportImpl <em>Import</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ImportImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getImport()
|
||||
* @generated
|
||||
*/
|
||||
int IMPORT = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Element</b></em>' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int IMPORT__ELEMENT = 0;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Import</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int IMPORT_FEATURE_COUNT = 1;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl <em>Element</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getElement()
|
||||
* @generated
|
||||
*/
|
||||
int ELEMENT = 2;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int ELEMENT__NAME = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Contents</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int ELEMENT__CONTENTS = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Ref</b></em>' reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int ELEMENT__REF = 2;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Element</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int ELEMENT_FEATURE_COUNT = 3;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration <em>Package Declaration</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Package Declaration</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
* @generated
|
||||
*/
|
||||
EClass getPackageDeclaration();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getName()
|
||||
* @see #getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getPackageDeclaration_Name();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getImports <em>Imports</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Imports</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getImports()
|
||||
* @see #getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EReference getPackageDeclaration_Imports();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getContents <em>Contents</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Contents</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getContents()
|
||||
* @see #getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EReference getPackageDeclaration_Contents();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import <em>Import</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Import</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Import
|
||||
* @generated
|
||||
*/
|
||||
EClass getImport();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the reference '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import#getElement <em>Element</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the reference '<em>Element</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Import#getElement()
|
||||
* @see #getImport()
|
||||
* @generated
|
||||
*/
|
||||
EReference getImport_Element();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element <em>Element</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Element</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Element
|
||||
* @generated
|
||||
*/
|
||||
EClass getElement();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getName()
|
||||
* @see #getElement()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getElement_Name();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getContents <em>Contents</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Contents</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getContents()
|
||||
* @see #getElement()
|
||||
* @generated
|
||||
*/
|
||||
EReference getElement_Contents();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the reference list '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getRef <em>Ref</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the reference list '<em>Ref</em>'.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Element#getRef()
|
||||
* @see #getElement()
|
||||
* @generated
|
||||
*/
|
||||
EReference getElement_Ref();
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
FileAwareFactory getFileAwareFactory();
|
||||
|
||||
/**
|
||||
* <!-- 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.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl <em>Package Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EClass PACKAGE_DECLARATION = eINSTANCE.getPackageDeclaration();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute PACKAGE_DECLARATION__NAME = eINSTANCE.getPackageDeclaration_Name();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Imports</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference PACKAGE_DECLARATION__IMPORTS = eINSTANCE.getPackageDeclaration_Imports();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Contents</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference PACKAGE_DECLARATION__CONTENTS = eINSTANCE.getPackageDeclaration_Contents();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ImportImpl <em>Import</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ImportImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getImport()
|
||||
* @generated
|
||||
*/
|
||||
EClass IMPORT = eINSTANCE.getImport();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Element</b></em>' reference feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference IMPORT__ELEMENT = eINSTANCE.getImport_Element();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl <em>Element</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.FileAwarePackageImpl#getElement()
|
||||
* @generated
|
||||
*/
|
||||
EClass ELEMENT = eINSTANCE.getElement();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute ELEMENT__NAME = eINSTANCE.getElement_Name();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Contents</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference ELEMENT__CONTENTS = eINSTANCE.getElement_Contents();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Ref</b></em>' reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference ELEMENT__REF = eINSTANCE.getElement_Ref();
|
||||
|
||||
}
|
||||
|
||||
} //FileAwarePackage
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Import</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import#getElement <em>Element</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getImport()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface Import extends EObject
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Element</b></em>' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Element</em>' reference isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Element</em>' reference.
|
||||
* @see #setElement(Element)
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getImport_Element()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
Element getElement();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import#getElement <em>Element</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Element</em>' reference.
|
||||
* @see #getElement()
|
||||
* @generated
|
||||
*/
|
||||
void setElement(Element value);
|
||||
|
||||
} // Import
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Package Declaration</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getImports <em>Imports</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#getContents <em>Contents</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getPackageDeclaration()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface PackageDeclaration 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.testlanguages.fileAware.fileAware.FileAwarePackage#getPackageDeclaration_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration#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>Imports</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Imports</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>Imports</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getPackageDeclaration_Imports()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<Import> getImports();
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Contents</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Contents</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>Contents</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage#getPackageDeclaration_Contents()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<Element> getContents();
|
||||
|
||||
} // PackageDeclaration
|
|
@ -0,0 +1,277 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.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.EObjectResolvingEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Element</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl#getContents <em>Contents</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ElementImpl#getRef <em>Ref</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class ElementImpl extends MinimalEObjectImpl.Container implements Element
|
||||
{
|
||||
/**
|
||||
* 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 #getContents() <em>Contents</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getContents()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<Element> contents;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getRef() <em>Ref</em>}' reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getRef()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<Element> ref;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected ElementImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return FileAwarePackage.Literals.ELEMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- 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, FileAwarePackage.ELEMENT__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<Element> getContents()
|
||||
{
|
||||
if (contents == null)
|
||||
{
|
||||
contents = new EObjectContainmentEList<Element>(Element.class, this, FileAwarePackage.ELEMENT__CONTENTS);
|
||||
}
|
||||
return contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<Element> getRef()
|
||||
{
|
||||
if (ref == null)
|
||||
{
|
||||
ref = new EObjectResolvingEList<Element>(Element.class, this, FileAwarePackage.ELEMENT__REF);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.ELEMENT__CONTENTS:
|
||||
return ((InternalEList<?>)getContents()).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 FileAwarePackage.ELEMENT__NAME:
|
||||
return getName();
|
||||
case FileAwarePackage.ELEMENT__CONTENTS:
|
||||
return getContents();
|
||||
case FileAwarePackage.ELEMENT__REF:
|
||||
return getRef();
|
||||
}
|
||||
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 FileAwarePackage.ELEMENT__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
case FileAwarePackage.ELEMENT__CONTENTS:
|
||||
getContents().clear();
|
||||
getContents().addAll((Collection<? extends Element>)newValue);
|
||||
return;
|
||||
case FileAwarePackage.ELEMENT__REF:
|
||||
getRef().clear();
|
||||
getRef().addAll((Collection<? extends Element>)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.ELEMENT__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
case FileAwarePackage.ELEMENT__CONTENTS:
|
||||
getContents().clear();
|
||||
return;
|
||||
case FileAwarePackage.ELEMENT__REF:
|
||||
getRef().clear();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.ELEMENT__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
case FileAwarePackage.ELEMENT__CONTENTS:
|
||||
return contents != null && !contents.isEmpty();
|
||||
case FileAwarePackage.ELEMENT__REF:
|
||||
return ref != null && !ref.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();
|
||||
}
|
||||
|
||||
} //ElementImpl
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.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.testlanguages.fileAware.fileAware.*;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Factory</b>.
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public class FileAwareFactoryImpl extends EFactoryImpl implements FileAwareFactory
|
||||
{
|
||||
/**
|
||||
* Creates the default factory implementation.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public static FileAwareFactory init()
|
||||
{
|
||||
try
|
||||
{
|
||||
FileAwareFactory theFileAwareFactory = (FileAwareFactory)EPackage.Registry.INSTANCE.getEFactory(FileAwarePackage.eNS_URI);
|
||||
if (theFileAwareFactory != null)
|
||||
{
|
||||
return theFileAwareFactory;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
EcorePlugin.INSTANCE.log(exception);
|
||||
}
|
||||
return new FileAwareFactoryImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public FileAwareFactoryImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public EObject create(EClass eClass)
|
||||
{
|
||||
switch (eClass.getClassifierID())
|
||||
{
|
||||
case FileAwarePackage.PACKAGE_DECLARATION: return createPackageDeclaration();
|
||||
case FileAwarePackage.IMPORT: return createImport();
|
||||
case FileAwarePackage.ELEMENT: return createElement();
|
||||
default:
|
||||
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PackageDeclaration createPackageDeclaration()
|
||||
{
|
||||
PackageDeclarationImpl packageDeclaration = new PackageDeclarationImpl();
|
||||
return packageDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Import createImport()
|
||||
{
|
||||
ImportImpl import_ = new ImportImpl();
|
||||
return import_;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Element createElement()
|
||||
{
|
||||
ElementImpl element = new ElementImpl();
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public FileAwarePackage getFileAwarePackage()
|
||||
{
|
||||
return (FileAwarePackage)getEPackage();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @deprecated
|
||||
* @generated
|
||||
*/
|
||||
@Deprecated
|
||||
public static FileAwarePackage getPackage()
|
||||
{
|
||||
return FileAwarePackage.eINSTANCE;
|
||||
}
|
||||
|
||||
} //FileAwareFactoryImpl
|
|
@ -0,0 +1,303 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.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.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwareFactory;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Package</b>.
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public class FileAwarePackageImpl extends EPackageImpl implements FileAwarePackage
|
||||
{
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass packageDeclarationEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass importEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass elementEClass = 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.testlanguages.fileAware.fileAware.FileAwarePackage#eNS_URI
|
||||
* @see #init()
|
||||
* @generated
|
||||
*/
|
||||
private FileAwarePackageImpl()
|
||||
{
|
||||
super(eNS_URI, FileAwareFactory.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 FileAwarePackage#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 FileAwarePackage init()
|
||||
{
|
||||
if (isInited) return (FileAwarePackage)EPackage.Registry.INSTANCE.getEPackage(FileAwarePackage.eNS_URI);
|
||||
|
||||
// Obtain or create and register package
|
||||
FileAwarePackageImpl theFileAwarePackage = (FileAwarePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FileAwarePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FileAwarePackageImpl());
|
||||
|
||||
isInited = true;
|
||||
|
||||
// Create package meta-data objects
|
||||
theFileAwarePackage.createPackageContents();
|
||||
|
||||
// Initialize created meta-data
|
||||
theFileAwarePackage.initializePackageContents();
|
||||
|
||||
// Mark meta-data to indicate it can't be changed
|
||||
theFileAwarePackage.freeze();
|
||||
|
||||
|
||||
// Update the registry and return the package
|
||||
EPackage.Registry.INSTANCE.put(FileAwarePackage.eNS_URI, theFileAwarePackage);
|
||||
return theFileAwarePackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getPackageDeclaration()
|
||||
{
|
||||
return packageDeclarationEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getPackageDeclaration_Name()
|
||||
{
|
||||
return (EAttribute)packageDeclarationEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getPackageDeclaration_Imports()
|
||||
{
|
||||
return (EReference)packageDeclarationEClass.getEStructuralFeatures().get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getPackageDeclaration_Contents()
|
||||
{
|
||||
return (EReference)packageDeclarationEClass.getEStructuralFeatures().get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getImport()
|
||||
{
|
||||
return importEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getImport_Element()
|
||||
{
|
||||
return (EReference)importEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getElement()
|
||||
{
|
||||
return elementEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getElement_Name()
|
||||
{
|
||||
return (EAttribute)elementEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getElement_Contents()
|
||||
{
|
||||
return (EReference)elementEClass.getEStructuralFeatures().get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getElement_Ref()
|
||||
{
|
||||
return (EReference)elementEClass.getEStructuralFeatures().get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public FileAwareFactory getFileAwareFactory()
|
||||
{
|
||||
return (FileAwareFactory)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
|
||||
packageDeclarationEClass = createEClass(PACKAGE_DECLARATION);
|
||||
createEAttribute(packageDeclarationEClass, PACKAGE_DECLARATION__NAME);
|
||||
createEReference(packageDeclarationEClass, PACKAGE_DECLARATION__IMPORTS);
|
||||
createEReference(packageDeclarationEClass, PACKAGE_DECLARATION__CONTENTS);
|
||||
|
||||
importEClass = createEClass(IMPORT);
|
||||
createEReference(importEClass, IMPORT__ELEMENT);
|
||||
|
||||
elementEClass = createEClass(ELEMENT);
|
||||
createEAttribute(elementEClass, ELEMENT__NAME);
|
||||
createEReference(elementEClass, ELEMENT__CONTENTS);
|
||||
createEReference(elementEClass, ELEMENT__REF);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- 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(packageDeclarationEClass, PackageDeclaration.class, "PackageDeclaration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getPackageDeclaration_Name(), ecorePackage.getEString(), "name", null, 0, 1, PackageDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getPackageDeclaration_Imports(), this.getImport(), null, "imports", null, 0, -1, PackageDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getPackageDeclaration_Contents(), this.getElement(), null, "contents", null, 0, -1, PackageDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(importEClass, Import.class, "Import", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEReference(getImport_Element(), this.getElement(), null, "element", null, 0, 1, Import.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(elementEClass, Element.class, "Element", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getElement_Name(), ecorePackage.getEString(), "name", null, 0, 1, Element.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getElement_Contents(), this.getElement(), null, "contents", null, 0, -1, Element.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getElement_Ref(), this.getElement(), null, "ref", null, 0, -1, Element.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
// Create resource
|
||||
createResource(eNS_URI);
|
||||
}
|
||||
|
||||
} //FileAwarePackageImpl
|
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
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.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Import</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.ImportImpl#getElement <em>Element</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class ImportImpl extends MinimalEObjectImpl.Container implements Import
|
||||
{
|
||||
/**
|
||||
* The cached value of the '{@link #getElement() <em>Element</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getElement()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected Element element;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected ImportImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return FileAwarePackage.Literals.IMPORT;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Element getElement()
|
||||
{
|
||||
if (element != null && element.eIsProxy())
|
||||
{
|
||||
InternalEObject oldElement = (InternalEObject)element;
|
||||
element = (Element)eResolveProxy(oldElement);
|
||||
if (element != oldElement)
|
||||
{
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FileAwarePackage.IMPORT__ELEMENT, oldElement, element));
|
||||
}
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Element basicGetElement()
|
||||
{
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setElement(Element newElement)
|
||||
{
|
||||
Element oldElement = element;
|
||||
element = newElement;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, FileAwarePackage.IMPORT__ELEMENT, oldElement, element));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public Object eGet(int featureID, boolean resolve, boolean coreType)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.IMPORT__ELEMENT:
|
||||
if (resolve) return getElement();
|
||||
return basicGetElement();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eSet(int featureID, Object newValue)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.IMPORT__ELEMENT:
|
||||
setElement((Element)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.IMPORT__ELEMENT:
|
||||
setElement((Element)null);
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.IMPORT__ELEMENT:
|
||||
return element != null;
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
} //ImportImpl
|
|
@ -0,0 +1,280 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.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.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Package Declaration</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl#getImports <em>Imports</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.impl.PackageDeclarationImpl#getContents <em>Contents</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class PackageDeclarationImpl extends MinimalEObjectImpl.Container implements PackageDeclaration
|
||||
{
|
||||
/**
|
||||
* 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 #getImports() <em>Imports</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getImports()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<Import> imports;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getContents() <em>Contents</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getContents()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<Element> contents;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected PackageDeclarationImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return FileAwarePackage.Literals.PACKAGE_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, FileAwarePackage.PACKAGE_DECLARATION__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<Import> getImports()
|
||||
{
|
||||
if (imports == null)
|
||||
{
|
||||
imports = new EObjectContainmentEList<Import>(Import.class, this, FileAwarePackage.PACKAGE_DECLARATION__IMPORTS);
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<Element> getContents()
|
||||
{
|
||||
if (contents == null)
|
||||
{
|
||||
contents = new EObjectContainmentEList<Element>(Element.class, this, FileAwarePackage.PACKAGE_DECLARATION__CONTENTS);
|
||||
}
|
||||
return contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__IMPORTS:
|
||||
return ((InternalEList<?>)getImports()).basicRemove(otherEnd, msgs);
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__CONTENTS:
|
||||
return ((InternalEList<?>)getContents()).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 FileAwarePackage.PACKAGE_DECLARATION__NAME:
|
||||
return getName();
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__IMPORTS:
|
||||
return getImports();
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__CONTENTS:
|
||||
return getContents();
|
||||
}
|
||||
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 FileAwarePackage.PACKAGE_DECLARATION__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__IMPORTS:
|
||||
getImports().clear();
|
||||
getImports().addAll((Collection<? extends Import>)newValue);
|
||||
return;
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__CONTENTS:
|
||||
getContents().clear();
|
||||
getContents().addAll((Collection<? extends Element>)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__IMPORTS:
|
||||
getImports().clear();
|
||||
return;
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__CONTENTS:
|
||||
getContents().clear();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__IMPORTS:
|
||||
return imports != null && !imports.isEmpty();
|
||||
case FileAwarePackage.PACKAGE_DECLARATION__CONTENTS:
|
||||
return contents != null && !contents.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();
|
||||
}
|
||||
|
||||
} //PackageDeclarationImpl
|
|
@ -0,0 +1,173 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.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.testlanguages.fileAware.fileAware.*;
|
||||
|
||||
/**
|
||||
* <!-- 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.testlanguages.fileAware.fileAware.FileAwarePackage
|
||||
* @generated
|
||||
*/
|
||||
public class FileAwareAdapterFactory extends AdapterFactoryImpl
|
||||
{
|
||||
/**
|
||||
* The cached model package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static FileAwarePackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the adapter factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public FileAwareAdapterFactory()
|
||||
{
|
||||
if (modelPackage == null)
|
||||
{
|
||||
modelPackage = FileAwarePackage.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 FileAwareSwitch<Adapter> modelSwitch =
|
||||
new FileAwareSwitch<Adapter>()
|
||||
{
|
||||
@Override
|
||||
public Adapter casePackageDeclaration(PackageDeclaration object)
|
||||
{
|
||||
return createPackageDeclarationAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseImport(Import object)
|
||||
{
|
||||
return createImportAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseElement(Element object)
|
||||
{
|
||||
return createElementAdapter();
|
||||
}
|
||||
@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.testlanguages.fileAware.fileAware.PackageDeclaration <em>Package 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.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createPackageDeclarationAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Import <em>Import</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Import
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createImportAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.fileAware.fileAware.Element <em>Element</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see org.eclipse.xtext.testlanguages.fileAware.fileAware.Element
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createElementAdapter()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
} //FileAwareAdapterFactory
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.fileAware.util;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
|
||||
import org.eclipse.emf.ecore.util.Switch;
|
||||
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.*;
|
||||
|
||||
/**
|
||||
* <!-- 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.testlanguages.fileAware.fileAware.FileAwarePackage
|
||||
* @generated
|
||||
*/
|
||||
public class FileAwareSwitch<T> extends Switch<T>
|
||||
{
|
||||
/**
|
||||
* The cached model package
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static FileAwarePackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the switch.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public FileAwareSwitch()
|
||||
{
|
||||
if (modelPackage == null)
|
||||
{
|
||||
modelPackage = FileAwarePackage.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 FileAwarePackage.PACKAGE_DECLARATION:
|
||||
{
|
||||
PackageDeclaration packageDeclaration = (PackageDeclaration)theEObject;
|
||||
T result = casePackageDeclaration(packageDeclaration);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case FileAwarePackage.IMPORT:
|
||||
{
|
||||
Import import_ = (Import)theEObject;
|
||||
T result = caseImport(import_);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case FileAwarePackage.ELEMENT:
|
||||
{
|
||||
Element element = (Element)theEObject;
|
||||
T result = caseElement(element);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
default: return defaultCase(theEObject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Package 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>Package Declaration</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T casePackageDeclaration(PackageDeclaration object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Import</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>Import</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseImport(Import object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Element</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>Element</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseElement(Element 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;
|
||||
}
|
||||
|
||||
} //FileAwareSwitch
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.parser.antlr;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
|
||||
|
||||
public class FileAwareTestLanguageAntlrTokenFileProvider implements IAntlrTokenFileProvider {
|
||||
|
||||
@Override
|
||||
public InputStream getAntlrTokenFile() {
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
return classLoader.getResourceAsStream("org/eclipse/xtext/testlanguages/fileAware/parser/antlr/internal/InternalFileAwareTestLanguage.tokens");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.parser.antlr;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
|
||||
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.parser.antlr.internal.InternalFileAwareTestLanguageParser;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
public class FileAwareTestLanguageParser extends AbstractAntlrParser {
|
||||
|
||||
@Inject
|
||||
private FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Override
|
||||
protected void setInitialHiddenTokens(XtextTokenStream tokenStream) {
|
||||
tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected InternalFileAwareTestLanguageParser createParser(XtextTokenStream stream) {
|
||||
return new InternalFileAwareTestLanguageParser(stream, getGrammarAccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultRuleName() {
|
||||
return "PackageDeclaration";
|
||||
}
|
||||
|
||||
public FileAwareTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return this.grammarAccess;
|
||||
}
|
||||
|
||||
public void setGrammarAccess(FileAwareTestLanguageGrammarAccess grammarAccess) {
|
||||
this.grammarAccess = grammarAccess;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,327 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
grammar InternalFileAwareTestLanguage;
|
||||
|
||||
options {
|
||||
superClass=AbstractInternalAntlrParser;
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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.testlanguages.fileAware.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.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
}
|
||||
|
||||
@parser::members {
|
||||
|
||||
private FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public InternalFileAwareTestLanguageParser(TokenStream input, FileAwareTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "PackageDeclaration";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FileAwareTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@rulecatch {
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
}
|
||||
|
||||
// Entry rule entryRulePackageDeclaration
|
||||
entryRulePackageDeclaration returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getPackageDeclarationRule()); }
|
||||
iv_rulePackageDeclaration=rulePackageDeclaration
|
||||
{ $current=$iv_rulePackageDeclaration.current; }
|
||||
EOF;
|
||||
|
||||
// Rule PackageDeclaration
|
||||
rulePackageDeclaration returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
otherlv_0='package'
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getPackageDeclarationAccess().getPackageKeyword_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getNameQualifiedNameParserRuleCall_1_0());
|
||||
}
|
||||
lv_name_1_0=ruleQualifiedName
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
set(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.QualifiedName");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getImportsImportParserRuleCall_2_0());
|
||||
}
|
||||
lv_imports_2_0=ruleImport
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"imports",
|
||||
lv_imports_2_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Import");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getContentsElementParserRuleCall_3_0());
|
||||
}
|
||||
lv_contents_3_0=ruleElement
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"contents",
|
||||
lv_contents_3_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleImport
|
||||
entryRuleImport returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getImportRule()); }
|
||||
iv_ruleImport=ruleImport
|
||||
{ $current=$iv_ruleImport.current; }
|
||||
EOF;
|
||||
|
||||
// Rule Import
|
||||
ruleImport returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
otherlv_0='import'
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getImportAccess().getImportKeyword_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getImportRule());
|
||||
}
|
||||
}
|
||||
{
|
||||
newCompositeNode(grammarAccess.getImportAccess().getElementElementCrossReference_1_0());
|
||||
}
|
||||
ruleQualifiedName
|
||||
{
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleElement
|
||||
entryRuleElement returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getElementRule()); }
|
||||
iv_ruleElement=ruleElement
|
||||
{ $current=$iv_ruleElement.current; }
|
||||
EOF;
|
||||
|
||||
// Rule Element
|
||||
ruleElement returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
otherlv_0='element'
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
lv_name_1_0=RULE_ID
|
||||
{
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
}
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
$current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
}
|
||||
)
|
||||
)
|
||||
otherlv_2='{'
|
||||
{
|
||||
newLeafNode(otherlv_2, grammarAccess.getElementAccess().getLeftCurlyBracketKeyword_2());
|
||||
}
|
||||
(
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getElementAccess().getContentsElementParserRuleCall_3_0_0());
|
||||
}
|
||||
lv_contents_3_0=ruleElement
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getElementRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"contents",
|
||||
lv_contents_3_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
||||
(
|
||||
otherlv_4='ref'
|
||||
{
|
||||
newLeafNode(otherlv_4, grammarAccess.getElementAccess().getRefKeyword_3_1_0());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
}
|
||||
{
|
||||
newCompositeNode(grammarAccess.getElementAccess().getRefElementCrossReference_3_1_1_0());
|
||||
}
|
||||
ruleQualifiedName
|
||||
{
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
)*
|
||||
otherlv_6='}'
|
||||
{
|
||||
newLeafNode(otherlv_6, grammarAccess.getElementAccess().getRightCurlyBracketKeyword_4());
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleQualifiedName
|
||||
entryRuleQualifiedName returns [String current=null]:
|
||||
{ newCompositeNode(grammarAccess.getQualifiedNameRule()); }
|
||||
iv_ruleQualifiedName=ruleQualifiedName
|
||||
{ $current=$iv_ruleQualifiedName.current.getText(); }
|
||||
EOF;
|
||||
|
||||
// Rule QualifiedName
|
||||
ruleQualifiedName returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
this_ID_0=RULE_ID
|
||||
{
|
||||
$current.merge(this_ID_0);
|
||||
}
|
||||
{
|
||||
newLeafNode(this_ID_0, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0());
|
||||
}
|
||||
(
|
||||
kw='.'
|
||||
{
|
||||
$current.merge(kw);
|
||||
newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0());
|
||||
}
|
||||
this_ID_2=RULE_ID
|
||||
{
|
||||
$current.merge(this_ID_2);
|
||||
}
|
||||
{
|
||||
newLeafNode(this_ID_2, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1());
|
||||
}
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
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,21 @@
|
|||
'.'=17
|
||||
'element'=13
|
||||
'import'=12
|
||||
'package'=11
|
||||
'ref'=15
|
||||
'{'=14
|
||||
'}'=16
|
||||
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
|
||||
T__17=17
|
|
@ -0,0 +1,960 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.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 InternalFileAwareTestLanguageLexer 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 T__17=17;
|
||||
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 InternalFileAwareTestLanguageLexer() {;}
|
||||
public InternalFileAwareTestLanguageLexer(CharStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalFileAwareTestLanguageLexer(CharStream input, RecognizerSharedState state) {
|
||||
super(input,state);
|
||||
|
||||
}
|
||||
public String getGrammarFileName() { return "InternalFileAwareTestLanguage.g"; }
|
||||
|
||||
// $ANTLR start "T__11"
|
||||
public final void mT__11() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__11;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:11:7: ( 'package' )
|
||||
// InternalFileAwareTestLanguage.g:11:9: 'package'
|
||||
{
|
||||
match("package");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:12:7: ( 'import' )
|
||||
// InternalFileAwareTestLanguage.g:12:9: 'import'
|
||||
{
|
||||
match("import");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:13:7: ( 'element' )
|
||||
// InternalFileAwareTestLanguage.g:13:9: 'element'
|
||||
{
|
||||
match("element");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:14:7: ( '{' )
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:15:7: ( 'ref' )
|
||||
// InternalFileAwareTestLanguage.g:15:9: 'ref'
|
||||
{
|
||||
match("ref");
|
||||
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// InternalFileAwareTestLanguage.g:16:7: ( '}' )
|
||||
// InternalFileAwareTestLanguage.g:16:9: '}'
|
||||
{
|
||||
match('}');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__16"
|
||||
|
||||
// $ANTLR start "T__17"
|
||||
public final void mT__17() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__17;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:17:7: ( '.' )
|
||||
// InternalFileAwareTestLanguage.g:17:9: '.'
|
||||
{
|
||||
match('.');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__17"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalFileAwareTestLanguage.g:315:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalFileAwareTestLanguage.g:315:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:315:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0=='^') ) {
|
||||
alt1=1;
|
||||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:315: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;}
|
||||
|
||||
// InternalFileAwareTestLanguage.g:315: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 :
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:317:10: ( ( '0' .. '9' )+ )
|
||||
// InternalFileAwareTestLanguage.g:317:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:317: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 :
|
||||
// InternalFileAwareTestLanguage.g:317: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;
|
||||
// InternalFileAwareTestLanguage.g:319:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalFileAwareTestLanguage.g:319:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:319: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 :
|
||||
// InternalFileAwareTestLanguage.g:319:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalFileAwareTestLanguage.g:319: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 :
|
||||
// InternalFileAwareTestLanguage.g:319:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:319: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 :
|
||||
// InternalFileAwareTestLanguage.g:319:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalFileAwareTestLanguage.g:319: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 :
|
||||
// InternalFileAwareTestLanguage.g:319:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:319: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;
|
||||
// InternalFileAwareTestLanguage.g:321:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalFileAwareTestLanguage.g:321:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalFileAwareTestLanguage.g:321: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 :
|
||||
// InternalFileAwareTestLanguage.g:321: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;
|
||||
// InternalFileAwareTestLanguage.g:323:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalFileAwareTestLanguage.g:323:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalFileAwareTestLanguage.g:323: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 :
|
||||
// InternalFileAwareTestLanguage.g:323: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);
|
||||
|
||||
// InternalFileAwareTestLanguage.g:323: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 :
|
||||
// InternalFileAwareTestLanguage.g:323:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:323:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
if ( (LA9_0=='\r') ) {
|
||||
alt9=1;
|
||||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:323: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;
|
||||
// InternalFileAwareTestLanguage.g:325:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalFileAwareTestLanguage.g:325:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:325: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 :
|
||||
// InternalFileAwareTestLanguage.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;
|
||||
// InternalFileAwareTestLanguage.g:327:16: ( . )
|
||||
// InternalFileAwareTestLanguage.g:327:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalFileAwareTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=14;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:1:10: T__11
|
||||
{
|
||||
mT__11();
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:1:16: T__12
|
||||
{
|
||||
mT__12();
|
||||
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
// InternalFileAwareTestLanguage.g:1:22: T__13
|
||||
{
|
||||
mT__13();
|
||||
|
||||
}
|
||||
break;
|
||||
case 4 :
|
||||
// InternalFileAwareTestLanguage.g:1:28: T__14
|
||||
{
|
||||
mT__14();
|
||||
|
||||
}
|
||||
break;
|
||||
case 5 :
|
||||
// InternalFileAwareTestLanguage.g:1:34: T__15
|
||||
{
|
||||
mT__15();
|
||||
|
||||
}
|
||||
break;
|
||||
case 6 :
|
||||
// InternalFileAwareTestLanguage.g:1:40: T__16
|
||||
{
|
||||
mT__16();
|
||||
|
||||
}
|
||||
break;
|
||||
case 7 :
|
||||
// InternalFileAwareTestLanguage.g:1:46: T__17
|
||||
{
|
||||
mT__17();
|
||||
|
||||
}
|
||||
break;
|
||||
case 8 :
|
||||
// InternalFileAwareTestLanguage.g:1:52: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 9 :
|
||||
// InternalFileAwareTestLanguage.g:1:60: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 10 :
|
||||
// InternalFileAwareTestLanguage.g:1:69: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 11 :
|
||||
// InternalFileAwareTestLanguage.g:1:81: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 12 :
|
||||
// InternalFileAwareTestLanguage.g:1:97: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 13 :
|
||||
// InternalFileAwareTestLanguage.g:1:113: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 14 :
|
||||
// InternalFileAwareTestLanguage.g:1:121: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\3\21\1\uffff\1\21\2\uffff\1\17\2\uffff\3\17\2\uffff\1\21\1\uffff\2\21\1\uffff\1\21\7\uffff\3\21\1\44\3\21\1\uffff\4\21\1\54\1\21\1\56\1\uffff\1\57\2\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\60\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\141\1\155\1\154\1\uffff\1\145\2\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\143\1\uffff\1\160\1\145\1\uffff\1\146\7\uffff\1\153\1\157\1\155\1\60\1\141\1\162\1\145\1\uffff\1\147\1\164\1\156\1\145\1\60\1\164\1\60\1\uffff\1\60\2\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\141\1\155\1\154\1\uffff\1\145\2\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\143\1\uffff\1\160\1\145\1\uffff\1\146\7\uffff\1\153\1\157\1\155\1\172\1\141\1\162\1\145\1\uffff\1\147\1\164\1\156\1\145\1\172\1\164\1\172\1\uffff\1\172\2\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\4\uffff\1\4\1\uffff\1\6\1\7\1\uffff\1\10\1\11\3\uffff\1\15\1\16\1\uffff\1\10\2\uffff\1\4\1\uffff\1\6\1\7\1\11\1\12\1\13\1\14\1\15\7\uffff\1\5\7\uffff\1\2\1\uffff\1\1\1\3";
|
||||
static final String DFA12_specialS =
|
||||
"\1\1\12\uffff\1\0\1\2\43\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\11\17\2\16\2\17\1\16\22\17\1\16\1\17\1\13\4\17\1\14\6\17\1\7\1\15\12\12\7\17\32\11\3\17\1\10\1\11\1\17\4\11\1\3\3\11\1\2\6\11\1\1\1\11\1\5\10\11\1\4\1\17\1\6\uff82\17",
|
||||
"\1\20",
|
||||
"\1\22",
|
||||
"\1\23",
|
||||
"",
|
||||
"\1\25",
|
||||
"",
|
||||
"",
|
||||
"\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
"",
|
||||
"\0\31",
|
||||
"\0\31",
|
||||
"\1\32\4\uffff\1\33",
|
||||
"",
|
||||
"",
|
||||
"\1\35",
|
||||
"",
|
||||
"\1\36",
|
||||
"\1\37",
|
||||
"",
|
||||
"\1\40",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\41",
|
||||
"\1\42",
|
||||
"\1\43",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"\1\45",
|
||||
"\1\46",
|
||||
"\1\47",
|
||||
"",
|
||||
"\1\50",
|
||||
"\1\51",
|
||||
"\1\52",
|
||||
"\1\53",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"\1\55",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
"\12\21\7\uffff\32\21\4\uffff\1\21\1\uffff\32\21",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
||||
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 | T__17 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
|
||||
}
|
||||
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
|
||||
IntStream input = _input;
|
||||
int _s = s;
|
||||
switch ( s ) {
|
||||
case 0 :
|
||||
int LA12_11 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_11>='\u0000' && LA12_11<='\uFFFF')) ) {s = 25;}
|
||||
|
||||
else s = 15;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( (LA12_0=='p') ) {s = 1;}
|
||||
|
||||
else if ( (LA12_0=='i') ) {s = 2;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 3;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='r') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='.') ) {s = 7;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 8;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||(LA12_0>='a' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='o')||LA12_0=='q'||(LA12_0>='s' && LA12_0<='z')) ) {s = 9;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 12;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 13;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 14;}
|
||||
|
||||
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 = 15;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_12 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_12>='\u0000' && LA12_12<='\uFFFF')) ) {s = 25;}
|
||||
|
||||
else s = 15;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
}
|
||||
NoViableAltException nvae =
|
||||
new NoViableAltException(getDescription(), 12, _s, input);
|
||||
error(nvae);
|
||||
throw nvae;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,756 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.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.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class InternalFileAwareTestLanguageParser 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", "'package'", "'import'", "'element'", "'{'", "'ref'", "'}'", "'.'"
|
||||
};
|
||||
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 T__17=17;
|
||||
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 InternalFileAwareTestLanguageParser(TokenStream input) {
|
||||
this(input, new RecognizerSharedState());
|
||||
}
|
||||
public InternalFileAwareTestLanguageParser(TokenStream input, RecognizerSharedState state) {
|
||||
super(input, state);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String[] getTokenNames() { return InternalFileAwareTestLanguageParser.tokenNames; }
|
||||
public String getGrammarFileName() { return "InternalFileAwareTestLanguage.g"; }
|
||||
|
||||
|
||||
|
||||
private FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
public InternalFileAwareTestLanguageParser(TokenStream input, FileAwareTestLanguageGrammarAccess grammarAccess) {
|
||||
this(input);
|
||||
this.grammarAccess = grammarAccess;
|
||||
registerRules(grammarAccess.getGrammar());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFirstRuleName() {
|
||||
return "PackageDeclaration";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FileAwareTestLanguageGrammarAccess getGrammarAccess() {
|
||||
return grammarAccess;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// $ANTLR start "entryRulePackageDeclaration"
|
||||
// InternalFileAwareTestLanguage.g:64:1: entryRulePackageDeclaration returns [EObject current=null] : iv_rulePackageDeclaration= rulePackageDeclaration EOF ;
|
||||
public final EObject entryRulePackageDeclaration() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject iv_rulePackageDeclaration = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:64:59: (iv_rulePackageDeclaration= rulePackageDeclaration EOF )
|
||||
// InternalFileAwareTestLanguage.g:65:2: iv_rulePackageDeclaration= rulePackageDeclaration EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_rulePackageDeclaration=rulePackageDeclaration();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_rulePackageDeclaration;
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRulePackageDeclaration"
|
||||
|
||||
|
||||
// $ANTLR start "rulePackageDeclaration"
|
||||
// InternalFileAwareTestLanguage.g:71:1: rulePackageDeclaration returns [EObject current=null] : (otherlv_0= 'package' ( (lv_name_1_0= ruleQualifiedName ) ) ( (lv_imports_2_0= ruleImport ) )* ( (lv_contents_3_0= ruleElement ) )* ) ;
|
||||
public final EObject rulePackageDeclaration() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
Token otherlv_0=null;
|
||||
AntlrDatatypeRuleToken lv_name_1_0 = null;
|
||||
|
||||
EObject lv_imports_2_0 = null;
|
||||
|
||||
EObject lv_contents_3_0 = null;
|
||||
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:77:2: ( (otherlv_0= 'package' ( (lv_name_1_0= ruleQualifiedName ) ) ( (lv_imports_2_0= ruleImport ) )* ( (lv_contents_3_0= ruleElement ) )* ) )
|
||||
// InternalFileAwareTestLanguage.g:78:2: (otherlv_0= 'package' ( (lv_name_1_0= ruleQualifiedName ) ) ( (lv_imports_2_0= ruleImport ) )* ( (lv_contents_3_0= ruleElement ) )* )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:78:2: (otherlv_0= 'package' ( (lv_name_1_0= ruleQualifiedName ) ) ( (lv_imports_2_0= ruleImport ) )* ( (lv_contents_3_0= ruleElement ) )* )
|
||||
// InternalFileAwareTestLanguage.g:79:3: otherlv_0= 'package' ( (lv_name_1_0= ruleQualifiedName ) ) ( (lv_imports_2_0= ruleImport ) )* ( (lv_contents_3_0= ruleElement ) )*
|
||||
{
|
||||
otherlv_0=(Token)match(input,11,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_0, grammarAccess.getPackageDeclarationAccess().getPackageKeyword_0());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:83:3: ( (lv_name_1_0= ruleQualifiedName ) )
|
||||
// InternalFileAwareTestLanguage.g:84:4: (lv_name_1_0= ruleQualifiedName )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:84:4: (lv_name_1_0= ruleQualifiedName )
|
||||
// InternalFileAwareTestLanguage.g:85:5: lv_name_1_0= ruleQualifiedName
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getNameQualifiedNameParserRuleCall_1_0());
|
||||
|
||||
pushFollow(FOLLOW_4);
|
||||
lv_name_1_0=ruleQualifiedName();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
set(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.QualifiedName");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// InternalFileAwareTestLanguage.g:102:3: ( (lv_imports_2_0= ruleImport ) )*
|
||||
loop1:
|
||||
do {
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
if ( (LA1_0==12) ) {
|
||||
alt1=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:103:4: (lv_imports_2_0= ruleImport )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:103:4: (lv_imports_2_0= ruleImport )
|
||||
// InternalFileAwareTestLanguage.g:104:5: lv_imports_2_0= ruleImport
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getImportsImportParserRuleCall_2_0());
|
||||
|
||||
pushFollow(FOLLOW_4);
|
||||
lv_imports_2_0=ruleImport();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"imports",
|
||||
lv_imports_2_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Import");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop1;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
// InternalFileAwareTestLanguage.g:121:3: ( (lv_contents_3_0= ruleElement ) )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
int LA2_0 = input.LA(1);
|
||||
|
||||
if ( (LA2_0==13) ) {
|
||||
alt2=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt2) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:122:4: (lv_contents_3_0= ruleElement )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:122:4: (lv_contents_3_0= ruleElement )
|
||||
// InternalFileAwareTestLanguage.g:123:5: lv_contents_3_0= ruleElement
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getContentsElementParserRuleCall_3_0());
|
||||
|
||||
pushFollow(FOLLOW_5);
|
||||
lv_contents_3_0=ruleElement();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"contents",
|
||||
lv_contents_3_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop2;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "rulePackageDeclaration"
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleImport"
|
||||
// InternalFileAwareTestLanguage.g:144:1: entryRuleImport returns [EObject current=null] : iv_ruleImport= ruleImport EOF ;
|
||||
public final EObject entryRuleImport() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject iv_ruleImport = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:144:47: (iv_ruleImport= ruleImport EOF )
|
||||
// InternalFileAwareTestLanguage.g:145:2: iv_ruleImport= ruleImport EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getImportRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_ruleImport=ruleImport();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_ruleImport;
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRuleImport"
|
||||
|
||||
|
||||
// $ANTLR start "ruleImport"
|
||||
// InternalFileAwareTestLanguage.g:151:1: ruleImport returns [EObject current=null] : (otherlv_0= 'import' ( ( ruleQualifiedName ) ) ) ;
|
||||
public final EObject ruleImport() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
Token otherlv_0=null;
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:157:2: ( (otherlv_0= 'import' ( ( ruleQualifiedName ) ) ) )
|
||||
// InternalFileAwareTestLanguage.g:158:2: (otherlv_0= 'import' ( ( ruleQualifiedName ) ) )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:158:2: (otherlv_0= 'import' ( ( ruleQualifiedName ) ) )
|
||||
// InternalFileAwareTestLanguage.g:159:3: otherlv_0= 'import' ( ( ruleQualifiedName ) )
|
||||
{
|
||||
otherlv_0=(Token)match(input,12,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_0, grammarAccess.getImportAccess().getImportKeyword_0());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:163:3: ( ( ruleQualifiedName ) )
|
||||
// InternalFileAwareTestLanguage.g:164:4: ( ruleQualifiedName )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:164:4: ( ruleQualifiedName )
|
||||
// InternalFileAwareTestLanguage.g:165:5: ruleQualifiedName
|
||||
{
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getImportRule());
|
||||
}
|
||||
|
||||
|
||||
newCompositeNode(grammarAccess.getImportAccess().getElementElementCrossReference_1_0());
|
||||
|
||||
pushFollow(FOLLOW_2);
|
||||
ruleQualifiedName();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "ruleImport"
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleElement"
|
||||
// InternalFileAwareTestLanguage.g:183:1: entryRuleElement returns [EObject current=null] : iv_ruleElement= ruleElement EOF ;
|
||||
public final EObject entryRuleElement() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
EObject iv_ruleElement = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:183:48: (iv_ruleElement= ruleElement EOF )
|
||||
// InternalFileAwareTestLanguage.g:184:2: iv_ruleElement= ruleElement EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getElementRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_ruleElement=ruleElement();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_ruleElement;
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRuleElement"
|
||||
|
||||
|
||||
// $ANTLR start "ruleElement"
|
||||
// InternalFileAwareTestLanguage.g:190:1: ruleElement returns [EObject current=null] : (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )* otherlv_6= '}' ) ;
|
||||
public final EObject ruleElement() throws RecognitionException {
|
||||
EObject current = null;
|
||||
|
||||
Token otherlv_0=null;
|
||||
Token lv_name_1_0=null;
|
||||
Token otherlv_2=null;
|
||||
Token otherlv_4=null;
|
||||
Token otherlv_6=null;
|
||||
EObject lv_contents_3_0 = null;
|
||||
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:196:2: ( (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )* otherlv_6= '}' ) )
|
||||
// InternalFileAwareTestLanguage.g:197:2: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )* otherlv_6= '}' )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:197:2: (otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )* otherlv_6= '}' )
|
||||
// InternalFileAwareTestLanguage.g:198:3: otherlv_0= 'element' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )* otherlv_6= '}'
|
||||
{
|
||||
otherlv_0=(Token)match(input,13,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_0, grammarAccess.getElementAccess().getElementKeyword_0());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:202:3: ( (lv_name_1_0= RULE_ID ) )
|
||||
// InternalFileAwareTestLanguage.g:203:4: (lv_name_1_0= RULE_ID )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:203:4: (lv_name_1_0= RULE_ID )
|
||||
// InternalFileAwareTestLanguage.g:204:5: lv_name_1_0= RULE_ID
|
||||
{
|
||||
lv_name_1_0=(Token)match(input,RULE_ID,FOLLOW_6);
|
||||
|
||||
newLeafNode(lv_name_1_0, grammarAccess.getElementAccess().getNameIDTerminalRuleCall_1_0());
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
setWithLastConsumed(
|
||||
current,
|
||||
"name",
|
||||
lv_name_1_0,
|
||||
"org.eclipse.xtext.common.Terminals.ID");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
otherlv_2=(Token)match(input,14,FOLLOW_7);
|
||||
|
||||
newLeafNode(otherlv_2, grammarAccess.getElementAccess().getLeftCurlyBracketKeyword_2());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:224:3: ( ( (lv_contents_3_0= ruleElement ) ) | (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) ) )*
|
||||
loop3:
|
||||
do {
|
||||
int alt3=3;
|
||||
int LA3_0 = input.LA(1);
|
||||
|
||||
if ( (LA3_0==13) ) {
|
||||
alt3=1;
|
||||
}
|
||||
else if ( (LA3_0==15) ) {
|
||||
alt3=2;
|
||||
}
|
||||
|
||||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:225:4: ( (lv_contents_3_0= ruleElement ) )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:225:4: ( (lv_contents_3_0= ruleElement ) )
|
||||
// InternalFileAwareTestLanguage.g:226:5: (lv_contents_3_0= ruleElement )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:226:5: (lv_contents_3_0= ruleElement )
|
||||
// InternalFileAwareTestLanguage.g:227:6: lv_contents_3_0= ruleElement
|
||||
{
|
||||
|
||||
newCompositeNode(grammarAccess.getElementAccess().getContentsElementParserRuleCall_3_0_0());
|
||||
|
||||
pushFollow(FOLLOW_7);
|
||||
lv_contents_3_0=ruleElement();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElementForParent(grammarAccess.getElementRule());
|
||||
}
|
||||
add(
|
||||
current,
|
||||
"contents",
|
||||
lv_contents_3_0,
|
||||
"org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Element");
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalFileAwareTestLanguage.g:245:4: (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:245:4: (otherlv_4= 'ref' ( ( ruleQualifiedName ) ) )
|
||||
// InternalFileAwareTestLanguage.g:246:5: otherlv_4= 'ref' ( ( ruleQualifiedName ) )
|
||||
{
|
||||
otherlv_4=(Token)match(input,15,FOLLOW_3);
|
||||
|
||||
newLeafNode(otherlv_4, grammarAccess.getElementAccess().getRefKeyword_3_1_0());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:250:5: ( ( ruleQualifiedName ) )
|
||||
// InternalFileAwareTestLanguage.g:251:6: ( ruleQualifiedName )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:251:6: ( ruleQualifiedName )
|
||||
// InternalFileAwareTestLanguage.g:252:7: ruleQualifiedName
|
||||
{
|
||||
|
||||
if (current==null) {
|
||||
current = createModelElement(grammarAccess.getElementRule());
|
||||
}
|
||||
|
||||
|
||||
newCompositeNode(grammarAccess.getElementAccess().getRefElementCrossReference_3_1_1_0());
|
||||
|
||||
pushFollow(FOLLOW_7);
|
||||
ruleQualifiedName();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
|
||||
afterParserOrEnumRuleCall();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop3;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
otherlv_6=(Token)match(input,16,FOLLOW_2);
|
||||
|
||||
newLeafNode(otherlv_6, grammarAccess.getElementAccess().getRightCurlyBracketKeyword_4());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "ruleElement"
|
||||
|
||||
|
||||
// $ANTLR start "entryRuleQualifiedName"
|
||||
// InternalFileAwareTestLanguage.g:276:1: entryRuleQualifiedName returns [String current=null] : iv_ruleQualifiedName= ruleQualifiedName EOF ;
|
||||
public final String entryRuleQualifiedName() throws RecognitionException {
|
||||
String current = null;
|
||||
|
||||
AntlrDatatypeRuleToken iv_ruleQualifiedName = null;
|
||||
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:276:53: (iv_ruleQualifiedName= ruleQualifiedName EOF )
|
||||
// InternalFileAwareTestLanguage.g:277:2: iv_ruleQualifiedName= ruleQualifiedName EOF
|
||||
{
|
||||
newCompositeNode(grammarAccess.getQualifiedNameRule());
|
||||
pushFollow(FOLLOW_1);
|
||||
iv_ruleQualifiedName=ruleQualifiedName();
|
||||
|
||||
state._fsp--;
|
||||
|
||||
current =iv_ruleQualifiedName.getText();
|
||||
match(input,EOF,FOLLOW_2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "entryRuleQualifiedName"
|
||||
|
||||
|
||||
// $ANTLR start "ruleQualifiedName"
|
||||
// InternalFileAwareTestLanguage.g:283:1: ruleQualifiedName returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_ID_0= RULE_ID (kw= '.' this_ID_2= RULE_ID )* ) ;
|
||||
public final AntlrDatatypeRuleToken ruleQualifiedName() throws RecognitionException {
|
||||
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
|
||||
|
||||
Token this_ID_0=null;
|
||||
Token kw=null;
|
||||
Token this_ID_2=null;
|
||||
|
||||
|
||||
enterRule();
|
||||
|
||||
try {
|
||||
// InternalFileAwareTestLanguage.g:289:2: ( (this_ID_0= RULE_ID (kw= '.' this_ID_2= RULE_ID )* ) )
|
||||
// InternalFileAwareTestLanguage.g:290:2: (this_ID_0= RULE_ID (kw= '.' this_ID_2= RULE_ID )* )
|
||||
{
|
||||
// InternalFileAwareTestLanguage.g:290:2: (this_ID_0= RULE_ID (kw= '.' this_ID_2= RULE_ID )* )
|
||||
// InternalFileAwareTestLanguage.g:291:3: this_ID_0= RULE_ID (kw= '.' this_ID_2= RULE_ID )*
|
||||
{
|
||||
this_ID_0=(Token)match(input,RULE_ID,FOLLOW_8);
|
||||
|
||||
current.merge(this_ID_0);
|
||||
|
||||
|
||||
newLeafNode(this_ID_0, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0());
|
||||
|
||||
// InternalFileAwareTestLanguage.g:298:3: (kw= '.' this_ID_2= RULE_ID )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=2;
|
||||
int LA4_0 = input.LA(1);
|
||||
|
||||
if ( (LA4_0==17) ) {
|
||||
alt4=1;
|
||||
}
|
||||
|
||||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalFileAwareTestLanguage.g:299:4: kw= '.' this_ID_2= RULE_ID
|
||||
{
|
||||
kw=(Token)match(input,17,FOLLOW_3);
|
||||
|
||||
current.merge(kw);
|
||||
newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0());
|
||||
|
||||
this_ID_2=(Token)match(input,RULE_ID,FOLLOW_8);
|
||||
|
||||
current.merge(this_ID_2);
|
||||
|
||||
|
||||
newLeafNode(this_ID_2, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1());
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
break loop4;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
leaveRule();
|
||||
|
||||
}
|
||||
|
||||
catch (RecognitionException re) {
|
||||
recover(input,re);
|
||||
appendSkippedTokens();
|
||||
}
|
||||
finally {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
// $ANTLR end "ruleQualifiedName"
|
||||
|
||||
// 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[]{0x0000000000003002L});
|
||||
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000002002L});
|
||||
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000004000L});
|
||||
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x000000000001A000L});
|
||||
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000020002L});
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.scoping;
|
||||
|
||||
import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider;
|
||||
|
||||
public abstract class AbstractFileAwareTestLanguageScopeProvider extends DelegatingScopeProvider {
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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.serializer.ISerializationContext;
|
||||
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
|
||||
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
|
||||
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageSemanticSequencer extends AbstractDelegatingSemanticSequencer {
|
||||
|
||||
@Inject
|
||||
private FileAwareTestLanguageGrammarAccess 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 == FileAwarePackage.eINSTANCE)
|
||||
switch (semanticObject.eClass().getClassifierID()) {
|
||||
case FileAwarePackage.ELEMENT:
|
||||
sequence_Element(context, (Element) semanticObject);
|
||||
return;
|
||||
case FileAwarePackage.IMPORT:
|
||||
sequence_Import(context, (Import) semanticObject);
|
||||
return;
|
||||
case FileAwarePackage.PACKAGE_DECLARATION:
|
||||
sequence_PackageDeclaration(context, (PackageDeclaration) semanticObject);
|
||||
return;
|
||||
}
|
||||
if (errorAcceptor != null)
|
||||
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Element returns Element
|
||||
*
|
||||
* Constraint:
|
||||
* (name=ID (contents+=Element | ref+=[Element|QualifiedName])*)
|
||||
*/
|
||||
protected void sequence_Element(ISerializationContext context, Element semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Import returns Import
|
||||
*
|
||||
* Constraint:
|
||||
* element=[Element|QualifiedName]
|
||||
*/
|
||||
protected void sequence_Import(ISerializationContext context, Import semanticObject) {
|
||||
if (errorAcceptor != null) {
|
||||
if (transientValues.isValueTransient(semanticObject, FileAwarePackage.Literals.IMPORT__ELEMENT) == ValueTransient.YES)
|
||||
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, FileAwarePackage.Literals.IMPORT__ELEMENT));
|
||||
}
|
||||
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
||||
feeder.accept(grammarAccess.getImportAccess().getElementElementQualifiedNameParserRuleCall_1_0_1(), semanticObject.eGet(FileAwarePackage.Literals.IMPORT__ELEMENT, false));
|
||||
feeder.finish();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* PackageDeclaration returns PackageDeclaration
|
||||
*
|
||||
* Constraint:
|
||||
* (name=QualifiedName imports+=Import* contents+=Element*)
|
||||
*/
|
||||
protected void sequence_PackageDeclaration(ISerializationContext context, PackageDeclaration semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
|
||||
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
|
||||
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.services.FileAwareTestLanguageGrammarAccess;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageSyntacticSequencer extends AbstractSyntacticSequencer {
|
||||
|
||||
protected FileAwareTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Inject
|
||||
protected void init(IGrammarAccess access) {
|
||||
grammarAccess = (FileAwareTestLanguageGrammarAccess) 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,319 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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 FileAwareTestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
||||
|
||||
public class PackageDeclarationElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.PackageDeclaration");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final Keyword cPackageKeyword_0 = (Keyword)cGroup.eContents().get(0);
|
||||
private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1);
|
||||
private final RuleCall cNameQualifiedNameParserRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0);
|
||||
private final Assignment cImportsAssignment_2 = (Assignment)cGroup.eContents().get(2);
|
||||
private final RuleCall cImportsImportParserRuleCall_2_0 = (RuleCall)cImportsAssignment_2.eContents().get(0);
|
||||
private final Assignment cContentsAssignment_3 = (Assignment)cGroup.eContents().get(3);
|
||||
private final RuleCall cContentsElementParserRuleCall_3_0 = (RuleCall)cContentsAssignment_3.eContents().get(0);
|
||||
|
||||
//PackageDeclaration:
|
||||
// 'package' name=QualifiedName
|
||||
// imports+=Import*
|
||||
// contents+=Element*;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'package' name=QualifiedName imports+=Import* contents+=Element*
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//'package'
|
||||
public Keyword getPackageKeyword_0() { return cPackageKeyword_0; }
|
||||
|
||||
//name=QualifiedName
|
||||
public Assignment getNameAssignment_1() { return cNameAssignment_1; }
|
||||
|
||||
//QualifiedName
|
||||
public RuleCall getNameQualifiedNameParserRuleCall_1_0() { return cNameQualifiedNameParserRuleCall_1_0; }
|
||||
|
||||
//imports+=Import*
|
||||
public Assignment getImportsAssignment_2() { return cImportsAssignment_2; }
|
||||
|
||||
//Import
|
||||
public RuleCall getImportsImportParserRuleCall_2_0() { return cImportsImportParserRuleCall_2_0; }
|
||||
|
||||
//contents+=Element*
|
||||
public Assignment getContentsAssignment_3() { return cContentsAssignment_3; }
|
||||
|
||||
//Element
|
||||
public RuleCall getContentsElementParserRuleCall_3_0() { return cContentsElementParserRuleCall_3_0; }
|
||||
}
|
||||
public class ImportElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Import");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final Keyword cImportKeyword_0 = (Keyword)cGroup.eContents().get(0);
|
||||
private final Assignment cElementAssignment_1 = (Assignment)cGroup.eContents().get(1);
|
||||
private final CrossReference cElementElementCrossReference_1_0 = (CrossReference)cElementAssignment_1.eContents().get(0);
|
||||
private final RuleCall cElementElementQualifiedNameParserRuleCall_1_0_1 = (RuleCall)cElementElementCrossReference_1_0.eContents().get(1);
|
||||
|
||||
//Import:
|
||||
// 'import' element=[Element|QualifiedName];
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'import' element=[Element|QualifiedName]
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//'import'
|
||||
public Keyword getImportKeyword_0() { return cImportKeyword_0; }
|
||||
|
||||
//element=[Element|QualifiedName]
|
||||
public Assignment getElementAssignment_1() { return cElementAssignment_1; }
|
||||
|
||||
//[Element|QualifiedName]
|
||||
public CrossReference getElementElementCrossReference_1_0() { return cElementElementCrossReference_1_0; }
|
||||
|
||||
//QualifiedName
|
||||
public RuleCall getElementElementQualifiedNameParserRuleCall_1_0_1() { return cElementElementQualifiedNameParserRuleCall_1_0_1; }
|
||||
}
|
||||
public class ElementElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.Element");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final Keyword cElementKeyword_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 Keyword cLeftCurlyBracketKeyword_2 = (Keyword)cGroup.eContents().get(2);
|
||||
private final Alternatives cAlternatives_3 = (Alternatives)cGroup.eContents().get(3);
|
||||
private final Assignment cContentsAssignment_3_0 = (Assignment)cAlternatives_3.eContents().get(0);
|
||||
private final RuleCall cContentsElementParserRuleCall_3_0_0 = (RuleCall)cContentsAssignment_3_0.eContents().get(0);
|
||||
private final Group cGroup_3_1 = (Group)cAlternatives_3.eContents().get(1);
|
||||
private final Keyword cRefKeyword_3_1_0 = (Keyword)cGroup_3_1.eContents().get(0);
|
||||
private final Assignment cRefAssignment_3_1_1 = (Assignment)cGroup_3_1.eContents().get(1);
|
||||
private final CrossReference cRefElementCrossReference_3_1_1_0 = (CrossReference)cRefAssignment_3_1_1.eContents().get(0);
|
||||
private final RuleCall cRefElementQualifiedNameParserRuleCall_3_1_1_0_1 = (RuleCall)cRefElementCrossReference_3_1_1_0.eContents().get(1);
|
||||
private final Keyword cRightCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4);
|
||||
|
||||
//Element:
|
||||
// 'element' name=ID '{' (contents+=Element | 'ref' ref+=[Element|QualifiedName])*
|
||||
// '}';
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'element' name=ID '{' (contents+=Element | 'ref' ref+=[Element|QualifiedName])* '}'
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//'element'
|
||||
public Keyword getElementKeyword_0() { return cElementKeyword_0; }
|
||||
|
||||
//name=ID
|
||||
public Assignment getNameAssignment_1() { return cNameAssignment_1; }
|
||||
|
||||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
|
||||
|
||||
//'{'
|
||||
public Keyword getLeftCurlyBracketKeyword_2() { return cLeftCurlyBracketKeyword_2; }
|
||||
|
||||
//(contents+=Element | 'ref' ref+=[Element|QualifiedName])*
|
||||
public Alternatives getAlternatives_3() { return cAlternatives_3; }
|
||||
|
||||
//contents+=Element
|
||||
public Assignment getContentsAssignment_3_0() { return cContentsAssignment_3_0; }
|
||||
|
||||
//Element
|
||||
public RuleCall getContentsElementParserRuleCall_3_0_0() { return cContentsElementParserRuleCall_3_0_0; }
|
||||
|
||||
//'ref' ref+=[Element|QualifiedName]
|
||||
public Group getGroup_3_1() { return cGroup_3_1; }
|
||||
|
||||
//'ref'
|
||||
public Keyword getRefKeyword_3_1_0() { return cRefKeyword_3_1_0; }
|
||||
|
||||
//ref+=[Element|QualifiedName]
|
||||
public Assignment getRefAssignment_3_1_1() { return cRefAssignment_3_1_1; }
|
||||
|
||||
//[Element|QualifiedName]
|
||||
public CrossReference getRefElementCrossReference_3_1_1_0() { return cRefElementCrossReference_3_1_1_0; }
|
||||
|
||||
//QualifiedName
|
||||
public RuleCall getRefElementQualifiedNameParserRuleCall_3_1_1_0_1() { return cRefElementQualifiedNameParserRuleCall_3_1_1_0_1; }
|
||||
|
||||
//'}'
|
||||
public Keyword getRightCurlyBracketKeyword_4() { return cRightCurlyBracketKeyword_4; }
|
||||
}
|
||||
public class QualifiedNameElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage.QualifiedName");
|
||||
private final Group cGroup = (Group)rule.eContents().get(1);
|
||||
private final RuleCall cIDTerminalRuleCall_0 = (RuleCall)cGroup.eContents().get(0);
|
||||
private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
|
||||
private final Keyword cFullStopKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
|
||||
private final RuleCall cIDTerminalRuleCall_1_1 = (RuleCall)cGroup_1.eContents().get(1);
|
||||
|
||||
//QualifiedName:
|
||||
// ID ('.' ID)*;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//ID ('.' ID)*
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//ID
|
||||
public RuleCall getIDTerminalRuleCall_0() { return cIDTerminalRuleCall_0; }
|
||||
|
||||
//('.' ID)*
|
||||
public Group getGroup_1() { return cGroup_1; }
|
||||
|
||||
//'.'
|
||||
public Keyword getFullStopKeyword_1_0() { return cFullStopKeyword_1_0; }
|
||||
|
||||
//ID
|
||||
public RuleCall getIDTerminalRuleCall_1_1() { return cIDTerminalRuleCall_1_1; }
|
||||
}
|
||||
|
||||
|
||||
private final PackageDeclarationElements pPackageDeclaration;
|
||||
private final ImportElements pImport;
|
||||
private final ElementElements pElement;
|
||||
private final QualifiedNameElements pQualifiedName;
|
||||
|
||||
private final Grammar grammar;
|
||||
|
||||
private final TerminalsGrammarAccess gaTerminals;
|
||||
|
||||
@Inject
|
||||
public FileAwareTestLanguageGrammarAccess(GrammarProvider grammarProvider,
|
||||
TerminalsGrammarAccess gaTerminals) {
|
||||
this.grammar = internalFindGrammar(grammarProvider);
|
||||
this.gaTerminals = gaTerminals;
|
||||
this.pPackageDeclaration = new PackageDeclarationElements();
|
||||
this.pImport = new ImportElements();
|
||||
this.pElement = new ElementElements();
|
||||
this.pQualifiedName = new QualifiedNameElements();
|
||||
}
|
||||
|
||||
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
|
||||
Grammar grammar = grammarProvider.getGrammar(this);
|
||||
while (grammar != null) {
|
||||
if ("org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage".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;
|
||||
}
|
||||
|
||||
|
||||
//PackageDeclaration:
|
||||
// 'package' name=QualifiedName
|
||||
// imports+=Import*
|
||||
// contents+=Element*;
|
||||
public PackageDeclarationElements getPackageDeclarationAccess() {
|
||||
return pPackageDeclaration;
|
||||
}
|
||||
|
||||
public ParserRule getPackageDeclarationRule() {
|
||||
return getPackageDeclarationAccess().getRule();
|
||||
}
|
||||
|
||||
//Import:
|
||||
// 'import' element=[Element|QualifiedName];
|
||||
public ImportElements getImportAccess() {
|
||||
return pImport;
|
||||
}
|
||||
|
||||
public ParserRule getImportRule() {
|
||||
return getImportAccess().getRule();
|
||||
}
|
||||
|
||||
//Element:
|
||||
// 'element' name=ID '{' (contents+=Element | 'ref' ref+=[Element|QualifiedName])*
|
||||
// '}';
|
||||
public ElementElements getElementAccess() {
|
||||
return pElement;
|
||||
}
|
||||
|
||||
public ParserRule getElementRule() {
|
||||
return getElementAccess().getRule();
|
||||
}
|
||||
|
||||
//QualifiedName:
|
||||
// ID ('.' ID)*;
|
||||
public QualifiedNameElements getQualifiedNameAccess() {
|
||||
return pQualifiedName;
|
||||
}
|
||||
|
||||
public ParserRule getQualifiedNameRule() {
|
||||
return getQualifiedNameAccess().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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.tests;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
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;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguageRuntimeModule;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguageStandaloneSetup;
|
||||
|
||||
public class FileAwareTestLanguageInjectorProvider 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 FileAwareTestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
public Injector createInjector() {
|
||||
return Guice.createInjector(createRuntimeModule());
|
||||
}
|
||||
}.createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
|
||||
protected FileAwareTestLanguageRuntimeModule createRuntimeModule() {
|
||||
// make it work also with Maven/Tycho and OSGI
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672
|
||||
return new FileAwareTestLanguageRuntimeModule() {
|
||||
@Override
|
||||
public ClassLoader bindClassLoaderToInstance() {
|
||||
return FileAwareTestLanguageInjectorProvider.class
|
||||
.getClassLoader();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreRegistry() {
|
||||
stateBeforeInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRegistry() {
|
||||
getInjector();
|
||||
stateAfterInjectorCreation.restoreGlobalState();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.validation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
|
||||
|
||||
public abstract class AbstractFileAwareTestLanguageValidator extends AbstractDeclarativeValidator {
|
||||
|
||||
@Override
|
||||
protected List<EPackage> getEPackages() {
|
||||
List<EPackage> result = new ArrayList<EPackage>();
|
||||
result.add(org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage.eINSTANCE);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,5 +45,6 @@ Workflow {
|
|||
language = @backtracking.ExBeeLangTestLanguage {}
|
||||
language = @noJdt.NoJdtTestLanguage {}
|
||||
language = @xtextgrammar.XtextGrammarTestLanguage {}
|
||||
language = @fileAware.FileAwareTestLanguage {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
module org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage
|
||||
|
||||
import org.eclipse.xtext.testlanguages.fragments.*
|
||||
|
||||
org.eclipse.xtext.xtext.generator.StandardLanguage {
|
||||
|
||||
name = "org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage"
|
||||
|
||||
serializer = {
|
||||
generateStub = false
|
||||
}
|
||||
|
||||
formatter = {
|
||||
generateXtendStub = true
|
||||
generateStub = true
|
||||
}
|
||||
|
||||
junitSupport = {
|
||||
generateStub = false
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* A language that constrains namespaces to model file paths.
|
||||
*/
|
||||
grammar org.eclipse.xtext.testlanguages.fileAware.FileAwareTestLanguage with org.eclipse.xtext.common.Terminals
|
||||
|
||||
generate fileAware "http://www.eclipse.org/xtext/testlanguage/FileAware"
|
||||
|
||||
PackageDeclaration:
|
||||
'package' name=QualifiedName
|
||||
imports+=Import*
|
||||
contents+=Element*;
|
||||
|
||||
Import:
|
||||
'import' element=[Element|QualifiedName];
|
||||
|
||||
Element:
|
||||
'element' name=ID '{'
|
||||
(contents+=Element | 'ref' ref+=[Element|QualifiedName])*
|
||||
'}';
|
||||
|
||||
QualifiedName:
|
||||
ID ('.' ID)*;
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware;
|
||||
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdater;
|
||||
import org.eclipse.xtext.resource.IResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.impl.LiveShadowedResourceDescriptions;
|
||||
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.scoping.FileAwareTestLanguageImportScopeProvider;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
/**
|
||||
* Use this class to register components to be used at runtime / without the Equinox extension registry.
|
||||
*/
|
||||
public class FileAwareTestLanguageRuntimeModule extends AbstractFileAwareTestLanguageRuntimeModule {
|
||||
|
||||
public void configureIResourceDescriptionsLiveScope(Binder binder) {
|
||||
binder.bind(IResourceDescriptions.class)
|
||||
.annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
|
||||
.to(LiveShadowedResourceDescriptions.class);
|
||||
}
|
||||
|
||||
public void configureIScopeProviderDelegate(Binder binder) {
|
||||
binder.bind(IScopeProvider.class)
|
||||
.annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
|
||||
.to(FileAwareTestLanguageImportScopeProvider.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware;
|
||||
|
||||
|
||||
/**
|
||||
* Initialization support for running Xtext languages without Equinox extension registry.
|
||||
*/
|
||||
public class FileAwareTestLanguageStandaloneSetup extends FileAwareTestLanguageStandaloneSetupGenerated {
|
||||
|
||||
public static void doSetup() {
|
||||
new FileAwareTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.formatting2
|
||||
|
||||
import org.eclipse.xtext.formatting2.AbstractFormatter2
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
|
||||
class FileAwareTestLanguageFormatter extends AbstractFormatter2 {
|
||||
|
||||
def dispatch void format(PackageDeclaration pkg, extension IFormattableDocument document) {
|
||||
pkg.regionFor.feature(FileAwarePackage.Literals.PACKAGE_DECLARATION__NAME).append[newLines = 2]
|
||||
for (imp : pkg.imports) {
|
||||
imp.format;
|
||||
imp.append[newLines = if(imp === pkg.imports.last) 2 else 1]
|
||||
}
|
||||
for (Element element : pkg.getContents()) {
|
||||
element.format;
|
||||
}
|
||||
}
|
||||
|
||||
def dispatch void format(Element element, extension IFormattableDocument document) {
|
||||
for (Element _element : element.getContents()) {
|
||||
_element.format;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.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
|
||||
*/
|
||||
public class FileAwareTestLanguageGenerator extends AbstractGenerator {
|
||||
|
||||
@Override
|
||||
public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
|
||||
// Iterator<Greeting> filtered = Iterators.filter(resource.getAllContents(), Greeting.class);
|
||||
// Iterator<String> names = Iterators.transform(filtered, new Function<Greeting, String>() {
|
||||
//
|
||||
// @Override
|
||||
// public String apply(Greeting greeting) {
|
||||
// return greeting.getName();
|
||||
// }
|
||||
// });
|
||||
// fsa.generateFile("greetings.txt", "People to greet: " + IteratorExtensions.join(names, ", "));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.scoping
|
||||
|
||||
import org.eclipse.emf.ecore.EObject
|
||||
import org.eclipse.xtext.naming.QualifiedName
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils
|
||||
import org.eclipse.xtext.scoping.impl.ImportNormalizer
|
||||
import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration
|
||||
import static org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage.Literals.*
|
||||
|
||||
class FileAwareTestLanguageImportScopeProvider extends ImportedNamespaceAwareLocalScopeProvider {
|
||||
|
||||
override protected internalGetImportedNamespaceResolvers(EObject context, boolean ignoreCase) {
|
||||
val resolvers = super.internalGetImportedNamespaceResolvers(context, ignoreCase)
|
||||
if (context instanceof PackageDeclaration) {
|
||||
resolvers += new ImportNormalizer(qualifiedNameConverter.toQualifiedName(context.name), true, false)
|
||||
for (imp : context.imports) {
|
||||
val name = imp.importedNamespace
|
||||
resolvers += new ImportNormalizer(name, false, false)
|
||||
}
|
||||
}
|
||||
return resolvers
|
||||
}
|
||||
|
||||
private def QualifiedName getImportedNamespace(Import imp) {
|
||||
val ele = imp.element
|
||||
if (ele.eIsProxy) {
|
||||
val name = NodeModelUtils.findNodesForFeature(imp, IMPORT__ELEMENT).head.text.trim
|
||||
return qualifiedNameConverter.toQualifiedName(name)
|
||||
} else {
|
||||
return qualifiedNameProvider.getFullyQualifiedName(ele)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.scoping;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.xtext.scoping.IGlobalScopeProvider;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public class FileAwareTestLanguageScopeProvider extends AbstractFileAwareTestLanguageScopeProvider {
|
||||
|
||||
@Inject IGlobalScopeProvider global;
|
||||
|
||||
public IScope getScope(EObject context, EReference reference) {
|
||||
if (reference == FileAwarePackage.Literals.IMPORT__ELEMENT) {
|
||||
return global.getScope(context.eResource(), reference, null);
|
||||
}
|
||||
return super.getScope(context, reference);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.validation;
|
||||
|
||||
|
||||
/**
|
||||
* This class contains custom validation rules.
|
||||
*
|
||||
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
|
||||
*/
|
||||
public class FileAwareTestLanguageValidator extends AbstractFileAwareTestLanguageValidator {
|
||||
|
||||
// public static final INVALID_NAME = 'invalidName'
|
||||
//
|
||||
// @Check
|
||||
// public void checkGreetingStartsWithCapital(Greeting greeting) {
|
||||
// if (!Character.isUpperCase(greeting.getName().charAt(0))) {
|
||||
// warning("Name should start with a capital",
|
||||
// FileAwareTestLanguagePackage.Literals.GREETING__NAME,
|
||||
// INVALID_NAME);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.eclipse.xtext.testlanguages.fileAware.formatting2;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.formatting2.AbstractFormatter2;
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument;
|
||||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageFormatter extends AbstractFormatter2 {
|
||||
protected void _format(final PackageDeclaration pkg, @Extension final IFormattableDocument document) {
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
|
||||
it.setNewLines(2);
|
||||
};
|
||||
document.append(this.textRegionExtensions.regionFor(pkg).feature(FileAwarePackage.Literals.PACKAGE_DECLARATION__NAME), _function);
|
||||
EList<Import> _imports = pkg.getImports();
|
||||
for (final Import imp : _imports) {
|
||||
{
|
||||
document.<Import>format(imp);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
|
||||
int _xifexpression = (int) 0;
|
||||
Import _last = IterableExtensions.<Import>last(pkg.getImports());
|
||||
boolean _tripleEquals = (imp == _last);
|
||||
if (_tripleEquals) {
|
||||
_xifexpression = 2;
|
||||
} else {
|
||||
_xifexpression = 1;
|
||||
}
|
||||
it.setNewLines(_xifexpression);
|
||||
};
|
||||
document.<Import>append(imp, _function_1);
|
||||
}
|
||||
}
|
||||
EList<Element> _contents = pkg.getContents();
|
||||
for (final Element element : _contents) {
|
||||
document.<Element>format(element);
|
||||
}
|
||||
}
|
||||
|
||||
protected void _format(final Element element, @Extension final IFormattableDocument document) {
|
||||
EList<Element> _contents = element.getContents();
|
||||
for (final Element _element : _contents) {
|
||||
document.<Element>format(_element);
|
||||
}
|
||||
}
|
||||
|
||||
public void format(final Object element, final IFormattableDocument document) {
|
||||
if (element instanceof XtextResource) {
|
||||
_format((XtextResource)element, document);
|
||||
return;
|
||||
} else if (element instanceof Element) {
|
||||
_format((Element)element, document);
|
||||
return;
|
||||
} else if (element instanceof PackageDeclaration) {
|
||||
_format((PackageDeclaration)element, document);
|
||||
return;
|
||||
} else if (element instanceof EObject) {
|
||||
_format((EObject)element, document);
|
||||
return;
|
||||
} else if (element == null) {
|
||||
_format((Void)null, document);
|
||||
return;
|
||||
} else if (element != null) {
|
||||
_format(element, document);
|
||||
return;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unhandled parameter types: " +
|
||||
Arrays.<Object>asList(element, document).toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.eclipse.xtext.testlanguages.fileAware.scoping;
|
||||
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.scoping.impl.ImportNormalizer;
|
||||
import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Element;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.Import;
|
||||
import org.eclipse.xtext.testlanguages.fileAware.fileAware.PackageDeclaration;
|
||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class FileAwareTestLanguageImportScopeProvider extends ImportedNamespaceAwareLocalScopeProvider {
|
||||
@Override
|
||||
protected List<ImportNormalizer> internalGetImportedNamespaceResolvers(final EObject context, final boolean ignoreCase) {
|
||||
final List<ImportNormalizer> resolvers = super.internalGetImportedNamespaceResolvers(context, ignoreCase);
|
||||
if ((context instanceof PackageDeclaration)) {
|
||||
QualifiedName _qualifiedName = this.getQualifiedNameConverter().toQualifiedName(((PackageDeclaration)context).getName());
|
||||
ImportNormalizer _importNormalizer = new ImportNormalizer(_qualifiedName, true, false);
|
||||
resolvers.add(_importNormalizer);
|
||||
EList<Import> _imports = ((PackageDeclaration)context).getImports();
|
||||
for (final Import imp : _imports) {
|
||||
{
|
||||
final QualifiedName name = this.getImportedNamespace(imp);
|
||||
ImportNormalizer _importNormalizer_1 = new ImportNormalizer(name, false, false);
|
||||
resolvers.add(_importNormalizer_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resolvers;
|
||||
}
|
||||
|
||||
private QualifiedName getImportedNamespace(final Import imp) {
|
||||
final Element ele = imp.getElement();
|
||||
boolean _eIsProxy = ele.eIsProxy();
|
||||
if (_eIsProxy) {
|
||||
final String name = IterableExtensions.<INode>head(NodeModelUtils.findNodesForFeature(imp, FileAwarePackage.Literals.IMPORT__ELEMENT)).getText().trim();
|
||||
return this.getQualifiedNameConverter().toQualifiedName(name);
|
||||
} else {
|
||||
return this.getQualifiedNameProvider().getFullyQualifiedName(ele);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue