mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
GH-1047: Implemented textDocument/prepareRename
- `textDocument/prepareRename` is automatically executed when the client declares `prepareSupport`. - Exposed the `InitializeResult` on the LS access API. - From now on, the refactoring issue acceptor does not throw an exception when adding issues with `ERROR` or `FATAL` severity. - Extended the test language to support FQNs via package declarations. Closes #1047. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
a7421712db
commit
a51de02a67
67 changed files with 6548 additions and 1956 deletions
|
@ -3,11 +3,17 @@
|
|||
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testLanguage" nsURI="http://www.eclipse.org/xtext/ide/tests/testlanguage/TestLanguage"
|
||||
nsPrefix="testLanguage">
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Model">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="types" upperBound="-1"
|
||||
eType="#//TypeDeclaration" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
|
||||
eType="#//AbstractElement" containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="TypeDeclaration">
|
||||
<eClassifiers xsi:type="ecore:EClass" name="PackageDeclaration" eSuperTypes="#//AbstractElement">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
|
||||
eType="#//AbstractElement" containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="AbstractElement">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="TypeDeclaration" eSuperTypes="#//AbstractElement">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="superType" eType="#//TypeDeclaration"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="members" upperBound="-1"
|
||||
eType="#//Member" containment="true"/>
|
||||
|
|
|
@ -7,10 +7,15 @@
|
|||
<genPackages prefix="TestLanguage" basePackage="org.eclipse.xtext.ide.tests.testlanguage"
|
||||
disposableProviderFactory="true" fileExtensions="testlang,testlangext" ecorePackage="TestLanguage.ecore#/">
|
||||
<genClasses ecoreClass="TestLanguage.ecore#//Model">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//Model/types"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//Model/elements"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="TestLanguage.ecore#//PackageDeclaration">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//PackageDeclaration/elements"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="TestLanguage.ecore#//AbstractElement">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TestLanguage.ecore#//AbstractElement/name"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="TestLanguage.ecore#//TypeDeclaration">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TestLanguage.ecore#//TypeDeclaration/name"/>
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//TypeDeclaration/superType"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//TypeDeclaration/members"/>
|
||||
</genClasses>
|
||||
|
|
|
@ -79,8 +79,11 @@ class ContentAssistContextFactoryTest {
|
|||
'''
|
||||
'''
|
||||
context0 {
|
||||
Assignment: Model:types+= *
|
||||
RuleCall: Model:types+=TypeDeclaration
|
||||
Assignment: Model:elements+= *
|
||||
RuleCall: Model:elements+=AbstractElement
|
||||
RuleCall: AbstractElement:PackageDeclaration
|
||||
Keyword: PackageDeclaration:'package'
|
||||
RuleCall: AbstractElement:TypeDeclaration
|
||||
Keyword: TypeDeclaration:'type'
|
||||
RuleCall: <AbstractElement not contained in AbstractRule!>:Model
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class CompletionTest extends AbstractTestLangLanguageServerTest {
|
|||
testCompletion [
|
||||
model = ''
|
||||
expectedCompletionItems = '''
|
||||
package -> package [[0, 0] .. [0, 0]]
|
||||
type -> type [[0, 0] .. [0, 0]]
|
||||
Sample Snippet -> type ${1|A,B,C|} {
|
||||
|
||||
|
@ -119,6 +120,7 @@ class CompletionTest extends AbstractTestLangLanguageServerTest {
|
|||
line = 1
|
||||
column = 0
|
||||
expectedCompletionItems = '''
|
||||
(Keyword) package -> package [[1, 0] .. [1, 0]]
|
||||
(Keyword) type -> type [[1, 0] .. [1, 0]]
|
||||
(Snippet|Snippet) Sample Snippet -> type ${1|A,B,C|} {
|
||||
|
||||
|
|
|
@ -0,0 +1,233 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2019 TypeFox 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.server
|
||||
|
||||
import com.google.common.base.Throwables
|
||||
import com.google.inject.Inject
|
||||
import java.io.File
|
||||
import org.eclipse.lsp4j.ClientCapabilities
|
||||
import org.eclipse.lsp4j.Position
|
||||
import org.eclipse.lsp4j.RenameCapabilities
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.xtext.ide.server.UriExtensions
|
||||
import org.junit.Test
|
||||
|
||||
import static org.junit.Assert.*
|
||||
import java.io.FileNotFoundException
|
||||
|
||||
class PrepareRenameTest extends AbstractTestLangLanguageServerTest {
|
||||
|
||||
@Inject
|
||||
extension UriExtensions
|
||||
|
||||
@Test
|
||||
def void testRenameFqn_missing_file_null() {
|
||||
val uri = new File('''missing.«fileExtension»''').toURI.normalize.toUriString
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(uri), new Position(2, 5), 'Does not matter')
|
||||
assertNull(languageServer.rename(params).get)
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_missing_file_null() {
|
||||
val uri = new File('''missing.«fileExtension»''').toURI.normalize.toUriString
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 5))
|
||||
assertNull(languageServer.prepareRename(params).get)
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_missing_file_exception() {
|
||||
val uri = new File('''missing.«fileExtension»''').toURI.normalize.toUriString
|
||||
initialize()
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 5))
|
||||
try {
|
||||
assertNull(languageServer.prepareRename(params).get)
|
||||
fail('Expected an error.')
|
||||
} catch (Exception e) {
|
||||
assertTrue(Throwables.getRootCause(e) instanceof FileNotFoundException)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testRenameFqn_invalid_error() {
|
||||
val uri = 'my-type-invalid.testlang'.writeFile('''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
''')
|
||||
initialize()
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(uri), new Position(2, 5), 'Does not matter')
|
||||
try {
|
||||
val workspaceEdit = languageServer.rename(params).get
|
||||
fail('''Expected an expcetion when trying to rename document but got a valid workspace edit instead: «workspaceEdit»''')
|
||||
} catch (Exception e) {
|
||||
val rootCause = Throwables.getRootCause(e)
|
||||
assertTrue(rootCause instanceof ResponseErrorException)
|
||||
val error = (rootCause as ResponseErrorException).responseError
|
||||
assertTrue(error.data.toString.contains('No element found at position'))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testRenameFqn_invalid_null() {
|
||||
val uri = 'my-type-invalid.testlang'.writeFile('''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
''')
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(uri), new Position(2, 5), 'Does not matter')
|
||||
assertNull(languageServer.rename(params).get)
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testRenameFqn_before_ok() {
|
||||
val uri = 'my-type-valid.testlang'.writeFile('''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
''')
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(uri), new Position(2, 13), 'YourType')
|
||||
val workspaceEdit = languageServer.rename(params).get
|
||||
assertEquals('''
|
||||
changes :
|
||||
my-type-valid.testlang : foo.bar.YourType [[2, 4] .. [2, 18]]
|
||||
YourType [[4, 7] .. [4, 13]]
|
||||
documentChanges :
|
||||
'''.toString, toExpectation(workspaceEdit))
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_before_nok() {
|
||||
val model = '''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
'''
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val uri = 'my-type-valid.testlang'.writeFile(model)
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 11))
|
||||
assertNull(languageServer.prepareRename(params).get)
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_start_ok() {
|
||||
val model = '''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
'''
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val uri = 'my-type-valid.testlang'.writeFile(model)
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 12))
|
||||
val range = languageServer.prepareRename(params).get.getLeft
|
||||
assertEquals('MyType', new Document(0, model).getSubstring(range))
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_in_ok() {
|
||||
val model = '''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
'''
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val uri = 'my-type-valid.testlang'.writeFile(model)
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 14))
|
||||
val range = languageServer.prepareRename(params).get.getLeft
|
||||
assertEquals('MyType', new Document(0, model).getSubstring(range))
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_end_ok() {
|
||||
val model = '''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
'''
|
||||
initializeWithPrepareSupport()
|
||||
|
||||
val uri = 'my-type-valid.testlang'.writeFile(model)
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 18))
|
||||
val range = languageServer.prepareRename(params).get.getLeft
|
||||
assertEquals('MyType', new Document(0, model).getSubstring(range))
|
||||
}
|
||||
|
||||
@Test
|
||||
def void testPrepareRenameFqn_end_null() {
|
||||
val model = '''
|
||||
package foo.bar {
|
||||
type A {
|
||||
foo.bar.MyType bar
|
||||
}
|
||||
type MyType { }
|
||||
}
|
||||
'''
|
||||
initialize()
|
||||
|
||||
val uri = 'my-type-valid.testlang'.writeFile(model)
|
||||
|
||||
val params = new TextDocumentPositionParams(new TextDocumentIdentifier(uri), new Position(2, 18))
|
||||
assertNull(languageServer.prepareRename(params).get)
|
||||
}
|
||||
|
||||
private def initializeWithPrepareSupport() {
|
||||
initialize[
|
||||
capabilities = new ClientCapabilities => [
|
||||
textDocument = new TextDocumentClientCapabilities => [
|
||||
rename = new RenameCapabilities => [
|
||||
prepareSupport = true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
}
|
|
@ -7,14 +7,20 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.server
|
||||
|
||||
import com.google.common.base.Throwables
|
||||
import org.eclipse.lsp4j.ClientCapabilities
|
||||
import org.eclipse.lsp4j.Position
|
||||
import org.eclipse.lsp4j.RenameCapabilities
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest
|
||||
import static org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import java.util.concurrent.ExecutionException
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest
|
||||
import org.junit.Test
|
||||
|
||||
import static org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
|
@ -70,23 +76,37 @@ class RenamePositionTest extends AbstractLanguageServerTest {
|
|||
protected def void renameAndFail(String model, Position position, String messageFragment) {
|
||||
val modelFile = 'MyType.testlang'.writeFile(model)
|
||||
initialize
|
||||
val params = new RenameParams(new TextDocumentIdentifier(modelFile), position, 'Tescht')
|
||||
try {
|
||||
languageServer.rename(params).get
|
||||
val identifier = new TextDocumentIdentifier(modelFile)
|
||||
val prepareRenameResult = languageServer.prepareRename(new TextDocumentPositionParams(identifier, position)).get
|
||||
assertNull('''expected null result got «prepareRenameResult» instead''', prepareRenameResult)
|
||||
val renameParams = new RenameParams(new TextDocumentIdentifier(modelFile), position, 'Tescht')
|
||||
languageServer.rename(renameParams).get
|
||||
fail('Rename should have failed')
|
||||
} catch (Exception exc) {
|
||||
assertTrue(exc instanceof ExecutionException)
|
||||
assertTrue(exc.cause instanceof ExecutionException)
|
||||
assertTrue(exc.cause.cause instanceof ResponseErrorException)
|
||||
val error = (exc.cause.cause as ResponseErrorException).responseError
|
||||
val rootCause = Throwables.getRootCause(exc)
|
||||
assertTrue(rootCause instanceof ResponseErrorException)
|
||||
val error = (rootCause as ResponseErrorException).responseError
|
||||
assertTrue(error.data.toString.contains(messageFragment))
|
||||
}
|
||||
}
|
||||
|
||||
protected def renameWithSuccess(String model, Position position) {
|
||||
val modelFile = 'MyType.testlang'.writeFile(model)
|
||||
initialize
|
||||
val params = new RenameParams(new TextDocumentIdentifier(modelFile), position, 'Tescht')
|
||||
initialize [
|
||||
capabilities = new ClientCapabilities => [
|
||||
textDocument = new TextDocumentClientCapabilities => [
|
||||
rename = new RenameCapabilities => [
|
||||
prepareSupport = true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
val identifier = new TextDocumentIdentifier(modelFile)
|
||||
val range = languageServer.prepareRename(new TextDocumentPositionParams(identifier, position)).get.getLeft
|
||||
assertNotNull(range)
|
||||
assertEquals(new Document(0, model).getSubstring(range), 'Test')
|
||||
val params = new RenameParams(identifier, position, 'Tescht')
|
||||
val workspaceEdit = languageServer.rename(params).get
|
||||
assertEquals('''
|
||||
changes :
|
||||
|
|
|
@ -7,14 +7,18 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.server
|
||||
|
||||
import org.eclipse.lsp4j.Position
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest
|
||||
import org.junit.Test
|
||||
import org.eclipse.lsp4j.ClientCapabilities
|
||||
import org.eclipse.lsp4j.Position
|
||||
import org.eclipse.lsp4j.RenameCapabilities
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.lsp4j.WorkspaceClientCapabilities
|
||||
import org.eclipse.lsp4j.WorkspaceEditCapabilities
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
|
@ -36,8 +40,11 @@ class RenameTest2 extends AbstractLanguageServerTest {
|
|||
'''
|
||||
val file = 'foo/Foo.fileawaretestlanguage'.writeFile(model)
|
||||
initialize
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(file), new Position(2, 9), 'Bar')
|
||||
val identifier = new TextDocumentIdentifier(file)
|
||||
val position = new Position(2, 9)
|
||||
val range = languageServer.prepareRename(new TextDocumentPositionParams(identifier, position)).get.getLeft
|
||||
assertEquals('Foo', new Document(0, model).getSubstring(range))
|
||||
val params = new RenameParams(identifier, position, 'Bar')
|
||||
val workspaceEdit = languageServer.rename(params).get
|
||||
assertEquals('''
|
||||
changes :
|
||||
|
@ -62,8 +69,12 @@ class RenameTest2 extends AbstractLanguageServerTest {
|
|||
'''
|
||||
val file = 'foo/Foo.fileawaretestlanguage'.writeFile(model)
|
||||
initialize
|
||||
|
||||
val params = new RenameParams(new TextDocumentIdentifier(file), new Position(2, 9), 'Baz')
|
||||
|
||||
val identifier = new TextDocumentIdentifier(file)
|
||||
val position = new Position(2, 9)
|
||||
val range = languageServer.prepareRename(new TextDocumentPositionParams(identifier, position)).get.getLeft
|
||||
assertEquals('Foo', new Document(0, model).getSubstring(range))
|
||||
val params = new RenameParams(identifier, position, 'Baz')
|
||||
val workspaceEdit = languageServer.rename(params).get
|
||||
assertEquals('''
|
||||
changes :
|
||||
|
@ -73,8 +84,7 @@ class RenameTest2 extends AbstractLanguageServerTest {
|
|||
Bar [[6, 5] .. [6, 12]]
|
||||
'''.toString, toExpectation(workspaceEdit))
|
||||
}
|
||||
|
||||
|
||||
|
||||
override protected initialize() {
|
||||
super.initialize([params | params.capabilities = new ClientCapabilities => [
|
||||
workspace = new WorkspaceClientCapabilities => [
|
||||
|
@ -82,6 +92,12 @@ class RenameTest2 extends AbstractLanguageServerTest {
|
|||
documentChanges = true
|
||||
]
|
||||
]
|
||||
]])
|
||||
textDocument = new TextDocumentClientCapabilities => [
|
||||
rename = new RenameCapabilities => [
|
||||
prepareSupport = true
|
||||
]
|
||||
]
|
||||
]
|
||||
])
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -35,9 +35,11 @@ public class TestLanguageParser extends AbstractContentAssistParser {
|
|||
}
|
||||
|
||||
private static void init(ImmutableMap.Builder<AbstractElement, String> builder, TestLanguageGrammarAccess grammarAccess) {
|
||||
builder.put(grammarAccess.getAbstractElementAccess().getAlternatives(), "rule__AbstractElement__Alternatives");
|
||||
builder.put(grammarAccess.getMemberAccess().getAlternatives(), "rule__Member__Alternatives");
|
||||
builder.put(grammarAccess.getTypeAccess().getAlternatives_0(), "rule__Type__Alternatives_0");
|
||||
builder.put(grammarAccess.getPrimitiveTypeAccess().getNameAlternatives_0(), "rule__PrimitiveType__NameAlternatives_0");
|
||||
builder.put(grammarAccess.getPackageDeclarationAccess().getGroup(), "rule__PackageDeclaration__Group__0");
|
||||
builder.put(grammarAccess.getTypeDeclarationAccess().getGroup(), "rule__TypeDeclaration__Group__0");
|
||||
builder.put(grammarAccess.getTypeDeclarationAccess().getGroup_2(), "rule__TypeDeclaration__Group_2__0");
|
||||
builder.put(grammarAccess.getPropertyAccess().getGroup(), "rule__Property__Group__0");
|
||||
|
@ -51,7 +53,11 @@ public class TestLanguageParser extends AbstractContentAssistParser {
|
|||
builder.put(grammarAccess.getOperationCallAccess().getGroup_2(), "rule__OperationCall__Group_2__0");
|
||||
builder.put(grammarAccess.getOperationCallAccess().getGroup_2_1(), "rule__OperationCall__Group_2_1__0");
|
||||
builder.put(grammarAccess.getParameterAccess().getGroup(), "rule__Parameter__Group__0");
|
||||
builder.put(grammarAccess.getModelAccess().getTypesAssignment(), "rule__Model__TypesAssignment");
|
||||
builder.put(grammarAccess.getQualifiedNameAccess().getGroup(), "rule__QualifiedName__Group__0");
|
||||
builder.put(grammarAccess.getQualifiedNameAccess().getGroup_1(), "rule__QualifiedName__Group_1__0");
|
||||
builder.put(grammarAccess.getModelAccess().getElementsAssignment(), "rule__Model__ElementsAssignment");
|
||||
builder.put(grammarAccess.getPackageDeclarationAccess().getNameAssignment_1(), "rule__PackageDeclaration__NameAssignment_1");
|
||||
builder.put(grammarAccess.getPackageDeclarationAccess().getElementsAssignment_3(), "rule__PackageDeclaration__ElementsAssignment_3");
|
||||
builder.put(grammarAccess.getTypeDeclarationAccess().getNameAssignment_1(), "rule__TypeDeclaration__NameAssignment_1");
|
||||
builder.put(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1(), "rule__TypeDeclaration__SuperTypeAssignment_2_1");
|
||||
builder.put(grammarAccess.getTypeDeclarationAccess().getMembersAssignment_4(), "rule__TypeDeclaration__MembersAssignment_4");
|
||||
|
|
|
@ -69,9 +69,59 @@ ruleModel
|
|||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getModelAccess().getTypesAssignment()); }
|
||||
(rule__Model__TypesAssignment)*
|
||||
{ after(grammarAccess.getModelAccess().getTypesAssignment()); }
|
||||
{ before(grammarAccess.getModelAccess().getElementsAssignment()); }
|
||||
(rule__Model__ElementsAssignment)*
|
||||
{ after(grammarAccess.getModelAccess().getElementsAssignment()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
// 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 entryRuleAbstractElement
|
||||
entryRuleAbstractElement
|
||||
:
|
||||
{ before(grammarAccess.getAbstractElementRule()); }
|
||||
ruleAbstractElement
|
||||
{ after(grammarAccess.getAbstractElementRule()); }
|
||||
EOF
|
||||
;
|
||||
|
||||
// Rule AbstractElement
|
||||
ruleAbstractElement
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getAbstractElementAccess().getAlternatives()); }
|
||||
(rule__AbstractElement__Alternatives)
|
||||
{ after(grammarAccess.getAbstractElementAccess().getAlternatives()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
|
@ -303,6 +353,52 @@ 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__AbstractElement__Alternatives
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getAbstractElementAccess().getPackageDeclarationParserRuleCall_0()); }
|
||||
rulePackageDeclaration
|
||||
{ after(grammarAccess.getAbstractElementAccess().getPackageDeclarationParserRuleCall_0()); }
|
||||
)
|
||||
|
|
||||
(
|
||||
{ before(grammarAccess.getAbstractElementAccess().getTypeDeclarationParserRuleCall_1()); }
|
||||
ruleTypeDeclaration
|
||||
{ after(grammarAccess.getAbstractElementAccess().getTypeDeclarationParserRuleCall_1()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__Member__Alternatives
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
|
@ -378,6 +474,141 @@ 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().getLeftCurlyBracketKeyword_2()); }
|
||||
'{'
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getLeftCurlyBracketKeyword_2()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__3__Impl
|
||||
rule__PackageDeclaration__Group__4
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__3__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getElementsAssignment_3()); }
|
||||
(rule__PackageDeclaration__ElementsAssignment_3)*
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getElementsAssignment_3()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__4
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
rule__PackageDeclaration__Group__4__Impl
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
rule__PackageDeclaration__Group__4__Impl
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getRightCurlyBracketKeyword_4()); }
|
||||
'}'
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getRightCurlyBracketKeyword_4()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
restoreStackSize(stackSize);
|
||||
}
|
||||
|
||||
|
||||
rule__TypeDeclaration__Group__0
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
|
@ -1512,15 +1743,153 @@ finally {
|
|||
}
|
||||
|
||||
|
||||
rule__Model__TypesAssignment
|
||||
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__Model__ElementsAssignment
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getModelAccess().getTypesTypeDeclarationParserRuleCall_0()); }
|
||||
ruleTypeDeclaration
|
||||
{ after(grammarAccess.getModelAccess().getTypesTypeDeclarationParserRuleCall_0()); }
|
||||
{ before(grammarAccess.getModelAccess().getElementsAbstractElementParserRuleCall_0()); }
|
||||
ruleAbstractElement
|
||||
{ after(grammarAccess.getModelAccess().getElementsAbstractElementParserRuleCall_0()); }
|
||||
)
|
||||
;
|
||||
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__ElementsAssignment_3
|
||||
@init {
|
||||
int stackSize = keepStackSize();
|
||||
}
|
||||
:
|
||||
(
|
||||
{ before(grammarAccess.getPackageDeclarationAccess().getElementsAbstractElementParserRuleCall_3_0()); }
|
||||
ruleAbstractElement
|
||||
{ after(grammarAccess.getPackageDeclarationAccess().getElementsAbstractElementParserRuleCall_3_0()); }
|
||||
)
|
||||
;
|
||||
finally {
|
||||
|
@ -1550,9 +1919,9 @@ rule__TypeDeclaration__SuperTypeAssignment_2_1
|
|||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
|
||||
(
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
|
||||
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationQualifiedNameParserRuleCall_2_1_0_1()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationQualifiedNameParserRuleCall_2_1_0_1()); }
|
||||
)
|
||||
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
|
||||
)
|
||||
|
@ -1787,9 +2156,9 @@ rule__TypeReference__TypeRefAssignment
|
|||
(
|
||||
{ before(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationCrossReference_0()); }
|
||||
(
|
||||
{ before(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationIDTerminalRuleCall_0_1()); }
|
||||
RULE_ID
|
||||
{ after(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationIDTerminalRuleCall_0_1()); }
|
||||
{ before(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1()); }
|
||||
ruleQualifiedName
|
||||
{ after(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1()); }
|
||||
)
|
||||
{ after(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationCrossReference_0()); }
|
||||
)
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
'('=21
|
||||
')'=22
|
||||
','=23
|
||||
':'=24
|
||||
'['=25
|
||||
']'=19
|
||||
'('=22
|
||||
')'=23
|
||||
','=24
|
||||
'.'=26
|
||||
':'=25
|
||||
'['=27
|
||||
']'=20
|
||||
'boolean'=13
|
||||
'extends'=18
|
||||
'extends'=19
|
||||
'int'=12
|
||||
'op'=20
|
||||
'op'=21
|
||||
'package'=15
|
||||
'string'=11
|
||||
'type'=15
|
||||
'type'=18
|
||||
'void'=14
|
||||
'{'=16
|
||||
'}'=17
|
||||
|
@ -35,3 +37,5 @@ T__22=22
|
|||
T__23=23
|
||||
T__24=24
|
||||
T__25=25
|
||||
T__26=26
|
||||
T__27=27
|
||||
|
|
|
@ -27,6 +27,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
public static final int RULE_ID=4;
|
||||
public static final int RULE_WS=9;
|
||||
public static final int RULE_ANY_OTHER=10;
|
||||
public static final int T__26=26;
|
||||
public static final int T__27=27;
|
||||
public static final int RULE_INT=5;
|
||||
public static final int T__22=22;
|
||||
public static final int RULE_ML_COMMENT=7;
|
||||
|
@ -138,10 +140,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__15;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:15:7: ( 'type' )
|
||||
// InternalTestLanguage.g:15:9: 'type'
|
||||
// InternalTestLanguage.g:15:7: ( 'package' )
|
||||
// InternalTestLanguage.g:15:9: 'package'
|
||||
{
|
||||
match("type");
|
||||
match("package");
|
||||
|
||||
|
||||
}
|
||||
|
@ -199,10 +201,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__18;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:18:7: ( 'extends' )
|
||||
// InternalTestLanguage.g:18:9: 'extends'
|
||||
// InternalTestLanguage.g:18:7: ( 'type' )
|
||||
// InternalTestLanguage.g:18:9: 'type'
|
||||
{
|
||||
match("extends");
|
||||
match("type");
|
||||
|
||||
|
||||
}
|
||||
|
@ -220,10 +222,11 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__19;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:19:7: ( ']' )
|
||||
// InternalTestLanguage.g:19:9: ']'
|
||||
// InternalTestLanguage.g:19:7: ( 'extends' )
|
||||
// InternalTestLanguage.g:19:9: 'extends'
|
||||
{
|
||||
match(']');
|
||||
match("extends");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -240,11 +243,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__20;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:20:7: ( 'op' )
|
||||
// InternalTestLanguage.g:20:9: 'op'
|
||||
// InternalTestLanguage.g:20:7: ( ']' )
|
||||
// InternalTestLanguage.g:20:9: ']'
|
||||
{
|
||||
match("op");
|
||||
|
||||
match(']');
|
||||
|
||||
}
|
||||
|
||||
|
@ -261,10 +263,11 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__21;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:21:7: ( '(' )
|
||||
// InternalTestLanguage.g:21:9: '('
|
||||
// InternalTestLanguage.g:21:7: ( 'op' )
|
||||
// InternalTestLanguage.g:21:9: 'op'
|
||||
{
|
||||
match('(');
|
||||
match("op");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -281,10 +284,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__22;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:22:7: ( ')' )
|
||||
// InternalTestLanguage.g:22:9: ')'
|
||||
// InternalTestLanguage.g:22:7: ( '(' )
|
||||
// InternalTestLanguage.g:22:9: '('
|
||||
{
|
||||
match(')');
|
||||
match('(');
|
||||
|
||||
}
|
||||
|
||||
|
@ -301,10 +304,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__23;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:23:7: ( ',' )
|
||||
// InternalTestLanguage.g:23:9: ','
|
||||
// InternalTestLanguage.g:23:7: ( ')' )
|
||||
// InternalTestLanguage.g:23:9: ')'
|
||||
{
|
||||
match(',');
|
||||
match(')');
|
||||
|
||||
}
|
||||
|
||||
|
@ -321,10 +324,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__24;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:24:7: ( ':' )
|
||||
// InternalTestLanguage.g:24:9: ':'
|
||||
// InternalTestLanguage.g:24:7: ( ',' )
|
||||
// InternalTestLanguage.g:24:9: ','
|
||||
{
|
||||
match(':');
|
||||
match(',');
|
||||
|
||||
}
|
||||
|
||||
|
@ -341,10 +344,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__25;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:25:7: ( '[' )
|
||||
// InternalTestLanguage.g:25:9: '['
|
||||
// InternalTestLanguage.g:25:7: ( ':' )
|
||||
// InternalTestLanguage.g:25:9: ':'
|
||||
{
|
||||
match('[');
|
||||
match(':');
|
||||
|
||||
}
|
||||
|
||||
|
@ -356,15 +359,55 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
// $ANTLR end "T__25"
|
||||
|
||||
// $ANTLR start "T__26"
|
||||
public final void mT__26() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__26;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:26:7: ( '.' )
|
||||
// InternalTestLanguage.g:26:9: '.'
|
||||
{
|
||||
match('.');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__26"
|
||||
|
||||
// $ANTLR start "T__27"
|
||||
public final void mT__27() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__27;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:27:7: ( '[' )
|
||||
// InternalTestLanguage.g:27:9: '['
|
||||
{
|
||||
match('[');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__27"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1816:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalTestLanguage.g:1816:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalTestLanguage.g:2185:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalTestLanguage.g:2185:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalTestLanguage.g:1816:11: ( '^' )?
|
||||
// InternalTestLanguage.g:2185:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
|
@ -373,7 +416,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1816:11: '^'
|
||||
// InternalTestLanguage.g:2185:11: '^'
|
||||
{
|
||||
match('^');
|
||||
|
||||
|
@ -391,7 +434,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
// InternalTestLanguage.g:1816:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalTestLanguage.g:2185:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
|
@ -440,10 +483,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_INT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1818:10: ( ( '0' .. '9' )+ )
|
||||
// InternalTestLanguage.g:1818:12: ( '0' .. '9' )+
|
||||
// InternalTestLanguage.g:2187:10: ( ( '0' .. '9' )+ )
|
||||
// InternalTestLanguage.g:2187:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalTestLanguage.g:1818:12: ( '0' .. '9' )+
|
||||
// InternalTestLanguage.g:2187:12: ( '0' .. '9' )+
|
||||
int cnt3=0;
|
||||
loop3:
|
||||
do {
|
||||
|
@ -457,7 +500,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1818:13: '0' .. '9'
|
||||
// InternalTestLanguage.g:2187:13: '0' .. '9'
|
||||
{
|
||||
matchRange('0','9');
|
||||
|
||||
|
@ -489,10 +532,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_STRING;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1820:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalTestLanguage.g:1820:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalTestLanguage.g:2189:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalTestLanguage.g:2189:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalTestLanguage.g:1820:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalTestLanguage.g:2189:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
int alt6=2;
|
||||
int LA6_0 = input.LA(1);
|
||||
|
||||
|
@ -510,10 +553,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt6) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1820:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
// InternalTestLanguage.g:2189:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalTestLanguage.g:1820:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
// InternalTestLanguage.g:2189:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=3;
|
||||
|
@ -529,7 +572,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1820:21: '\\\\' .
|
||||
// InternalTestLanguage.g:2189:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -537,7 +580,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:1820:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
// InternalTestLanguage.g:2189:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -562,10 +605,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:1820:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
// InternalTestLanguage.g:2189:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalTestLanguage.g:1820:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
// InternalTestLanguage.g:2189:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
loop5:
|
||||
do {
|
||||
int alt5=3;
|
||||
|
@ -581,7 +624,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt5) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1820:54: '\\\\' .
|
||||
// InternalTestLanguage.g:2189:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -589,7 +632,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:1820:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
// InternalTestLanguage.g:2189:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -632,12 +675,12 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ML_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1822:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalTestLanguage.g:1822:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
// InternalTestLanguage.g:2191:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalTestLanguage.g:2191:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalTestLanguage.g:1822:24: ( options {greedy=false; } : . )*
|
||||
// InternalTestLanguage.g:2191:24: ( options {greedy=false; } : . )*
|
||||
loop7:
|
||||
do {
|
||||
int alt7=2;
|
||||
|
@ -662,7 +705,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt7) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1822:52: .
|
||||
// InternalTestLanguage.g:2191:52: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
@ -692,12 +735,12 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_SL_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1824:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalTestLanguage.g:1824:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
// InternalTestLanguage.g:2193:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalTestLanguage.g:2193:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalTestLanguage.g:1824:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
// InternalTestLanguage.g:2193:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
loop8:
|
||||
do {
|
||||
int alt8=2;
|
||||
|
@ -710,7 +753,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt8) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1824:24: ~ ( ( '\\n' | '\\r' ) )
|
||||
// InternalTestLanguage.g:2193: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();
|
||||
|
@ -730,7 +773,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
} while (true);
|
||||
|
||||
// InternalTestLanguage.g:1824:40: ( ( '\\r' )? '\\n' )?
|
||||
// InternalTestLanguage.g:2193:40: ( ( '\\r' )? '\\n' )?
|
||||
int alt10=2;
|
||||
int LA10_0 = input.LA(1);
|
||||
|
||||
|
@ -739,9 +782,9 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt10) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1824:41: ( '\\r' )? '\\n'
|
||||
// InternalTestLanguage.g:2193:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalTestLanguage.g:1824:41: ( '\\r' )?
|
||||
// InternalTestLanguage.g:2193:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
|
@ -750,7 +793,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:1824:41: '\\r'
|
||||
// InternalTestLanguage.g:2193:41: '\\r'
|
||||
{
|
||||
match('\r');
|
||||
|
||||
|
@ -782,10 +825,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_WS;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1826:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalTestLanguage.g:1826:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalTestLanguage.g:2195:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalTestLanguage.g:2195:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalTestLanguage.g:1826:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalTestLanguage.g:2195:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
int cnt11=0;
|
||||
loop11:
|
||||
do {
|
||||
|
@ -839,8 +882,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ANY_OTHER;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:1828:16: ( . )
|
||||
// InternalTestLanguage.g:1828:18: .
|
||||
// InternalTestLanguage.g:2197:16: ( . )
|
||||
// InternalTestLanguage.g:2197:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
@ -855,8 +898,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=22;
|
||||
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=24;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
|
@ -965,49 +1008,63 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 16 :
|
||||
// InternalTestLanguage.g:1:100: RULE_ID
|
||||
// InternalTestLanguage.g:1:100: T__26
|
||||
{
|
||||
mT__26();
|
||||
|
||||
}
|
||||
break;
|
||||
case 17 :
|
||||
// InternalTestLanguage.g:1:106: T__27
|
||||
{
|
||||
mT__27();
|
||||
|
||||
}
|
||||
break;
|
||||
case 18 :
|
||||
// InternalTestLanguage.g:1:112: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 17 :
|
||||
// InternalTestLanguage.g:1:108: RULE_INT
|
||||
case 19 :
|
||||
// InternalTestLanguage.g:1:120: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 18 :
|
||||
// InternalTestLanguage.g:1:117: RULE_STRING
|
||||
case 20 :
|
||||
// InternalTestLanguage.g:1:129: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 19 :
|
||||
// InternalTestLanguage.g:1:129: RULE_ML_COMMENT
|
||||
case 21 :
|
||||
// InternalTestLanguage.g:1:141: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 20 :
|
||||
// InternalTestLanguage.g:1:145: RULE_SL_COMMENT
|
||||
case 22 :
|
||||
// InternalTestLanguage.g:1:157: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 21 :
|
||||
// InternalTestLanguage.g:1:161: RULE_WS
|
||||
case 23 :
|
||||
// InternalTestLanguage.g:1:173: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 22 :
|
||||
// InternalTestLanguage.g:1:169: RULE_ANY_OTHER
|
||||
case 24 :
|
||||
// InternalTestLanguage.g:1:181: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
|
@ -1021,87 +1078,97 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\5\31\2\uffff\1\31\1\uffff\1\31\5\uffff\1\27\2\uffff\3\27\2\uffff\1\31\1\uffff\4\31\2\uffff\1\31\1\uffff\1\63\12\uffff\1\31\1\65\4\31\1\uffff\1\31\1\uffff\1\31\1\74\1\75\3\31\2\uffff\1\31\1\102\2\31\1\uffff\1\105\1\106\2\uffff";
|
||||
"\1\uffff\5\33\2\uffff\2\33\1\uffff\1\33\6\uffff\1\31\2\uffff\3\31\2\uffff\1\33\1\uffff\4\33\2\uffff\2\33\1\uffff\1\70\13\uffff\1\33\1\72\5\33\1\uffff\1\33\1\uffff\1\33\1\102\1\33\1\104\3\33\1\uffff\1\33\1\uffff\1\33\1\112\3\33\1\uffff\1\116\1\117\1\120\3\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\107\uffff";
|
||||
"\121\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\164\1\156\2\157\1\171\2\uffff\1\170\1\uffff\1\160\5\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\162\1\uffff\1\164\1\157\1\151\1\160\2\uffff\1\164\1\uffff\1\60\12\uffff\1\151\1\60\1\154\1\144\2\145\1\uffff\1\156\1\uffff\1\145\2\60\1\156\1\147\1\141\2\uffff\1\144\1\60\1\156\1\163\1\uffff\2\60\2\uffff";
|
||||
"\1\0\1\164\1\156\2\157\1\141\2\uffff\1\171\1\170\1\uffff\1\160\6\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\162\1\uffff\1\164\1\157\1\151\1\143\2\uffff\1\160\1\164\1\uffff\1\60\13\uffff\1\151\1\60\1\154\1\144\1\153\2\145\1\uffff\1\156\1\uffff\1\145\1\60\1\141\1\60\1\156\1\147\1\141\1\uffff\1\147\1\uffff\1\144\1\60\1\156\1\145\1\163\1\uffff\3\60\3\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\164\1\156\2\157\1\171\2\uffff\1\170\1\uffff\1\160\5\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\162\1\uffff\1\164\1\157\1\151\1\160\2\uffff\1\164\1\uffff\1\172\12\uffff\1\151\1\172\1\154\1\144\2\145\1\uffff\1\156\1\uffff\1\145\2\172\1\156\1\147\1\141\2\uffff\1\144\1\172\1\156\1\163\1\uffff\2\172\2\uffff";
|
||||
"\1\uffff\1\164\1\156\2\157\1\141\2\uffff\1\171\1\170\1\uffff\1\160\6\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\162\1\uffff\1\164\1\157\1\151\1\143\2\uffff\1\160\1\164\1\uffff\1\172\13\uffff\1\151\1\172\1\154\1\144\1\153\2\145\1\uffff\1\156\1\uffff\1\145\1\172\1\141\1\172\1\156\1\147\1\141\1\uffff\1\147\1\uffff\1\144\1\172\1\156\1\145\1\163\1\uffff\3\172\3\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\6\uffff\1\6\1\7\1\uffff\1\11\1\uffff\1\13\1\14\1\15\1\16\1\17\1\uffff\1\20\1\21\3\uffff\1\25\1\26\1\uffff\1\20\4\uffff\1\6\1\7\1\uffff\1\11\1\uffff\1\13\1\14\1\15\1\16\1\17\1\21\1\22\1\23\1\24\1\25\6\uffff\1\12\1\uffff\1\2\6\uffff\1\4\1\5\4\uffff\1\1\2\uffff\1\3\1\10";
|
||||
"\6\uffff\1\6\1\7\2\uffff\1\12\1\uffff\1\14\1\15\1\16\1\17\1\20\1\21\1\uffff\1\22\1\23\3\uffff\1\27\1\30\1\uffff\1\22\4\uffff\1\6\1\7\2\uffff\1\12\1\uffff\1\14\1\15\1\16\1\17\1\20\1\21\1\23\1\24\1\25\1\26\1\27\7\uffff\1\13\1\uffff\1\2\7\uffff\1\4\1\uffff\1\10\5\uffff\1\1\3\uffff\1\3\1\5\1\11";
|
||||
static final String DFA12_specialS =
|
||||
"\1\2\22\uffff\1\1\1\0\62\uffff}>";
|
||||
"\1\0\24\uffff\1\1\1\2\72\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\11\27\2\26\2\27\1\26\22\27\1\26\1\27\1\23\4\27\1\24\1\13\1\14\2\27\1\15\2\27\1\25\12\22\1\16\6\27\32\21\1\17\1\27\1\11\1\20\1\21\1\27\1\21\1\3\2\21\1\10\3\21\1\2\5\21\1\12\3\21\1\1\1\5\1\21\1\4\4\21\1\6\1\27\1\7\uff82\27",
|
||||
"\1\30",
|
||||
"\11\31\2\30\2\31\1\30\22\31\1\30\1\31\1\25\4\31\1\26\1\14\1\15\2\31\1\16\1\31\1\20\1\27\12\24\1\17\6\31\32\23\1\21\1\31\1\12\1\22\1\23\1\31\1\23\1\3\2\23\1\11\3\23\1\2\5\23\1\13\1\5\2\23\1\1\1\10\1\23\1\4\4\23\1\6\1\31\1\7\uff82\31",
|
||||
"\1\32",
|
||||
"\1\33",
|
||||
"\1\34",
|
||||
"\1\35",
|
||||
"\1\36",
|
||||
"\1\37",
|
||||
"",
|
||||
"",
|
||||
"\1\40",
|
||||
"",
|
||||
"\1\42",
|
||||
"\1\43",
|
||||
"",
|
||||
"\1\45",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
"\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"",
|
||||
"\0\51",
|
||||
"\0\51",
|
||||
"\1\52\4\uffff\1\53",
|
||||
"\0\55",
|
||||
"\0\55",
|
||||
"\1\56\4\uffff\1\57",
|
||||
"",
|
||||
"",
|
||||
"\1\55",
|
||||
"",
|
||||
"\1\56",
|
||||
"\1\57",
|
||||
"\1\60",
|
||||
"\1\61",
|
||||
"",
|
||||
"",
|
||||
"\1\62",
|
||||
"",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\63",
|
||||
"\1\64",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\65",
|
||||
"",
|
||||
"",
|
||||
"\1\66",
|
||||
"\1\67",
|
||||
"\1\70",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\71",
|
||||
"",
|
||||
"\1\72",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\73",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\74",
|
||||
"\1\75",
|
||||
"\1\76",
|
||||
"\1\77",
|
||||
"",
|
||||
"\1\100",
|
||||
"",
|
||||
"",
|
||||
"\1\101",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\103",
|
||||
"\1\104",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\105",
|
||||
"\1\106",
|
||||
"\1\107",
|
||||
"",
|
||||
"\1\110",
|
||||
"",
|
||||
"\1\111",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\113",
|
||||
"\1\114",
|
||||
"\1\115",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
@ -1136,33 +1203,13 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
this.transition = DFA12_transition;
|
||||
}
|
||||
public String getDescription() {
|
||||
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
|
||||
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | 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_20 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_20>='\u0000' && LA12_20<='\uFFFF')) ) {s = 41;}
|
||||
|
||||
else s = 23;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_19 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_19>='\u0000' && LA12_19<='\uFFFF')) ) {s = 41;}
|
||||
|
||||
else s = 23;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
|
@ -1174,43 +1221,67 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
else if ( (LA12_0=='v') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='t') ) {s = 5;}
|
||||
else if ( (LA12_0=='p') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 7;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 8;}
|
||||
else if ( (LA12_0=='t') ) {s = 8;}
|
||||
|
||||
else if ( (LA12_0==']') ) {s = 9;}
|
||||
else if ( (LA12_0=='e') ) {s = 9;}
|
||||
|
||||
else if ( (LA12_0=='o') ) {s = 10;}
|
||||
else if ( (LA12_0==']') ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0=='(') ) {s = 11;}
|
||||
else if ( (LA12_0=='o') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0==')') ) {s = 12;}
|
||||
else if ( (LA12_0=='(') ) {s = 12;}
|
||||
|
||||
else if ( (LA12_0==',') ) {s = 13;}
|
||||
else if ( (LA12_0==')') ) {s = 13;}
|
||||
|
||||
else if ( (LA12_0==':') ) {s = 14;}
|
||||
else if ( (LA12_0==',') ) {s = 14;}
|
||||
|
||||
else if ( (LA12_0=='[') ) {s = 15;}
|
||||
else if ( (LA12_0==':') ) {s = 15;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 16;}
|
||||
else if ( (LA12_0=='.') ) {s = 16;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='n')||(LA12_0>='p' && LA12_0<='r')||LA12_0=='u'||(LA12_0>='w' && LA12_0<='z')) ) {s = 17;}
|
||||
else if ( (LA12_0=='[') ) {s = 17;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 18;}
|
||||
else if ( (LA12_0=='^') ) {s = 18;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 19;}
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='n')||(LA12_0>='q' && LA12_0<='r')||LA12_0=='u'||(LA12_0>='w' && LA12_0<='z')) ) {s = 19;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 20;}
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 20;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 21;}
|
||||
else if ( (LA12_0=='\"') ) {s = 21;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 22;}
|
||||
else if ( (LA12_0=='\'') ) {s = 22;}
|
||||
|
||||
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>='~' && LA12_0<='\uFFFF')) ) {s = 23;}
|
||||
else if ( (LA12_0=='/') ) {s = 23;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 24;}
|
||||
|
||||
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 = 25;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_21 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_21>='\u0000' && LA12_21<='\uFFFF')) ) {s = 45;}
|
||||
|
||||
else s = 25;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_22 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_22>='\u0000' && LA12_22<='\uFFFF')) ) {s = 45;}
|
||||
|
||||
else s = 25;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -82,24 +82,129 @@ ruleModel returns [EObject current=null]
|
|||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getModelAccess().getTypesTypeDeclarationParserRuleCall_0());
|
||||
newCompositeNode(grammarAccess.getModelAccess().getElementsAbstractElementParserRuleCall_0());
|
||||
}
|
||||
lv_types_0_0=ruleTypeDeclaration
|
||||
lv_elements_0_0=ruleAbstractElement
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getModelRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"types",
|
||||
lv_types_0_0,
|
||||
"org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.TypeDeclaration");
|
||||
"elements",
|
||||
lv_elements_0_0,
|
||||
"org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.AbstractElement");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
;
|
||||
|
||||
// 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.ide.tests.testlanguage.TestLanguage.QualifiedName");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
otherlv_2='{'
|
||||
{
|
||||
newLeafNode(otherlv_2, grammarAccess.getPackageDeclarationAccess().getLeftCurlyBracketKeyword_2());
|
||||
}
|
||||
(
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getPackageDeclarationAccess().getElementsAbstractElementParserRuleCall_3_0());
|
||||
}
|
||||
lv_elements_3_0=ruleAbstractElement
|
||||
{
|
||||
if ($current==null) {
|
||||
$current = createModelElementForParent(grammarAccess.getPackageDeclarationRule());
|
||||
}
|
||||
add(
|
||||
$current,
|
||||
"elements",
|
||||
lv_elements_3_0,
|
||||
"org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.AbstractElement");
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)*
|
||||
otherlv_4='}'
|
||||
{
|
||||
newLeafNode(otherlv_4, grammarAccess.getPackageDeclarationAccess().getRightCurlyBracketKeyword_4());
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleAbstractElement
|
||||
entryRuleAbstractElement returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getAbstractElementRule()); }
|
||||
iv_ruleAbstractElement=ruleAbstractElement
|
||||
{ $current=$iv_ruleAbstractElement.current; }
|
||||
EOF;
|
||||
|
||||
// Rule AbstractElement
|
||||
ruleAbstractElement returns [EObject current=null]
|
||||
@init {
|
||||
enterRule();
|
||||
}
|
||||
@after {
|
||||
leaveRule();
|
||||
}:
|
||||
(
|
||||
{
|
||||
newCompositeNode(grammarAccess.getAbstractElementAccess().getPackageDeclarationParserRuleCall_0());
|
||||
}
|
||||
this_PackageDeclaration_0=rulePackageDeclaration
|
||||
{
|
||||
$current = $this_PackageDeclaration_0.current;
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
|
|
||||
{
|
||||
newCompositeNode(grammarAccess.getAbstractElementAccess().getTypeDeclarationParserRuleCall_1());
|
||||
}
|
||||
this_TypeDeclaration_1=ruleTypeDeclaration
|
||||
{
|
||||
$current = $this_TypeDeclaration_1.current;
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
// Entry rule entryRuleTypeDeclaration
|
||||
entryRuleTypeDeclaration returns [EObject current=null]:
|
||||
{ newCompositeNode(grammarAccess.getTypeDeclarationRule()); }
|
||||
|
@ -150,9 +255,12 @@ ruleTypeDeclaration returns [EObject current=null]
|
|||
$current = createModelElement(grammarAccess.getTypeDeclarationRule());
|
||||
}
|
||||
}
|
||||
otherlv_3=RULE_ID
|
||||
{
|
||||
newLeafNode(otherlv_3, grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
|
||||
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
|
||||
}
|
||||
ruleQualifiedName
|
||||
{
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -664,9 +772,12 @@ ruleTypeReference returns [EObject current=null]
|
|||
$current = createModelElement(grammarAccess.getTypeReferenceRule());
|
||||
}
|
||||
}
|
||||
otherlv_0=RULE_ID
|
||||
{
|
||||
newLeafNode(otherlv_0, grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationCrossReference_0());
|
||||
newCompositeNode(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationCrossReference_0());
|
||||
}
|
||||
ruleQualifiedName
|
||||
{
|
||||
afterParserOrEnumRuleCall();
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -738,6 +849,46 @@ rulePrimitiveType returns [EObject current=null]
|
|||
)
|
||||
;
|
||||
|
||||
// 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')+;
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
'('=18
|
||||
')'=20
|
||||
','=19
|
||||
':'=21
|
||||
'['=15
|
||||
']'=16
|
||||
'boolean'=24
|
||||
'extends'=12
|
||||
'int'=23
|
||||
'op'=17
|
||||
'string'=22
|
||||
'type'=11
|
||||
'void'=25
|
||||
'{'=13
|
||||
'}'=14
|
||||
'('=19
|
||||
')'=21
|
||||
','=20
|
||||
'.'=27
|
||||
':'=22
|
||||
'['=16
|
||||
']'=17
|
||||
'boolean'=25
|
||||
'extends'=15
|
||||
'int'=24
|
||||
'op'=18
|
||||
'package'=11
|
||||
'string'=23
|
||||
'type'=14
|
||||
'void'=26
|
||||
'{'=12
|
||||
'}'=13
|
||||
RULE_ANY_OTHER=10
|
||||
RULE_ID=4
|
||||
RULE_INT=5
|
||||
|
@ -35,3 +37,5 @@ T__22=22
|
|||
T__23=23
|
||||
T__24=24
|
||||
T__25=25
|
||||
T__26=26
|
||||
T__27=27
|
||||
|
|
|
@ -27,6 +27,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
public static final int RULE_ID=4;
|
||||
public static final int RULE_WS=9;
|
||||
public static final int RULE_ANY_OTHER=10;
|
||||
public static final int T__26=26;
|
||||
public static final int T__27=27;
|
||||
public static final int RULE_INT=5;
|
||||
public static final int T__22=22;
|
||||
public static final int RULE_ML_COMMENT=7;
|
||||
|
@ -54,10 +56,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__11;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:11:7: ( 'type' )
|
||||
// InternalTestLanguage.g:11:9: 'type'
|
||||
// InternalTestLanguage.g:11:7: ( 'package' )
|
||||
// InternalTestLanguage.g:11:9: 'package'
|
||||
{
|
||||
match("type");
|
||||
match("package");
|
||||
|
||||
|
||||
}
|
||||
|
@ -75,11 +77,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__12;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:12:7: ( 'extends' )
|
||||
// InternalTestLanguage.g:12:9: 'extends'
|
||||
// InternalTestLanguage.g:12:7: ( '{' )
|
||||
// InternalTestLanguage.g:12:9: '{'
|
||||
{
|
||||
match("extends");
|
||||
|
||||
match('{');
|
||||
|
||||
}
|
||||
|
||||
|
@ -96,10 +97,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__13;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:13:7: ( '{' )
|
||||
// InternalTestLanguage.g:13:9: '{'
|
||||
// InternalTestLanguage.g:13:7: ( '}' )
|
||||
// InternalTestLanguage.g:13:9: '}'
|
||||
{
|
||||
match('{');
|
||||
match('}');
|
||||
|
||||
}
|
||||
|
||||
|
@ -116,10 +117,11 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__14;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:14:7: ( '}' )
|
||||
// InternalTestLanguage.g:14:9: '}'
|
||||
// InternalTestLanguage.g:14:7: ( 'type' )
|
||||
// InternalTestLanguage.g:14:9: 'type'
|
||||
{
|
||||
match('}');
|
||||
match("type");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -136,10 +138,11 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__15;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:15:7: ( '[' )
|
||||
// InternalTestLanguage.g:15:9: '['
|
||||
// InternalTestLanguage.g:15:7: ( 'extends' )
|
||||
// InternalTestLanguage.g:15:9: 'extends'
|
||||
{
|
||||
match('[');
|
||||
match("extends");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -156,10 +159,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__16;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:16:7: ( ']' )
|
||||
// InternalTestLanguage.g:16:9: ']'
|
||||
// InternalTestLanguage.g:16:7: ( '[' )
|
||||
// InternalTestLanguage.g:16:9: '['
|
||||
{
|
||||
match(']');
|
||||
match('[');
|
||||
|
||||
}
|
||||
|
||||
|
@ -176,11 +179,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__17;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:17:7: ( 'op' )
|
||||
// InternalTestLanguage.g:17:9: 'op'
|
||||
// InternalTestLanguage.g:17:7: ( ']' )
|
||||
// InternalTestLanguage.g:17:9: ']'
|
||||
{
|
||||
match("op");
|
||||
|
||||
match(']');
|
||||
|
||||
}
|
||||
|
||||
|
@ -197,10 +199,11 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__18;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:18:7: ( '(' )
|
||||
// InternalTestLanguage.g:18:9: '('
|
||||
// InternalTestLanguage.g:18:7: ( 'op' )
|
||||
// InternalTestLanguage.g:18:9: 'op'
|
||||
{
|
||||
match('(');
|
||||
match("op");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -217,10 +220,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__19;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:19:7: ( ',' )
|
||||
// InternalTestLanguage.g:19:9: ','
|
||||
// InternalTestLanguage.g:19:7: ( '(' )
|
||||
// InternalTestLanguage.g:19:9: '('
|
||||
{
|
||||
match(',');
|
||||
match('(');
|
||||
|
||||
}
|
||||
|
||||
|
@ -237,10 +240,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__20;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:20:7: ( ')' )
|
||||
// InternalTestLanguage.g:20:9: ')'
|
||||
// InternalTestLanguage.g:20:7: ( ',' )
|
||||
// InternalTestLanguage.g:20:9: ','
|
||||
{
|
||||
match(')');
|
||||
match(',');
|
||||
|
||||
}
|
||||
|
||||
|
@ -257,10 +260,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__21;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:21:7: ( ':' )
|
||||
// InternalTestLanguage.g:21:9: ':'
|
||||
// InternalTestLanguage.g:21:7: ( ')' )
|
||||
// InternalTestLanguage.g:21:9: ')'
|
||||
{
|
||||
match(':');
|
||||
match(')');
|
||||
|
||||
}
|
||||
|
||||
|
@ -277,11 +280,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__22;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:22:7: ( 'string' )
|
||||
// InternalTestLanguage.g:22:9: 'string'
|
||||
// InternalTestLanguage.g:22:7: ( ':' )
|
||||
// InternalTestLanguage.g:22:9: ':'
|
||||
{
|
||||
match("string");
|
||||
|
||||
match(':');
|
||||
|
||||
}
|
||||
|
||||
|
@ -298,10 +300,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__23;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:23:7: ( 'int' )
|
||||
// InternalTestLanguage.g:23:9: 'int'
|
||||
// InternalTestLanguage.g:23:7: ( 'string' )
|
||||
// InternalTestLanguage.g:23:9: 'string'
|
||||
{
|
||||
match("int");
|
||||
match("string");
|
||||
|
||||
|
||||
}
|
||||
|
@ -319,10 +321,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__24;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:24:7: ( 'boolean' )
|
||||
// InternalTestLanguage.g:24:9: 'boolean'
|
||||
// InternalTestLanguage.g:24:7: ( 'int' )
|
||||
// InternalTestLanguage.g:24:9: 'int'
|
||||
{
|
||||
match("boolean");
|
||||
match("int");
|
||||
|
||||
|
||||
}
|
||||
|
@ -340,10 +342,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = T__25;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:25:7: ( 'void' )
|
||||
// InternalTestLanguage.g:25:9: 'void'
|
||||
// InternalTestLanguage.g:25:7: ( 'boolean' )
|
||||
// InternalTestLanguage.g:25:9: 'boolean'
|
||||
{
|
||||
match("void");
|
||||
match("boolean");
|
||||
|
||||
|
||||
}
|
||||
|
@ -356,15 +358,56 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
// $ANTLR end "T__25"
|
||||
|
||||
// $ANTLR start "T__26"
|
||||
public final void mT__26() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__26;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:26:7: ( 'void' )
|
||||
// InternalTestLanguage.g:26:9: 'void'
|
||||
{
|
||||
match("void");
|
||||
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__26"
|
||||
|
||||
// $ANTLR start "T__27"
|
||||
public final void mT__27() throws RecognitionException {
|
||||
try {
|
||||
int _type = T__27;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:27:7: ( '.' )
|
||||
// InternalTestLanguage.g:27:9: '.'
|
||||
{
|
||||
match('.');
|
||||
|
||||
}
|
||||
|
||||
state.type = _type;
|
||||
state.channel = _channel;
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
// $ANTLR end "T__27"
|
||||
|
||||
// $ANTLR start "RULE_ID"
|
||||
public final void mRULE_ID() throws RecognitionException {
|
||||
try {
|
||||
int _type = RULE_ID;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:741:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalTestLanguage.g:741:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalTestLanguage.g:892:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
|
||||
// InternalTestLanguage.g:892:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
{
|
||||
// InternalTestLanguage.g:741:11: ( '^' )?
|
||||
// InternalTestLanguage.g:892:11: ( '^' )?
|
||||
int alt1=2;
|
||||
int LA1_0 = input.LA(1);
|
||||
|
||||
|
@ -373,7 +416,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt1) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:741:11: '^'
|
||||
// InternalTestLanguage.g:892:11: '^'
|
||||
{
|
||||
match('^');
|
||||
|
||||
|
@ -391,7 +434,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
recover(mse);
|
||||
throw mse;}
|
||||
|
||||
// InternalTestLanguage.g:741:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
// InternalTestLanguage.g:892:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
|
||||
loop2:
|
||||
do {
|
||||
int alt2=2;
|
||||
|
@ -440,10 +483,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_INT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:743:10: ( ( '0' .. '9' )+ )
|
||||
// InternalTestLanguage.g:743:12: ( '0' .. '9' )+
|
||||
// InternalTestLanguage.g:894:10: ( ( '0' .. '9' )+ )
|
||||
// InternalTestLanguage.g:894:12: ( '0' .. '9' )+
|
||||
{
|
||||
// InternalTestLanguage.g:743:12: ( '0' .. '9' )+
|
||||
// InternalTestLanguage.g:894:12: ( '0' .. '9' )+
|
||||
int cnt3=0;
|
||||
loop3:
|
||||
do {
|
||||
|
@ -457,7 +500,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt3) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:743:13: '0' .. '9'
|
||||
// InternalTestLanguage.g:894:13: '0' .. '9'
|
||||
{
|
||||
matchRange('0','9');
|
||||
|
||||
|
@ -489,10 +532,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_STRING;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:745:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalTestLanguage.g:745:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalTestLanguage.g:896:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
|
||||
// InternalTestLanguage.g:896:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
{
|
||||
// InternalTestLanguage.g:745:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
// InternalTestLanguage.g:896:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
|
||||
int alt6=2;
|
||||
int LA6_0 = input.LA(1);
|
||||
|
||||
|
@ -510,10 +553,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt6) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:745:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
// InternalTestLanguage.g:896:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
|
||||
{
|
||||
match('\"');
|
||||
// InternalTestLanguage.g:745:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
// InternalTestLanguage.g:896:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
|
||||
loop4:
|
||||
do {
|
||||
int alt4=3;
|
||||
|
@ -529,7 +572,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt4) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:745:21: '\\\\' .
|
||||
// InternalTestLanguage.g:896:21: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -537,7 +580,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:745:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
// InternalTestLanguage.g:896:28: ~ ( ( '\\\\' | '\"' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -562,10 +605,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:745:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
// InternalTestLanguage.g:896:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
|
||||
{
|
||||
match('\'');
|
||||
// InternalTestLanguage.g:745:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
// InternalTestLanguage.g:896:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
|
||||
loop5:
|
||||
do {
|
||||
int alt5=3;
|
||||
|
@ -581,7 +624,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt5) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:745:54: '\\\\' .
|
||||
// InternalTestLanguage.g:896:54: '\\\\' .
|
||||
{
|
||||
match('\\');
|
||||
matchAny();
|
||||
|
@ -589,7 +632,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 2 :
|
||||
// InternalTestLanguage.g:745:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
// InternalTestLanguage.g:896:61: ~ ( ( '\\\\' | '\\'' ) )
|
||||
{
|
||||
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
|
||||
input.consume();
|
||||
|
@ -632,12 +675,12 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ML_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:747:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalTestLanguage.g:747:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
// InternalTestLanguage.g:898:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
|
||||
// InternalTestLanguage.g:898:19: '/*' ( options {greedy=false; } : . )* '*/'
|
||||
{
|
||||
match("/*");
|
||||
|
||||
// InternalTestLanguage.g:747:24: ( options {greedy=false; } : . )*
|
||||
// InternalTestLanguage.g:898:24: ( options {greedy=false; } : . )*
|
||||
loop7:
|
||||
do {
|
||||
int alt7=2;
|
||||
|
@ -662,7 +705,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt7) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:747:52: .
|
||||
// InternalTestLanguage.g:898:52: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
@ -692,12 +735,12 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_SL_COMMENT;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:749:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalTestLanguage.g:749:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
// InternalTestLanguage.g:900:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
|
||||
// InternalTestLanguage.g:900:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
|
||||
{
|
||||
match("//");
|
||||
|
||||
// InternalTestLanguage.g:749:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
// InternalTestLanguage.g:900:24: (~ ( ( '\\n' | '\\r' ) ) )*
|
||||
loop8:
|
||||
do {
|
||||
int alt8=2;
|
||||
|
@ -710,7 +753,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
switch (alt8) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:749:24: ~ ( ( '\\n' | '\\r' ) )
|
||||
// InternalTestLanguage.g:900: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();
|
||||
|
@ -730,7 +773,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
} while (true);
|
||||
|
||||
// InternalTestLanguage.g:749:40: ( ( '\\r' )? '\\n' )?
|
||||
// InternalTestLanguage.g:900:40: ( ( '\\r' )? '\\n' )?
|
||||
int alt10=2;
|
||||
int LA10_0 = input.LA(1);
|
||||
|
||||
|
@ -739,9 +782,9 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt10) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:749:41: ( '\\r' )? '\\n'
|
||||
// InternalTestLanguage.g:900:41: ( '\\r' )? '\\n'
|
||||
{
|
||||
// InternalTestLanguage.g:749:41: ( '\\r' )?
|
||||
// InternalTestLanguage.g:900:41: ( '\\r' )?
|
||||
int alt9=2;
|
||||
int LA9_0 = input.LA(1);
|
||||
|
||||
|
@ -750,7 +793,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
switch (alt9) {
|
||||
case 1 :
|
||||
// InternalTestLanguage.g:749:41: '\\r'
|
||||
// InternalTestLanguage.g:900:41: '\\r'
|
||||
{
|
||||
match('\r');
|
||||
|
||||
|
@ -782,10 +825,10 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_WS;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:751:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalTestLanguage.g:751:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalTestLanguage.g:902:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
|
||||
// InternalTestLanguage.g:902:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
{
|
||||
// InternalTestLanguage.g:751:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
// InternalTestLanguage.g:902:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
|
||||
int cnt11=0;
|
||||
loop11:
|
||||
do {
|
||||
|
@ -839,8 +882,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
try {
|
||||
int _type = RULE_ANY_OTHER;
|
||||
int _channel = DEFAULT_TOKEN_CHANNEL;
|
||||
// InternalTestLanguage.g:753:16: ( . )
|
||||
// InternalTestLanguage.g:753:18: .
|
||||
// InternalTestLanguage.g:904:16: ( . )
|
||||
// InternalTestLanguage.g:904:18: .
|
||||
{
|
||||
matchAny();
|
||||
|
||||
|
@ -855,8 +898,8 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
// $ANTLR end "RULE_ANY_OTHER"
|
||||
|
||||
public void mTokens() throws RecognitionException {
|
||||
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=22;
|
||||
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
|
||||
int alt12=24;
|
||||
alt12 = dfa12.predict(input);
|
||||
switch (alt12) {
|
||||
case 1 :
|
||||
|
@ -965,49 +1008,63 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
}
|
||||
break;
|
||||
case 16 :
|
||||
// InternalTestLanguage.g:1:100: RULE_ID
|
||||
// InternalTestLanguage.g:1:100: T__26
|
||||
{
|
||||
mT__26();
|
||||
|
||||
}
|
||||
break;
|
||||
case 17 :
|
||||
// InternalTestLanguage.g:1:106: T__27
|
||||
{
|
||||
mT__27();
|
||||
|
||||
}
|
||||
break;
|
||||
case 18 :
|
||||
// InternalTestLanguage.g:1:112: RULE_ID
|
||||
{
|
||||
mRULE_ID();
|
||||
|
||||
}
|
||||
break;
|
||||
case 17 :
|
||||
// InternalTestLanguage.g:1:108: RULE_INT
|
||||
case 19 :
|
||||
// InternalTestLanguage.g:1:120: RULE_INT
|
||||
{
|
||||
mRULE_INT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 18 :
|
||||
// InternalTestLanguage.g:1:117: RULE_STRING
|
||||
case 20 :
|
||||
// InternalTestLanguage.g:1:129: RULE_STRING
|
||||
{
|
||||
mRULE_STRING();
|
||||
|
||||
}
|
||||
break;
|
||||
case 19 :
|
||||
// InternalTestLanguage.g:1:129: RULE_ML_COMMENT
|
||||
case 21 :
|
||||
// InternalTestLanguage.g:1:141: RULE_ML_COMMENT
|
||||
{
|
||||
mRULE_ML_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 20 :
|
||||
// InternalTestLanguage.g:1:145: RULE_SL_COMMENT
|
||||
case 22 :
|
||||
// InternalTestLanguage.g:1:157: RULE_SL_COMMENT
|
||||
{
|
||||
mRULE_SL_COMMENT();
|
||||
|
||||
}
|
||||
break;
|
||||
case 21 :
|
||||
// InternalTestLanguage.g:1:161: RULE_WS
|
||||
case 23 :
|
||||
// InternalTestLanguage.g:1:173: RULE_WS
|
||||
{
|
||||
mRULE_WS();
|
||||
|
||||
}
|
||||
break;
|
||||
case 22 :
|
||||
// InternalTestLanguage.g:1:169: RULE_ANY_OTHER
|
||||
case 24 :
|
||||
// InternalTestLanguage.g:1:181: RULE_ANY_OTHER
|
||||
{
|
||||
mRULE_ANY_OTHER();
|
||||
|
||||
|
@ -1021,87 +1078,97 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
|
||||
protected DFA12 dfa12 = new DFA12(this);
|
||||
static final String DFA12_eotS =
|
||||
"\1\uffff\2\31\4\uffff\1\31\4\uffff\4\31\1\27\2\uffff\3\27\2\uffff\1\31\1\uffff\1\31\4\uffff\1\57\4\uffff\4\31\5\uffff\2\31\1\uffff\1\31\1\67\2\31\1\72\2\31\1\uffff\1\31\1\76\1\uffff\3\31\1\uffff\1\31\1\103\1\31\1\105\1\uffff\1\106\2\uffff";
|
||||
"\1\uffff\1\33\2\uffff\2\33\2\uffff\1\33\4\uffff\4\33\1\uffff\1\31\2\uffff\3\31\2\uffff\1\33\3\uffff\2\33\2\uffff\1\64\4\uffff\4\33\6\uffff\3\33\1\uffff\1\33\1\75\3\33\1\101\2\33\1\uffff\1\33\1\105\1\33\1\uffff\3\33\1\uffff\2\33\1\114\1\33\1\116\1\117\1\uffff\1\120\3\uffff";
|
||||
static final String DFA12_eofS =
|
||||
"\107\uffff";
|
||||
"\121\uffff";
|
||||
static final String DFA12_minS =
|
||||
"\1\0\1\171\1\170\4\uffff\1\160\4\uffff\1\164\1\156\2\157\1\101\2\uffff\2\0\1\52\2\uffff\1\160\1\uffff\1\164\4\uffff\1\60\4\uffff\1\162\1\164\1\157\1\151\5\uffff\2\145\1\uffff\1\151\1\60\1\154\1\144\1\60\2\156\1\uffff\1\145\1\60\1\uffff\1\144\1\147\1\141\1\uffff\1\163\1\60\1\156\1\60\1\uffff\1\60\2\uffff";
|
||||
"\1\0\1\141\2\uffff\1\171\1\170\2\uffff\1\160\4\uffff\1\164\1\156\2\157\1\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\143\3\uffff\1\160\1\164\2\uffff\1\60\4\uffff\1\162\1\164\1\157\1\151\6\uffff\1\153\2\145\1\uffff\1\151\1\60\1\154\1\144\1\141\1\60\2\156\1\uffff\1\145\1\60\1\147\1\uffff\1\144\1\147\1\141\1\uffff\1\145\1\163\1\60\1\156\2\60\1\uffff\1\60\3\uffff";
|
||||
static final String DFA12_maxS =
|
||||
"\1\uffff\1\171\1\170\4\uffff\1\160\4\uffff\1\164\1\156\2\157\1\172\2\uffff\2\uffff\1\57\2\uffff\1\160\1\uffff\1\164\4\uffff\1\172\4\uffff\1\162\1\164\1\157\1\151\5\uffff\2\145\1\uffff\1\151\1\172\1\154\1\144\1\172\2\156\1\uffff\1\145\1\172\1\uffff\1\144\1\147\1\141\1\uffff\1\163\1\172\1\156\1\172\1\uffff\1\172\2\uffff";
|
||||
"\1\uffff\1\141\2\uffff\1\171\1\170\2\uffff\1\160\4\uffff\1\164\1\156\2\157\1\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\143\3\uffff\1\160\1\164\2\uffff\1\172\4\uffff\1\162\1\164\1\157\1\151\6\uffff\1\153\2\145\1\uffff\1\151\1\172\1\154\1\144\1\141\1\172\2\156\1\uffff\1\145\1\172\1\147\1\uffff\1\144\1\147\1\141\1\uffff\1\145\1\163\1\172\1\156\2\172\1\uffff\1\172\3\uffff";
|
||||
static final String DFA12_acceptS =
|
||||
"\3\uffff\1\3\1\4\1\5\1\6\1\uffff\1\10\1\11\1\12\1\13\5\uffff\1\20\1\21\3\uffff\1\25\1\26\1\uffff\1\20\1\uffff\1\3\1\4\1\5\1\6\1\uffff\1\10\1\11\1\12\1\13\4\uffff\1\21\1\22\1\23\1\24\1\25\2\uffff\1\7\7\uffff\1\15\2\uffff\1\1\3\uffff\1\17\4\uffff\1\14\1\uffff\1\2\1\16";
|
||||
"\2\uffff\1\2\1\3\2\uffff\1\6\1\7\1\uffff\1\11\1\12\1\13\1\14\4\uffff\1\21\1\uffff\1\22\1\23\3\uffff\1\27\1\30\1\uffff\1\22\1\2\1\3\2\uffff\1\6\1\7\1\uffff\1\11\1\12\1\13\1\14\4\uffff\1\21\1\23\1\24\1\25\1\26\1\27\3\uffff\1\10\10\uffff\1\16\3\uffff\1\4\3\uffff\1\20\6\uffff\1\15\1\uffff\1\1\1\5\1\17";
|
||||
static final String DFA12_specialS =
|
||||
"\1\0\22\uffff\1\2\1\1\62\uffff}>";
|
||||
"\1\0\24\uffff\1\1\1\2\72\uffff}>";
|
||||
static final String[] DFA12_transitionS = {
|
||||
"\11\27\2\26\2\27\1\26\22\27\1\26\1\27\1\23\4\27\1\24\1\10\1\12\2\27\1\11\2\27\1\25\12\22\1\13\6\27\32\21\1\5\1\27\1\6\1\20\1\21\1\27\1\21\1\16\2\21\1\2\3\21\1\15\5\21\1\7\3\21\1\14\1\1\1\21\1\17\4\21\1\3\1\27\1\4\uff82\27",
|
||||
"\1\30",
|
||||
"\11\31\2\30\2\31\1\30\22\31\1\30\1\31\1\25\4\31\1\26\1\11\1\13\2\31\1\12\1\31\1\21\1\27\12\24\1\14\6\31\32\23\1\6\1\31\1\7\1\22\1\23\1\31\1\23\1\17\2\23\1\5\3\23\1\16\5\23\1\10\1\1\2\23\1\15\1\4\1\23\1\20\4\23\1\2\1\31\1\3\uff82\31",
|
||||
"\1\32",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\36",
|
||||
"\1\37",
|
||||
"",
|
||||
"",
|
||||
"\1\42",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\44",
|
||||
"\1\45",
|
||||
"\1\46",
|
||||
"\1\47",
|
||||
"\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\50",
|
||||
"\1\51",
|
||||
"\1\52",
|
||||
"",
|
||||
"\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"",
|
||||
"\0\51",
|
||||
"\0\51",
|
||||
"\1\52\4\uffff\1\53",
|
||||
"\0\55",
|
||||
"\0\55",
|
||||
"\1\56\4\uffff\1\57",
|
||||
"",
|
||||
"",
|
||||
"\1\55",
|
||||
"",
|
||||
"\1\56",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\60",
|
||||
"\1\61",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\62",
|
||||
"\1\63",
|
||||
"",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\64",
|
||||
"\1\65",
|
||||
"",
|
||||
"\1\66",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\67",
|
||||
"\1\70",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"\1\71",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\72",
|
||||
"\1\73",
|
||||
"",
|
||||
"\1\74",
|
||||
"",
|
||||
"\1\75",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\76",
|
||||
"\1\77",
|
||||
"\1\100",
|
||||
"\1\101",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\102",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\104",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"\1\103",
|
||||
"",
|
||||
"\1\104",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\106",
|
||||
"",
|
||||
"\1\107",
|
||||
"\1\110",
|
||||
"\1\111",
|
||||
"",
|
||||
"\1\112",
|
||||
"\1\113",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\1\115",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"\12\33\7\uffff\32\33\4\uffff\1\33\1\uffff\32\33",
|
||||
"",
|
||||
"\12\31\7\uffff\32\31\4\uffff\1\31\1\uffff\32\31",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
@ -1136,7 +1203,7 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
this.transition = DFA12_transition;
|
||||
}
|
||||
public String getDescription() {
|
||||
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
|
||||
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | 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;
|
||||
|
@ -1146,71 +1213,75 @@ public class InternalTestLanguageLexer extends Lexer {
|
|||
int LA12_0 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( (LA12_0=='t') ) {s = 1;}
|
||||
if ( (LA12_0=='p') ) {s = 1;}
|
||||
|
||||
else if ( (LA12_0=='e') ) {s = 2;}
|
||||
else if ( (LA12_0=='{') ) {s = 2;}
|
||||
|
||||
else if ( (LA12_0=='{') ) {s = 3;}
|
||||
else if ( (LA12_0=='}') ) {s = 3;}
|
||||
|
||||
else if ( (LA12_0=='}') ) {s = 4;}
|
||||
else if ( (LA12_0=='t') ) {s = 4;}
|
||||
|
||||
else if ( (LA12_0=='[') ) {s = 5;}
|
||||
else if ( (LA12_0=='e') ) {s = 5;}
|
||||
|
||||
else if ( (LA12_0==']') ) {s = 6;}
|
||||
else if ( (LA12_0=='[') ) {s = 6;}
|
||||
|
||||
else if ( (LA12_0=='o') ) {s = 7;}
|
||||
else if ( (LA12_0==']') ) {s = 7;}
|
||||
|
||||
else if ( (LA12_0=='(') ) {s = 8;}
|
||||
else if ( (LA12_0=='o') ) {s = 8;}
|
||||
|
||||
else if ( (LA12_0==',') ) {s = 9;}
|
||||
else if ( (LA12_0=='(') ) {s = 9;}
|
||||
|
||||
else if ( (LA12_0==')') ) {s = 10;}
|
||||
else if ( (LA12_0==',') ) {s = 10;}
|
||||
|
||||
else if ( (LA12_0==':') ) {s = 11;}
|
||||
else if ( (LA12_0==')') ) {s = 11;}
|
||||
|
||||
else if ( (LA12_0=='s') ) {s = 12;}
|
||||
else if ( (LA12_0==':') ) {s = 12;}
|
||||
|
||||
else if ( (LA12_0=='i') ) {s = 13;}
|
||||
else if ( (LA12_0=='s') ) {s = 13;}
|
||||
|
||||
else if ( (LA12_0=='b') ) {s = 14;}
|
||||
else if ( (LA12_0=='i') ) {s = 14;}
|
||||
|
||||
else if ( (LA12_0=='v') ) {s = 15;}
|
||||
else if ( (LA12_0=='b') ) {s = 15;}
|
||||
|
||||
else if ( (LA12_0=='^') ) {s = 16;}
|
||||
else if ( (LA12_0=='v') ) {s = 16;}
|
||||
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='n')||(LA12_0>='p' && LA12_0<='r')||LA12_0=='u'||(LA12_0>='w' && LA12_0<='z')) ) {s = 17;}
|
||||
else if ( (LA12_0=='.') ) {s = 17;}
|
||||
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 18;}
|
||||
else if ( (LA12_0=='^') ) {s = 18;}
|
||||
|
||||
else if ( (LA12_0=='\"') ) {s = 19;}
|
||||
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='n')||(LA12_0>='q' && LA12_0<='r')||LA12_0=='u'||(LA12_0>='w' && LA12_0<='z')) ) {s = 19;}
|
||||
|
||||
else if ( (LA12_0=='\'') ) {s = 20;}
|
||||
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 20;}
|
||||
|
||||
else if ( (LA12_0=='/') ) {s = 21;}
|
||||
else if ( (LA12_0=='\"') ) {s = 21;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 22;}
|
||||
else if ( (LA12_0=='\'') ) {s = 22;}
|
||||
|
||||
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>='~' && LA12_0<='\uFFFF')) ) {s = 23;}
|
||||
else if ( (LA12_0=='/') ) {s = 23;}
|
||||
|
||||
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 24;}
|
||||
|
||||
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 = 25;}
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 1 :
|
||||
int LA12_20 = input.LA(1);
|
||||
int LA12_21 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_20>='\u0000' && LA12_20<='\uFFFF')) ) {s = 41;}
|
||||
if ( ((LA12_21>='\u0000' && LA12_21<='\uFFFF')) ) {s = 45;}
|
||||
|
||||
else s = 23;
|
||||
else s = 25;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
case 2 :
|
||||
int LA12_19 = input.LA(1);
|
||||
int LA12_22 = input.LA(1);
|
||||
|
||||
s = -1;
|
||||
if ( ((LA12_19>='\u0000' && LA12_19<='\uFFFF')) ) {s = 41;}
|
||||
if ( ((LA12_22>='\u0000' && LA12_22<='\uFFFF')) ) {s = 45;}
|
||||
|
||||
else s = 23;
|
||||
else s = 25;
|
||||
|
||||
if ( s>=0 ) return s;
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,7 @@ import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAcce
|
|||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Operation;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.OperationCall;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PackageDeclaration;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PrimitiveType;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage;
|
||||
|
@ -51,6 +52,9 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
case TestLanguagePackage.OPERATION_CALL:
|
||||
sequence_OperationCall(context, (OperationCall) semanticObject);
|
||||
return;
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION:
|
||||
sequence_PackageDeclaration(context, (PackageDeclaration) semanticObject);
|
||||
return;
|
||||
case TestLanguagePackage.PARAMETER:
|
||||
sequence_Parameter(context, (org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Parameter) semanticObject);
|
||||
return;
|
||||
|
@ -90,7 +94,7 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
* Model returns Model
|
||||
*
|
||||
* Constraint:
|
||||
* types+=TypeDeclaration+
|
||||
* elements+=AbstractElement+
|
||||
*/
|
||||
protected void sequence_Model(ISerializationContext context, Model semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
|
@ -122,6 +126,19 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* PackageDeclaration returns PackageDeclaration
|
||||
* AbstractElement returns PackageDeclaration
|
||||
*
|
||||
* Constraint:
|
||||
* (name=QualifiedName elements+=AbstractElement*)
|
||||
*/
|
||||
protected void sequence_PackageDeclaration(ISerializationContext context, PackageDeclaration semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contexts:
|
||||
* Parameter returns Parameter
|
||||
|
@ -191,10 +208,11 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
|
||||
/**
|
||||
* Contexts:
|
||||
* AbstractElement returns TypeDeclaration
|
||||
* TypeDeclaration returns TypeDeclaration
|
||||
*
|
||||
* Constraint:
|
||||
* (name=ID superType=[TypeDeclaration|ID]? members+=Member*)
|
||||
* (name=ID superType=[TypeDeclaration|QualifiedName]? members+=Member*)
|
||||
*/
|
||||
protected void sequence_TypeDeclaration(ISerializationContext context, TypeDeclaration semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
|
@ -206,7 +224,7 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
* TypeReference returns TypeReference
|
||||
*
|
||||
* Constraint:
|
||||
* typeRef=[TypeDeclaration|ID]
|
||||
* typeRef=[TypeDeclaration|QualifiedName]
|
||||
*/
|
||||
protected void sequence_TypeReference(ISerializationContext context, TypeReference semanticObject) {
|
||||
if (errorAcceptor != null) {
|
||||
|
@ -214,7 +232,7 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TestLanguagePackage.Literals.TYPE_REFERENCE__TYPE_REF));
|
||||
}
|
||||
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
||||
feeder.accept(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationIDTerminalRuleCall_0_1(), semanticObject.eGet(TestLanguagePackage.Literals.TYPE_REFERENCE__TYPE_REF, false));
|
||||
feeder.accept(grammarAccess.getTypeReferenceAccess().getTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1(), semanticObject.eGet(TestLanguagePackage.Literals.TYPE_REFERENCE__TYPE_REF, false));
|
||||
feeder.finish();
|
||||
}
|
||||
|
||||
|
@ -224,7 +242,7 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
|
|||
* Type returns TypeReference
|
||||
*
|
||||
* Constraint:
|
||||
* (typeRef=[TypeDeclaration|ID] arrayDiemensions+='['*)
|
||||
* (typeRef=[TypeDeclaration|QualifiedName] arrayDiemensions+='['*)
|
||||
*/
|
||||
protected void sequence_Type_TypeReference(ISerializationContext context, TypeReference semanticObject) {
|
||||
genericSequencer.createSequence(context, semanticObject);
|
||||
|
|
|
@ -30,18 +30,78 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
|
||||
public class ModelElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.Model");
|
||||
private final Assignment cTypesAssignment = (Assignment)rule.eContents().get(1);
|
||||
private final RuleCall cTypesTypeDeclarationParserRuleCall_0 = (RuleCall)cTypesAssignment.eContents().get(0);
|
||||
private final Assignment cElementsAssignment = (Assignment)rule.eContents().get(1);
|
||||
private final RuleCall cElementsAbstractElementParserRuleCall_0 = (RuleCall)cElementsAssignment.eContents().get(0);
|
||||
|
||||
//Model:
|
||||
// types+=TypeDeclaration*;
|
||||
// elements+=AbstractElement*;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//types+=TypeDeclaration*
|
||||
public Assignment getTypesAssignment() { return cTypesAssignment; }
|
||||
//elements+=AbstractElement*
|
||||
public Assignment getElementsAssignment() { return cElementsAssignment; }
|
||||
|
||||
//AbstractElement
|
||||
public RuleCall getElementsAbstractElementParserRuleCall_0() { return cElementsAbstractElementParserRuleCall_0; }
|
||||
}
|
||||
public class PackageDeclarationElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.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 Keyword cLeftCurlyBracketKeyword_2 = (Keyword)cGroup.eContents().get(2);
|
||||
private final Assignment cElementsAssignment_3 = (Assignment)cGroup.eContents().get(3);
|
||||
private final RuleCall cElementsAbstractElementParserRuleCall_3_0 = (RuleCall)cElementsAssignment_3.eContents().get(0);
|
||||
private final Keyword cRightCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4);
|
||||
|
||||
//PackageDeclaration:
|
||||
// 'package' name=QualifiedName '{'
|
||||
// elements+=AbstractElement*
|
||||
// '}';
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'package' name=QualifiedName '{' elements+=AbstractElement* '}'
|
||||
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; }
|
||||
|
||||
//'{'
|
||||
public Keyword getLeftCurlyBracketKeyword_2() { return cLeftCurlyBracketKeyword_2; }
|
||||
|
||||
//elements+=AbstractElement*
|
||||
public Assignment getElementsAssignment_3() { return cElementsAssignment_3; }
|
||||
|
||||
//AbstractElement
|
||||
public RuleCall getElementsAbstractElementParserRuleCall_3_0() { return cElementsAbstractElementParserRuleCall_3_0; }
|
||||
|
||||
//'}'
|
||||
public Keyword getRightCurlyBracketKeyword_4() { return cRightCurlyBracketKeyword_4; }
|
||||
}
|
||||
public class AbstractElementElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.AbstractElement");
|
||||
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
|
||||
private final RuleCall cPackageDeclarationParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0);
|
||||
private final RuleCall cTypeDeclarationParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1);
|
||||
|
||||
//AbstractElement:
|
||||
// PackageDeclaration | TypeDeclaration;
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//PackageDeclaration | TypeDeclaration
|
||||
public Alternatives getAlternatives() { return cAlternatives; }
|
||||
|
||||
//PackageDeclaration
|
||||
public RuleCall getPackageDeclarationParserRuleCall_0() { return cPackageDeclarationParserRuleCall_0; }
|
||||
|
||||
//TypeDeclaration
|
||||
public RuleCall getTypesTypeDeclarationParserRuleCall_0() { return cTypesTypeDeclarationParserRuleCall_0; }
|
||||
public RuleCall getTypeDeclarationParserRuleCall_1() { return cTypeDeclarationParserRuleCall_1; }
|
||||
}
|
||||
public class TypeDeclarationElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.TypeDeclaration");
|
||||
|
@ -53,19 +113,19 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
private final Keyword cExtendsKeyword_2_0 = (Keyword)cGroup_2.eContents().get(0);
|
||||
private final Assignment cSuperTypeAssignment_2_1 = (Assignment)cGroup_2.eContents().get(1);
|
||||
private final CrossReference cSuperTypeTypeDeclarationCrossReference_2_1_0 = (CrossReference)cSuperTypeAssignment_2_1.eContents().get(0);
|
||||
private final RuleCall cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1 = (RuleCall)cSuperTypeTypeDeclarationCrossReference_2_1_0.eContents().get(1);
|
||||
private final RuleCall cSuperTypeTypeDeclarationQualifiedNameParserRuleCall_2_1_0_1 = (RuleCall)cSuperTypeTypeDeclarationCrossReference_2_1_0.eContents().get(1);
|
||||
private final Keyword cLeftCurlyBracketKeyword_3 = (Keyword)cGroup.eContents().get(3);
|
||||
private final Assignment cMembersAssignment_4 = (Assignment)cGroup.eContents().get(4);
|
||||
private final RuleCall cMembersMemberParserRuleCall_4_0 = (RuleCall)cMembersAssignment_4.eContents().get(0);
|
||||
private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
|
||||
|
||||
//TypeDeclaration:
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration|QualifiedName])? '{'
|
||||
// members+=Member*
|
||||
// '}';
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//'type' name=ID ('extends' superType=[TypeDeclaration])? '{' members+=Member* '}'
|
||||
//'type' name=ID ('extends' superType=[TypeDeclaration|QualifiedName])? '{' members+=Member* '}'
|
||||
public Group getGroup() { return cGroup; }
|
||||
|
||||
//'type'
|
||||
|
@ -77,20 +137,20 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
//ID
|
||||
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
|
||||
|
||||
//('extends' superType=[TypeDeclaration])?
|
||||
//('extends' superType=[TypeDeclaration|QualifiedName])?
|
||||
public Group getGroup_2() { return cGroup_2; }
|
||||
|
||||
//'extends'
|
||||
public Keyword getExtendsKeyword_2_0() { return cExtendsKeyword_2_0; }
|
||||
|
||||
//superType=[TypeDeclaration]
|
||||
//superType=[TypeDeclaration|QualifiedName]
|
||||
public Assignment getSuperTypeAssignment_2_1() { return cSuperTypeAssignment_2_1; }
|
||||
|
||||
//[TypeDeclaration]
|
||||
//[TypeDeclaration|QualifiedName]
|
||||
public CrossReference getSuperTypeTypeDeclarationCrossReference_2_1_0() { return cSuperTypeTypeDeclarationCrossReference_2_1_0; }
|
||||
|
||||
//ID
|
||||
public RuleCall getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1() { return cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1; }
|
||||
//QualifiedName
|
||||
public RuleCall getSuperTypeTypeDeclarationQualifiedNameParserRuleCall_2_1_0_1() { return cSuperTypeTypeDeclarationQualifiedNameParserRuleCall_2_1_0_1; }
|
||||
|
||||
//'{'
|
||||
public Keyword getLeftCurlyBracketKeyword_3() { return cLeftCurlyBracketKeyword_3; }
|
||||
|
@ -385,20 +445,20 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.TypeReference");
|
||||
private final Assignment cTypeRefAssignment = (Assignment)rule.eContents().get(1);
|
||||
private final CrossReference cTypeRefTypeDeclarationCrossReference_0 = (CrossReference)cTypeRefAssignment.eContents().get(0);
|
||||
private final RuleCall cTypeRefTypeDeclarationIDTerminalRuleCall_0_1 = (RuleCall)cTypeRefTypeDeclarationCrossReference_0.eContents().get(1);
|
||||
private final RuleCall cTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1 = (RuleCall)cTypeRefTypeDeclarationCrossReference_0.eContents().get(1);
|
||||
|
||||
//TypeReference:
|
||||
// typeRef=[TypeDeclaration];
|
||||
// typeRef=[TypeDeclaration|QualifiedName];
|
||||
@Override public ParserRule getRule() { return rule; }
|
||||
|
||||
//typeRef=[TypeDeclaration]
|
||||
//typeRef=[TypeDeclaration|QualifiedName]
|
||||
public Assignment getTypeRefAssignment() { return cTypeRefAssignment; }
|
||||
|
||||
//[TypeDeclaration]
|
||||
//[TypeDeclaration|QualifiedName]
|
||||
public CrossReference getTypeRefTypeDeclarationCrossReference_0() { return cTypeRefTypeDeclarationCrossReference_0; }
|
||||
|
||||
//ID
|
||||
public RuleCall getTypeRefTypeDeclarationIDTerminalRuleCall_0_1() { return cTypeRefTypeDeclarationIDTerminalRuleCall_0_1; }
|
||||
//QualifiedName
|
||||
public RuleCall getTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1() { return cTypeRefTypeDeclarationQualifiedNameParserRuleCall_0_1; }
|
||||
}
|
||||
public class PrimitiveTypeElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.PrimitiveType");
|
||||
|
@ -431,9 +491,38 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
//'void'
|
||||
public Keyword getNameVoidKeyword_0_3() { return cNameVoidKeyword_0_3; }
|
||||
}
|
||||
public class QualifiedNameElements extends AbstractParserRuleElementFinder {
|
||||
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.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 ModelElements pModel;
|
||||
private final PackageDeclarationElements pPackageDeclaration;
|
||||
private final AbstractElementElements pAbstractElement;
|
||||
private final TypeDeclarationElements pTypeDeclaration;
|
||||
private final MemberElements pMember;
|
||||
private final PropertyElements pProperty;
|
||||
|
@ -443,6 +532,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
private final ParameterElements pParameter;
|
||||
private final TypeReferenceElements pTypeReference;
|
||||
private final PrimitiveTypeElements pPrimitiveType;
|
||||
private final QualifiedNameElements pQualifiedName;
|
||||
|
||||
private final Grammar grammar;
|
||||
|
||||
|
@ -454,6 +544,8 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
this.grammar = internalFindGrammar(grammarProvider);
|
||||
this.gaTerminals = gaTerminals;
|
||||
this.pModel = new ModelElements();
|
||||
this.pPackageDeclaration = new PackageDeclarationElements();
|
||||
this.pAbstractElement = new AbstractElementElements();
|
||||
this.pTypeDeclaration = new TypeDeclarationElements();
|
||||
this.pMember = new MemberElements();
|
||||
this.pProperty = new PropertyElements();
|
||||
|
@ -463,6 +555,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
this.pParameter = new ParameterElements();
|
||||
this.pTypeReference = new TypeReferenceElements();
|
||||
this.pPrimitiveType = new PrimitiveTypeElements();
|
||||
this.pQualifiedName = new QualifiedNameElements();
|
||||
}
|
||||
|
||||
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
|
||||
|
@ -493,7 +586,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
|
||||
|
||||
//Model:
|
||||
// types+=TypeDeclaration*;
|
||||
// elements+=AbstractElement*;
|
||||
public ModelElements getModelAccess() {
|
||||
return pModel;
|
||||
}
|
||||
|
@ -502,8 +595,30 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
return getModelAccess().getRule();
|
||||
}
|
||||
|
||||
//PackageDeclaration:
|
||||
// 'package' name=QualifiedName '{'
|
||||
// elements+=AbstractElement*
|
||||
// '}';
|
||||
public PackageDeclarationElements getPackageDeclarationAccess() {
|
||||
return pPackageDeclaration;
|
||||
}
|
||||
|
||||
public ParserRule getPackageDeclarationRule() {
|
||||
return getPackageDeclarationAccess().getRule();
|
||||
}
|
||||
|
||||
//AbstractElement:
|
||||
// PackageDeclaration | TypeDeclaration;
|
||||
public AbstractElementElements getAbstractElementAccess() {
|
||||
return pAbstractElement;
|
||||
}
|
||||
|
||||
public ParserRule getAbstractElementRule() {
|
||||
return getAbstractElementAccess().getRule();
|
||||
}
|
||||
|
||||
//TypeDeclaration:
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
// 'type' name=ID ('extends' superType=[TypeDeclaration|QualifiedName])? '{'
|
||||
// members+=Member*
|
||||
// '}';
|
||||
public TypeDeclarationElements getTypeDeclarationAccess() {
|
||||
|
@ -577,7 +692,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
}
|
||||
|
||||
//TypeReference:
|
||||
// typeRef=[TypeDeclaration];
|
||||
// typeRef=[TypeDeclaration|QualifiedName];
|
||||
public TypeReferenceElements getTypeReferenceAccess() {
|
||||
return pTypeReference;
|
||||
}
|
||||
|
@ -596,6 +711,16 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
|
|||
return getPrimitiveTypeAccess().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() {
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* Copyright (c) 2016, 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.testlanguage.testLanguage;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Abstract Element</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement#getName <em>Name</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getAbstractElement()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface AbstractElement extends EObject
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Name</em>' attribute isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Name</em>' attribute.
|
||||
* @see #setName(String)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getAbstractElement_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement#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);
|
||||
|
||||
} // AbstractElement
|
|
@ -20,7 +20,7 @@ import org.eclipse.emf.ecore.EObject;
|
|||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getTypes <em>Types</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getElements <em>Elements</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getModel()
|
||||
|
@ -30,19 +30,19 @@ import org.eclipse.emf.ecore.EObject;
|
|||
public interface Model extends EObject
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Types</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration}.
|
||||
* Returns the value of the '<em><b>Elements</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Types</em>' containment reference list isn't clear,
|
||||
* If the meaning of the '<em>Elements</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>Types</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getModel_Types()
|
||||
* @return the value of the '<em>Elements</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getModel_Elements()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<TypeDeclaration> getTypes();
|
||||
EList<AbstractElement> getElements();
|
||||
|
||||
} // Model
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Copyright (c) 2016, 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.testlanguage.testLanguage;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
/**
|
||||
* <!-- 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.ide.tests.testlanguage.testLanguage.PackageDeclaration#getElements <em>Elements</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getPackageDeclaration()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface PackageDeclaration extends AbstractElement
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Elements</b></em>' containment reference list.
|
||||
* The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement}.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Elements</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>Elements</em>' containment reference list.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getPackageDeclaration_Elements()
|
||||
* @model containment="true"
|
||||
* @generated
|
||||
*/
|
||||
EList<AbstractElement> getElements();
|
||||
|
||||
} // PackageDeclaration
|
|
@ -36,6 +36,24 @@ public interface TestLanguageFactory extends EFactory
|
|||
*/
|
||||
Model createModel();
|
||||
|
||||
/**
|
||||
* 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>Abstract Element</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return a new object of class '<em>Abstract Element</em>'.
|
||||
* @generated
|
||||
*/
|
||||
AbstractElement createAbstractElement();
|
||||
|
||||
/**
|
||||
* Returns a new object of class '<em>Type Declaration</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
|
|
|
@ -72,13 +72,13 @@ public interface TestLanguagePackage extends EPackage
|
|||
int MODEL = 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Types</b></em>' containment reference list.
|
||||
* The feature id for the '<em><b>Elements</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int MODEL__TYPES = 0;
|
||||
int MODEL__ELEMENTS = 0;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Model</em>' class.
|
||||
|
@ -90,14 +90,14 @@ public interface TestLanguagePackage extends EPackage
|
|||
int MODEL_FEATURE_COUNT = 1;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl <em>Type Declaration</em>}' class.
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.AbstractElementImpl <em>Abstract Element</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getTypeDeclaration()
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.AbstractElementImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getAbstractElement()
|
||||
* @generated
|
||||
*/
|
||||
int TYPE_DECLARATION = 1;
|
||||
int ABSTRACT_ELEMENT = 2;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
|
@ -106,7 +106,72 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__NAME = 0;
|
||||
int ABSTRACT_ELEMENT__NAME = 0;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Abstract Element</em>' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int ABSTRACT_ELEMENT_FEATURE_COUNT = 1;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.PackageDeclarationImpl <em>Package Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.PackageDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
int PACKAGE_DECLARATION = 1;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION__NAME = ABSTRACT_ELEMENT__NAME;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Elements</b></em>' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PACKAGE_DECLARATION__ELEMENTS = ABSTRACT_ELEMENT_FEATURE_COUNT + 0;
|
||||
|
||||
/**
|
||||
* 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 = ABSTRACT_ELEMENT_FEATURE_COUNT + 1;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl <em>Type Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
int TYPE_DECLARATION = 3;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__NAME = ABSTRACT_ELEMENT__NAME;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Super Type</b></em>' reference.
|
||||
|
@ -115,7 +180,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__SUPER_TYPE = 1;
|
||||
int TYPE_DECLARATION__SUPER_TYPE = ABSTRACT_ELEMENT_FEATURE_COUNT + 0;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Members</b></em>' containment reference list.
|
||||
|
@ -124,7 +189,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION__MEMBERS = 2;
|
||||
int TYPE_DECLARATION__MEMBERS = ABSTRACT_ELEMENT_FEATURE_COUNT + 1;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Type Declaration</em>' class.
|
||||
|
@ -133,7 +198,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int TYPE_DECLARATION_FEATURE_COUNT = 3;
|
||||
int TYPE_DECLARATION_FEATURE_COUNT = ABSTRACT_ELEMENT_FEATURE_COUNT + 2;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.MemberImpl <em>Member</em>}' class.
|
||||
|
@ -143,7 +208,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getMember()
|
||||
* @generated
|
||||
*/
|
||||
int MEMBER = 2;
|
||||
int MEMBER = 4;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
|
@ -171,7 +236,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getProperty()
|
||||
* @generated
|
||||
*/
|
||||
int PROPERTY = 3;
|
||||
int PROPERTY = 5;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
|
@ -208,7 +273,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getType()
|
||||
* @generated
|
||||
*/
|
||||
int TYPE = 4;
|
||||
int TYPE = 6;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Array Diemensions</b></em>' attribute list.
|
||||
|
@ -236,7 +301,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getOperation()
|
||||
* @generated
|
||||
*/
|
||||
int OPERATION = 5;
|
||||
int OPERATION = 7;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
|
@ -291,7 +356,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getOperationCall()
|
||||
* @generated
|
||||
*/
|
||||
int OPERATION_CALL = 6;
|
||||
int OPERATION_CALL = 8;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Operation</b></em>' reference.
|
||||
|
@ -328,7 +393,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getParameter()
|
||||
* @generated
|
||||
*/
|
||||
int PARAMETER = 7;
|
||||
int PARAMETER = 9;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Name</b></em>' attribute.
|
||||
|
@ -365,7 +430,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getTypeReference()
|
||||
* @generated
|
||||
*/
|
||||
int TYPE_REFERENCE = 8;
|
||||
int TYPE_REFERENCE = 10;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Array Diemensions</b></em>' attribute list.
|
||||
|
@ -402,7 +467,7 @@ public interface TestLanguagePackage extends EPackage
|
|||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getPrimitiveType()
|
||||
* @generated
|
||||
*/
|
||||
int PRIMITIVE_TYPE = 9;
|
||||
int PRIMITIVE_TYPE = 11;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Array Diemensions</b></em>' attribute list.
|
||||
|
@ -443,15 +508,57 @@ public interface TestLanguagePackage extends EPackage
|
|||
EClass getModel();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getTypes <em>Types</em>}'.
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getElements <em>Elements</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Types</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getTypes()
|
||||
* @return the meta object for the containment reference list '<em>Elements</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model#getElements()
|
||||
* @see #getModel()
|
||||
* @generated
|
||||
*/
|
||||
EReference getModel_Types();
|
||||
EReference getModel_Elements();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.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.ide.tests.testlanguage.testLanguage.PackageDeclaration
|
||||
* @generated
|
||||
*/
|
||||
EClass getPackageDeclaration();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PackageDeclaration#getElements <em>Elements</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the containment reference list '<em>Elements</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PackageDeclaration#getElements()
|
||||
* @see #getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EReference getPackageDeclaration_Elements();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement <em>Abstract Element</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for class '<em>Abstract Element</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement
|
||||
* @generated
|
||||
*/
|
||||
EClass getAbstractElement();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement#getName()
|
||||
* @see #getAbstractElement()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getAbstractElement_Name();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration <em>Type Declaration</em>}'.
|
||||
|
@ -463,17 +570,6 @@ public interface TestLanguagePackage extends EPackage
|
|||
*/
|
||||
EClass getTypeDeclaration();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getName <em>Name</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Name</em>'.
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getName()
|
||||
* @see #getTypeDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getTypeDeclaration_Name();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the reference '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
|
@ -742,12 +838,48 @@ public interface TestLanguagePackage extends EPackage
|
|||
EClass MODEL = eINSTANCE.getModel();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Types</b></em>' containment reference list feature.
|
||||
* The meta object literal for the '<em><b>Elements</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference MODEL__TYPES = eINSTANCE.getModel_Types();
|
||||
EReference MODEL__ELEMENTS = eINSTANCE.getModel_Elements();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.PackageDeclarationImpl <em>Package Declaration</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.PackageDeclarationImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getPackageDeclaration()
|
||||
* @generated
|
||||
*/
|
||||
EClass PACKAGE_DECLARATION = eINSTANCE.getPackageDeclaration();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Elements</b></em>' containment reference list feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EReference PACKAGE_DECLARATION__ELEMENTS = eINSTANCE.getPackageDeclaration_Elements();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.AbstractElementImpl <em>Abstract Element</em>}' class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.AbstractElementImpl
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TestLanguagePackageImpl#getAbstractElement()
|
||||
* @generated
|
||||
*/
|
||||
EClass ABSTRACT_ELEMENT = eINSTANCE.getAbstractElement();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute ABSTRACT_ELEMENT__NAME = eINSTANCE.getAbstractElement_Name();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl <em>Type Declaration</em>}' class.
|
||||
|
@ -759,14 +891,6 @@ public interface TestLanguagePackage extends EPackage
|
|||
*/
|
||||
EClass TYPE_DECLARATION = eINSTANCE.getTypeDeclaration();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute TYPE_DECLARATION__NAME = eINSTANCE.getTypeDeclaration_Name();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Super Type</b></em>' reference feature.
|
||||
* <!-- begin-user-doc -->
|
||||
|
|
|
@ -9,8 +9,6 @@ package org.eclipse.xtext.ide.tests.testlanguage.testLanguage;
|
|||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* A representation of the model object '<em><b>Type Declaration</b></em>'.
|
||||
|
@ -20,7 +18,6 @@ import org.eclipse.emf.ecore.EObject;
|
|||
* The following features are supported:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getMembers <em>Members</em>}</li>
|
||||
* </ul>
|
||||
|
@ -29,34 +26,8 @@ import org.eclipse.emf.ecore.EObject;
|
|||
* @model
|
||||
* @generated
|
||||
*/
|
||||
public interface TypeDeclaration extends EObject
|
||||
public interface TypeDeclaration extends AbstractElement
|
||||
{
|
||||
/**
|
||||
* Returns the value of the '<em><b>Name</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the '<em>Name</em>' attribute isn't clear,
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Name</em>' attribute.
|
||||
* @see #setName(String)
|
||||
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getTypeDeclaration_Name()
|
||||
* @model
|
||||
* @generated
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getName <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Name</em>' attribute.
|
||||
* @see #getName()
|
||||
* @generated
|
||||
*/
|
||||
void setName(String value);
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Super Type</b></em>' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
/**
|
||||
* Copyright (c) 2016, 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.testlanguage.testLanguage.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model object '<em><b>Abstract Element</b></em>'.
|
||||
* <!-- end-user-doc -->
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.AbstractElementImpl#getName <em>Name</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class AbstractElementImpl extends MinimalEObjectImpl.Container implements AbstractElement
|
||||
{
|
||||
/**
|
||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final String NAME_EDEFAULT = null;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected String name = NAME_EDEFAULT;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected AbstractElementImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return TestLanguagePackage.Literals.ABSTRACT_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, TestLanguagePackage.ABSTRACT_ELEMENT__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public Object eGet(int featureID, boolean resolve, boolean coreType)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT__NAME:
|
||||
return getName();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eSet(int featureID, Object newValue)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (eIsProxy()) return super.toString();
|
||||
|
||||
StringBuffer result = new StringBuffer(super.toString());
|
||||
result.append(" (name: ");
|
||||
result.append(name);
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
} //AbstractElementImpl
|
|
@ -21,9 +21,9 @@ import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
|
|||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
|
@ -33,7 +33,7 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
|||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.ModelImpl#getTypes <em>Types</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.ModelImpl#getElements <em>Elements</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
|
@ -41,14 +41,14 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
|||
public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
||||
{
|
||||
/**
|
||||
* The cached value of the '{@link #getTypes() <em>Types</em>}' containment reference list.
|
||||
* The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getTypes()
|
||||
* @see #getElements()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<TypeDeclaration> types;
|
||||
protected EList<AbstractElement> elements;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
|
@ -76,13 +76,13 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<TypeDeclaration> getTypes()
|
||||
public EList<AbstractElement> getElements()
|
||||
{
|
||||
if (types == null)
|
||||
if (elements == null)
|
||||
{
|
||||
types = new EObjectContainmentEList<TypeDeclaration>(TypeDeclaration.class, this, TestLanguagePackage.MODEL__TYPES);
|
||||
elements = new EObjectContainmentEList<AbstractElement>(AbstractElement.class, this, TestLanguagePackage.MODEL__ELEMENTS);
|
||||
}
|
||||
return types;
|
||||
return elements;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,8 +95,8 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.MODEL__TYPES:
|
||||
return ((InternalEList<?>)getTypes()).basicRemove(otherEnd, msgs);
|
||||
case TestLanguagePackage.MODEL__ELEMENTS:
|
||||
return ((InternalEList<?>)getElements()).basicRemove(otherEnd, msgs);
|
||||
}
|
||||
return super.eInverseRemove(otherEnd, featureID, msgs);
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.MODEL__TYPES:
|
||||
return getTypes();
|
||||
case TestLanguagePackage.MODEL__ELEMENTS:
|
||||
return getElements();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
|
@ -128,9 +128,9 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.MODEL__TYPES:
|
||||
getTypes().clear();
|
||||
getTypes().addAll((Collection<? extends TypeDeclaration>)newValue);
|
||||
case TestLanguagePackage.MODEL__ELEMENTS:
|
||||
getElements().clear();
|
||||
getElements().addAll((Collection<? extends AbstractElement>)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
|
@ -146,8 +146,8 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.MODEL__TYPES:
|
||||
getTypes().clear();
|
||||
case TestLanguagePackage.MODEL__ELEMENTS:
|
||||
getElements().clear();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
|
@ -163,8 +163,8 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.MODEL__TYPES:
|
||||
return types != null && !types.isEmpty();
|
||||
case TestLanguagePackage.MODEL__ELEMENTS:
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
/**
|
||||
* Copyright (c) 2016, 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.testlanguage.testLanguage.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
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.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PackageDeclaration;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage;
|
||||
|
||||
/**
|
||||
* <!-- 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.ide.tests.testlanguage.testLanguage.impl.PackageDeclarationImpl#getElements <em>Elements</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class PackageDeclarationImpl extends AbstractElementImpl implements PackageDeclaration
|
||||
{
|
||||
/**
|
||||
* The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getElements()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected EList<AbstractElement> elements;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected PackageDeclarationImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EClass eStaticClass()
|
||||
{
|
||||
return TestLanguagePackage.Literals.PACKAGE_DECLARATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EList<AbstractElement> getElements()
|
||||
{
|
||||
if (elements == null)
|
||||
{
|
||||
elements = new EObjectContainmentEList<AbstractElement>(AbstractElement.class, this, TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS);
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS:
|
||||
return ((InternalEList<?>)getElements()).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 TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS:
|
||||
return getElements();
|
||||
}
|
||||
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 TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS:
|
||||
getElements().clear();
|
||||
getElements().addAll((Collection<? extends AbstractElement>)newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void eUnset(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS:
|
||||
getElements().clear();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean eIsSet(int featureID)
|
||||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION__ELEMENTS:
|
||||
return elements != null && !elements.isEmpty();
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
} //PackageDeclarationImpl
|
|
@ -70,6 +70,8 @@ public class TestLanguageFactoryImpl extends EFactoryImpl implements TestLanguag
|
|||
switch (eClass.getClassifierID())
|
||||
{
|
||||
case TestLanguagePackage.MODEL: return createModel();
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION: return createPackageDeclaration();
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT: return createAbstractElement();
|
||||
case TestLanguagePackage.TYPE_DECLARATION: return createTypeDeclaration();
|
||||
case TestLanguagePackage.MEMBER: return createMember();
|
||||
case TestLanguagePackage.PROPERTY: return createProperty();
|
||||
|
@ -95,6 +97,28 @@ public class TestLanguageFactoryImpl extends EFactoryImpl implements TestLanguag
|
|||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public PackageDeclaration createPackageDeclaration()
|
||||
{
|
||||
PackageDeclarationImpl packageDeclaration = new PackageDeclarationImpl();
|
||||
return packageDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public AbstractElement createAbstractElement()
|
||||
{
|
||||
AbstractElementImpl abstractElement = new AbstractElementImpl();
|
||||
return abstractElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
|
|
|
@ -15,10 +15,12 @@ import org.eclipse.emf.ecore.EcorePackage;
|
|||
|
||||
import org.eclipse.emf.ecore.impl.EPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Member;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Operation;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.OperationCall;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PackageDeclaration;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Parameter;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.PrimitiveType;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property;
|
||||
|
@ -43,6 +45,20 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
*/
|
||||
private EClass modelEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass packageDeclarationEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private EClass abstractElementEClass = null;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
|
@ -187,11 +203,51 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getModel_Types()
|
||||
public EReference getModel_Elements()
|
||||
{
|
||||
return (EReference)modelEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getPackageDeclaration()
|
||||
{
|
||||
return packageDeclarationEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EReference getPackageDeclaration_Elements()
|
||||
{
|
||||
return (EReference)packageDeclarationEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EClass getAbstractElement()
|
||||
{
|
||||
return abstractElementEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getAbstractElement_Name()
|
||||
{
|
||||
return (EAttribute)abstractElementEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
|
@ -202,16 +258,6 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
return typeDeclarationEClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getTypeDeclaration_Name()
|
||||
{
|
||||
return (EAttribute)typeDeclarationEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
|
@ -219,7 +265,7 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
*/
|
||||
public EReference getTypeDeclaration_SuperType()
|
||||
{
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(1);
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,7 +275,7 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
*/
|
||||
public EReference getTypeDeclaration_Members()
|
||||
{
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(2);
|
||||
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -463,10 +509,15 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
|
||||
// Create classes and their features
|
||||
modelEClass = createEClass(MODEL);
|
||||
createEReference(modelEClass, MODEL__TYPES);
|
||||
createEReference(modelEClass, MODEL__ELEMENTS);
|
||||
|
||||
packageDeclarationEClass = createEClass(PACKAGE_DECLARATION);
|
||||
createEReference(packageDeclarationEClass, PACKAGE_DECLARATION__ELEMENTS);
|
||||
|
||||
abstractElementEClass = createEClass(ABSTRACT_ELEMENT);
|
||||
createEAttribute(abstractElementEClass, ABSTRACT_ELEMENT__NAME);
|
||||
|
||||
typeDeclarationEClass = createEClass(TYPE_DECLARATION);
|
||||
createEAttribute(typeDeclarationEClass, TYPE_DECLARATION__NAME);
|
||||
createEReference(typeDeclarationEClass, TYPE_DECLARATION__SUPER_TYPE);
|
||||
createEReference(typeDeclarationEClass, TYPE_DECLARATION__MEMBERS);
|
||||
|
||||
|
@ -531,6 +582,8 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
// Set bounds for type parameters
|
||||
|
||||
// Add supertypes to classes
|
||||
packageDeclarationEClass.getESuperTypes().add(this.getAbstractElement());
|
||||
typeDeclarationEClass.getESuperTypes().add(this.getAbstractElement());
|
||||
propertyEClass.getESuperTypes().add(this.getMember());
|
||||
operationEClass.getESuperTypes().add(this.getMember());
|
||||
typeReferenceEClass.getESuperTypes().add(this.getType());
|
||||
|
@ -538,10 +591,15 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
|
|||
|
||||
// Initialize classes and features; add operations and parameters
|
||||
initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEReference(getModel_Types(), this.getTypeDeclaration(), null, "types", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getModel_Elements(), this.getAbstractElement(), null, "elements", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(packageDeclarationEClass, PackageDeclaration.class, "PackageDeclaration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEReference(getPackageDeclaration_Elements(), this.getAbstractElement(), null, "elements", 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(abstractElementEClass, AbstractElement.class, "AbstractElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getAbstractElement_Name(), theEcorePackage.getEString(), "name", null, 0, 1, AbstractElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(typeDeclarationEClass, TypeDeclaration.class, "TypeDeclaration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEAttribute(getTypeDeclaration_Name(), theEcorePackage.getEString(), "name", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getTypeDeclaration_SuperType(), this.getTypeDeclaration(), null, "superType", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getTypeDeclaration_Members(), this.getMember(), null, "members", null, 0, -1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ 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;
|
||||
|
@ -35,35 +34,14 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
|||
* The following features are implemented:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getSuperType <em>Super Type</em>}</li>
|
||||
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getMembers <em>Members</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements TypeDeclaration
|
||||
public class TypeDeclarationImpl extends AbstractElementImpl implements TypeDeclaration
|
||||
{
|
||||
/**
|
||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final String NAME_EDEFAULT = null;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected String name = NAME_EDEFAULT;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getSuperType() <em>Super Type</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
|
@ -105,29 +83,6 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
return TestLanguagePackage.Literals.TYPE_DECLARATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setName(String newName)
|
||||
{
|
||||
String oldName = name;
|
||||
name = newName;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, TestLanguagePackage.TYPE_DECLARATION__NAME, oldName, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
|
@ -211,8 +166,6 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
return getName();
|
||||
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
if (resolve) return getSuperType();
|
||||
return basicGetSuperType();
|
||||
|
@ -233,9 +186,6 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
setName((String)newValue);
|
||||
return;
|
||||
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
setSuperType((TypeDeclaration)newValue);
|
||||
return;
|
||||
|
@ -257,9 +207,6 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
setName(NAME_EDEFAULT);
|
||||
return;
|
||||
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
setSuperType((TypeDeclaration)null);
|
||||
return;
|
||||
|
@ -280,8 +227,6 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
{
|
||||
switch (featureID)
|
||||
{
|
||||
case TestLanguagePackage.TYPE_DECLARATION__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
|
||||
return superType != null;
|
||||
case TestLanguagePackage.TYPE_DECLARATION__MEMBERS:
|
||||
|
@ -290,21 +235,4 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
|
|||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (eIsProxy()) return super.toString();
|
||||
|
||||
StringBuffer result = new StringBuffer(super.toString());
|
||||
result.append(" (name: ");
|
||||
result.append(name);
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
} //TypeDeclarationImpl
|
||||
|
|
|
@ -85,6 +85,16 @@ public class TestLanguageAdapterFactory extends AdapterFactoryImpl
|
|||
return createModelAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter casePackageDeclaration(PackageDeclaration object)
|
||||
{
|
||||
return createPackageDeclarationAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseAbstractElement(AbstractElement object)
|
||||
{
|
||||
return createAbstractElementAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseTypeDeclaration(TypeDeclaration object)
|
||||
{
|
||||
return createTypeDeclarationAdapter();
|
||||
|
@ -166,6 +176,36 @@ public class TestLanguageAdapterFactory extends AdapterFactoryImpl
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.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.ide.tests.testlanguage.testLanguage.PackageDeclaration
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createPackageDeclarationAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement <em>Abstract 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.ide.tests.testlanguage.testLanguage.AbstractElement
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createAbstractElementAdapter()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration <em>Type Declaration</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
|
|
|
@ -84,10 +84,26 @@ public class TestLanguageSwitch<T> extends Switch<T>
|
|||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case TestLanguagePackage.PACKAGE_DECLARATION:
|
||||
{
|
||||
PackageDeclaration packageDeclaration = (PackageDeclaration)theEObject;
|
||||
T result = casePackageDeclaration(packageDeclaration);
|
||||
if (result == null) result = caseAbstractElement(packageDeclaration);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case TestLanguagePackage.ABSTRACT_ELEMENT:
|
||||
{
|
||||
AbstractElement abstractElement = (AbstractElement)theEObject;
|
||||
T result = caseAbstractElement(abstractElement);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case TestLanguagePackage.TYPE_DECLARATION:
|
||||
{
|
||||
TypeDeclaration typeDeclaration = (TypeDeclaration)theEObject;
|
||||
T result = caseTypeDeclaration(typeDeclaration);
|
||||
if (result == null) result = caseAbstractElement(typeDeclaration);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
|
@ -171,6 +187,38 @@ public class TestLanguageSwitch<T> extends Switch<T>
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>Abstract 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>Abstract Element</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseAbstractElement(AbstractElement object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Type Declaration</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
|
|
|
@ -10,12 +10,25 @@ grammar org.eclipse.xtext.ide.tests.testlanguage.TestLanguage with org.eclipse.x
|
|||
generate testLanguage "http://www.eclipse.org/xtext/ide/tests/testlanguage/TestLanguage"
|
||||
|
||||
Model:
|
||||
types+=TypeDeclaration*;
|
||||
|
||||
elements+=AbstractElement*
|
||||
;
|
||||
|
||||
PackageDeclaration:
|
||||
'package' name=QualifiedName '{'
|
||||
(elements+=AbstractElement)*
|
||||
'}'
|
||||
;
|
||||
|
||||
AbstractElement:
|
||||
PackageDeclaration |
|
||||
TypeDeclaration
|
||||
;
|
||||
|
||||
TypeDeclaration:
|
||||
'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
|
||||
members += Member*
|
||||
'}';
|
||||
'type' name=ID ('extends' superType=[TypeDeclaration|QualifiedName])? '{'
|
||||
members+=Member*
|
||||
'}'
|
||||
;
|
||||
|
||||
Member returns Member:
|
||||
Property |
|
||||
|
@ -27,8 +40,7 @@ Property:
|
|||
;
|
||||
|
||||
Type :
|
||||
(TypeReference |
|
||||
PrimitiveType) (arrayDiemensions+='['']')*
|
||||
(TypeReference | PrimitiveType) (arrayDiemensions+='['']')*
|
||||
;
|
||||
|
||||
Operation returns Operation:
|
||||
|
@ -38,7 +50,7 @@ Operation returns Operation:
|
|||
;
|
||||
|
||||
OperationCall:
|
||||
operation = [Operation|ID] '(' (params+=INT (',' params+=INT)*)? ')'
|
||||
operation=[Operation|ID] '(' (params+=INT (',' params+=INT)*)? ')'
|
||||
;
|
||||
|
||||
Parameter returns Parameter:
|
||||
|
@ -46,9 +58,13 @@ Parameter returns Parameter:
|
|||
;
|
||||
|
||||
TypeReference:
|
||||
typeRef=[TypeDeclaration]
|
||||
typeRef=[TypeDeclaration|QualifiedName]
|
||||
;
|
||||
|
||||
PrimitiveType:
|
||||
name=('string'|'int'|'boolean'|'void')
|
||||
;
|
||||
|
||||
QualifiedName:
|
||||
ID ('.' ID)*
|
||||
;
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.eclipse.xtext.ide.tests.testlanguage
|
|||
|
||||
import org.eclipse.xtext.formatting2.IFormatter2
|
||||
import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdater
|
||||
import org.eclipse.xtext.ide.server.coloring.IColoringService
|
||||
import org.eclipse.xtext.ide.server.semanticHighlight.ISemanticHighlightingStyleToTokenMapper
|
||||
import org.eclipse.xtext.ide.server.signatureHelp.ISignatureHelpService
|
||||
|
@ -16,17 +17,18 @@ import org.eclipse.xtext.ide.tests.testlanguage.coloring.ColoringServiceImpl
|
|||
import org.eclipse.xtext.ide.tests.testlanguage.editor.syntaxcoloring.SemanticHighlightingCalculatorImpl
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.editor.syntaxcoloring.SemanticHighlightingStyleToTokenMapper
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.formatting2.TestLanguageFormatter
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.serializer.TestLanguageReferenceUpdater
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.signatureHelp.SignatureHelpServiceImpl
|
||||
|
||||
/**
|
||||
* Use this class to register components to be used at runtime / without the Equinox extension registry.
|
||||
*/
|
||||
class TestLanguageRuntimeModule extends AbstractTestLanguageRuntimeModule {
|
||||
|
||||
|
||||
def Class<? extends IFormatter2> bindIFormatter2() {
|
||||
return TestLanguageFormatter;
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends ISignatureHelpService> bindSignatureHelpService() {
|
||||
return SignatureHelpServiceImpl;
|
||||
}
|
||||
|
@ -43,4 +45,8 @@ class TestLanguageRuntimeModule extends AbstractTestLanguageRuntimeModule {
|
|||
return SemanticHighlightingStyleToTokenMapper;
|
||||
}
|
||||
|
||||
def Class<? extends IReferenceUpdater> bindIReferenceUpdater() {
|
||||
return TestLanguageReferenceUpdater;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class SemanticHighlightingCalculatorImpl extends DefaultSemanticHighlightingCalc
|
|||
}
|
||||
|
||||
def dispatch boolean doHighlightElement(TypeDeclaration it, IHighlightedPositionAcceptor acceptor) {
|
||||
return acceptor.doHighlightNode(it, TYPE_DECLARATION__NAME, TYPE_DECLARATION_STYLE);
|
||||
return acceptor.doHighlightNode(it, ABSTRACT_ELEMENT__NAME, TYPE_DECLARATION_STYLE);
|
||||
}
|
||||
|
||||
def dispatch boolean doHighlightElement(PrimitiveType it, IHighlightedPositionAcceptor acceptor) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class TestLanguageFormatter extends AbstractFormatter2 {
|
|||
@Inject extension TestLanguageGrammarAccess
|
||||
|
||||
def dispatch void format(Model model, extension IFormattableDocument document) {
|
||||
for (type : model.types) {
|
||||
for (type : model.elements) {
|
||||
type.format
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,34 +14,36 @@ import org.eclipse.xtext.ide.server.codeActions.ICodeActionService2
|
|||
import org.eclipse.xtext.ide.server.codelens.ICodeLensResolver
|
||||
import org.eclipse.xtext.ide.server.codelens.ICodeLensService
|
||||
import org.eclipse.xtext.ide.server.commands.IExecutableCommandService
|
||||
import org.eclipse.xtext.ide.server.rename.IRenameService2
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.server.CodeActionService
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.server.CodeLensService
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.rename.TestLanguageRenameService
|
||||
|
||||
/**
|
||||
* Use this class to register ide components.
|
||||
*/
|
||||
class TestLanguageIdeModule extends AbstractTestLanguageIdeModule {
|
||||
|
||||
|
||||
def Class<? extends ILanguageServerExtension> bindLanguageServerExtension() {
|
||||
TestLangLSPExtension
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends ICodeLensResolver> bindICodeLensResolver() {
|
||||
CodeLensService
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends ICodeLensService> bindICodeLensService() {
|
||||
CodeLensService
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends ICodeActionService2> bindICodeActionService2() {
|
||||
CodeActionService
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends IExecutableCommandService> bindIExecutableCommandService() {
|
||||
return TestLanguageExecutableCommandService
|
||||
}
|
||||
|
||||
|
||||
def Class<? extends IdeContentProposalCreator> bindIdeContentProposalCreator() {
|
||||
TestLanguageProposalCreator
|
||||
}
|
||||
|
@ -49,4 +51,8 @@ class TestLanguageIdeModule extends AbstractTestLanguageIdeModule {
|
|||
def Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
|
||||
TestLanguageIdeContentProposalProvider
|
||||
}
|
||||
|
||||
override Class<? extends IRenameService2> bindIRenameService2() {
|
||||
return TestLanguageRenameService;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2019 TypeFox (http://www.itemis.eu) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.serializer
|
||||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionDiffBuilder
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IUpdatableReference
|
||||
import org.eclipse.xtext.ide.serializer.impl.ReferenceUpdater
|
||||
import org.eclipse.xtext.naming.IQualifiedNameConverter
|
||||
import org.eclipse.xtext.scoping.IScopeProvider
|
||||
import org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding
|
||||
|
||||
/**
|
||||
* Customized reference updater to handle FQN renaming gracefully.
|
||||
*
|
||||
* <p>
|
||||
* When renaming {@code Foo} to {@code Bar}, it follows the default logic,
|
||||
* but when renaming {@code my.type.Foo} to {@code Bar}, it will result
|
||||
* in {@code my.type.Bar} instead of {@code Bar}.
|
||||
*/
|
||||
class TestLanguageReferenceUpdater extends ReferenceUpdater {
|
||||
|
||||
@Inject
|
||||
IQualifiedNameConverter nameConverter;
|
||||
|
||||
@Inject
|
||||
@SerializerScopeProviderBinding
|
||||
IScopeProvider scopeProvider;
|
||||
|
||||
override void updateReference(ITextRegionDiffBuilder rewriter, IUpdatableReference it) {
|
||||
if (rewriter.isModified(referenceRegion)) {
|
||||
return;
|
||||
}
|
||||
val scope = scopeProvider.getScope(sourceEObject, EReference);
|
||||
val region = referenceRegion;
|
||||
val oldName = nameConverter.toQualifiedName(region.text);
|
||||
val oldDesc = scope.getSingleElement(oldName);
|
||||
if (oldDesc !== null && oldDesc.EObjectOrProxy === targetEObject) {
|
||||
return;
|
||||
}
|
||||
var newName = findValidName(it, scope);
|
||||
if (newName !== null) {
|
||||
// Check if the original was a FQN. If so, "rename" the last segment only.
|
||||
if (oldName.segmentCount > 1) {
|
||||
newName = oldName.skipLast(1).append(newName).toString;
|
||||
}
|
||||
rewriter.replace(region, newName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@ import org.eclipse.xtext.ide.serializer.IEmfResourceChange
|
|||
import org.eclipse.xtext.ide.serializer.ITextDocumentChange
|
||||
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService2
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration
|
||||
import org.eclipse.xtext.util.CollectionBasedAcceptor
|
||||
|
||||
import static org.eclipse.xtext.ide.tests.testlanguage.validation.TestLanguageValidator.*
|
||||
|
@ -63,7 +64,7 @@ class CodeActionService implements ICodeActionService2 {
|
|||
def private CodeAction fixUnsortedMembers(Diagnostic d, Options options) {
|
||||
val wsEdit = recordWorkspaceEdit(options) [ copiedResource |
|
||||
val model = copiedResource.contents.filter(Model).head
|
||||
for (type : model.types) {
|
||||
for (type : model.elements.filter(TypeDeclaration)) {
|
||||
ECollections.sort(type.members, [a, b|a.name <=> b.name])
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2019 TypeFox and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.rename
|
||||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.ide.server.rename.RenameService2
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils
|
||||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
|
||||
class TestLanguageRenameService extends RenameService2 {
|
||||
|
||||
@Inject
|
||||
extension EObjectAtOffsetHelper
|
||||
|
||||
override protected getElementWithIdentifierAt(XtextResource xtextResource, int offset) {
|
||||
if (offset >= 0) {
|
||||
val rootNode = xtextResource?.parseResult?.rootNode
|
||||
if (rootNode !== null) {
|
||||
val leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, offset)
|
||||
if (leaf !== null && leaf.isIdentifier) {
|
||||
val element = xtextResource.resolveElementAt(offset)
|
||||
if (element !== null) {
|
||||
val nameProvider = xtextResource.resourceServiceProvider.get(IQualifiedNameProvider)
|
||||
val fqn = nameProvider.getFullyQualifiedName(element)
|
||||
if (fqn !== null) {
|
||||
val leafText = NodeModelUtils.getTokenText(leaf)
|
||||
if ((fqn.segmentCount === 1 && fqn.toString == leafText) || (fqn.lastSegment == leafText)) {
|
||||
return element
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ class TestLanguageValidator extends AbstractTestLanguageValidator {
|
|||
def checkGreetingStartsWithCapital(TypeDeclaration type) {
|
||||
if (!Character.isUpperCase(type.name.charAt(0))) {
|
||||
warning('Name should start with a capital',
|
||||
TestLanguagePackage.Literals.TYPE_DECLARATION__NAME,
|
||||
TestLanguagePackage.Literals.ABSTRACT_ELEMENT__NAME,
|
||||
INVALID_NAME)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class TestLanguageValidator extends AbstractTestLanguageValidator {
|
|||
if (type.members.sortBy[name] != type.members) {
|
||||
warning(
|
||||
'Members should be in alphabetic order.',
|
||||
TestLanguagePackage.Literals.TYPE_DECLARATION__NAME,
|
||||
TestLanguagePackage.Literals.ABSTRACT_ELEMENT__NAME,
|
||||
UNSORTED_MEMBERS
|
||||
)
|
||||
}
|
||||
|
|
|
@ -144,10 +144,19 @@ public class ContentAssistContextFactoryTest {
|
|||
_builder_1.append("context0 {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Assignment: Model:types+= *");
|
||||
_builder_1.append("Assignment: Model:elements+= *");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: Model:types+=TypeDeclaration");
|
||||
_builder_1.append("RuleCall: Model:elements+=AbstractElement");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: AbstractElement:PackageDeclaration");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: PackageDeclaration:\'package\'");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("RuleCall: AbstractElement:TypeDeclaration");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("Keyword: TypeDeclaration:\'type\'");
|
||||
|
|
|
@ -54,6 +54,8 @@ public class CompletionTest extends AbstractTestLangLanguageServerTest {
|
|||
final Procedure1<TestCompletionConfiguration> _function = (TestCompletionConfiguration it) -> {
|
||||
it.setModel("");
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package -> package [[0, 0] .. [0, 0]]");
|
||||
_builder.newLine();
|
||||
_builder.append("type -> type [[0, 0] .. [0, 0]]");
|
||||
_builder.newLine();
|
||||
_builder.append("Sample Snippet -> type ${1|A,B,C|} {");
|
||||
|
@ -202,6 +204,8 @@ public class CompletionTest extends AbstractTestLangLanguageServerTest {
|
|||
it.setLine(1);
|
||||
it.setColumn(0);
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("(Keyword) package -> package [[1, 0] .. [1, 0]]");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("(Keyword) type -> type [[1, 0] .. [1, 0]]");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("(Snippet|Snippet) Sample Snippet -> type ${1|A,B,C|} {");
|
||||
|
|
|
@ -0,0 +1,403 @@
|
|||
/**
|
||||
* Copyright (c) 2019 TypeFox 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.server;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import org.eclipse.lsp4j.ClientCapabilities;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.RenameCapabilities;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
import org.eclipse.xtext.ide.server.UriExtensions;
|
||||
import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class PrepareRenameTest extends AbstractTestLangLanguageServerTest {
|
||||
@Inject
|
||||
@Extension
|
||||
private UriExtensions _uriExtensions;
|
||||
|
||||
@Test
|
||||
public void testRenameFqn_missing_file_null() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("missing.");
|
||||
_builder.append(this.fileExtension);
|
||||
final String uri = this._uriExtensions.toUriString(new File(_builder.toString()).toURI().normalize());
|
||||
this.initializeWithPrepareSupport();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 5);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Does not matter");
|
||||
Assert.assertNull(this.languageServer.rename(params).get());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_missing_file_null() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("missing.");
|
||||
_builder.append(this.fileExtension);
|
||||
final String uri = this._uriExtensions.toUriString(new File(_builder.toString()).toURI().normalize());
|
||||
this.initializeWithPrepareSupport();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 5);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
Assert.assertNull(this.languageServer.prepareRename(params).get());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_missing_file_exception() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("missing.");
|
||||
_builder.append(this.fileExtension);
|
||||
final String uri = this._uriExtensions.toUriString(new File(_builder.toString()).toURI().normalize());
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 5);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
try {
|
||||
Assert.assertNull(this.languageServer.prepareRename(params).get());
|
||||
Assert.fail("Expected an error.");
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Exception) {
|
||||
final Exception e = (Exception)_t;
|
||||
Throwable _rootCause = Throwables.getRootCause(e);
|
||||
Assert.assertTrue((_rootCause instanceof FileNotFoundException));
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenameFqn_invalid_error() {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String uri = this.writeFile("my-type-invalid.testlang", _builder);
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 5);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Does not matter");
|
||||
try {
|
||||
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("Expected an expcetion when trying to rename document but got a valid workspace edit instead: ");
|
||||
_builder_1.append(workspaceEdit);
|
||||
Assert.fail(_builder_1.toString());
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Exception) {
|
||||
final Exception e = (Exception)_t;
|
||||
final Throwable rootCause = Throwables.getRootCause(e);
|
||||
Assert.assertTrue((rootCause instanceof ResponseErrorException));
|
||||
final ResponseError error = ((ResponseErrorException) rootCause).getResponseError();
|
||||
Assert.assertTrue(error.getData().toString().contains("No element found at position"));
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenameFqn_invalid_null() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String uri = this.writeFile("my-type-invalid.testlang", _builder);
|
||||
this.initializeWithPrepareSupport();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 5);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Does not matter");
|
||||
Assert.assertNull(this.languageServer.rename(params).get());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenameFqn_before_ok() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", _builder);
|
||||
this.initializeWithPrepareSupport();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 13);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "YourType");
|
||||
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("changes :");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("my-type-valid.testlang : foo.bar.YourType [[2, 4] .. [2, 18]]");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("YourType [[4, 7] .. [4, 13]]");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("documentChanges : ");
|
||||
_builder_1.newLine();
|
||||
this.assertEquals(_builder_1.toString(), this.toExpectation(workspaceEdit));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_before_nok() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String model = _builder.toString();
|
||||
this.initializeWithPrepareSupport();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", model);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 11);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
Assert.assertNull(this.languageServer.prepareRename(params).get());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_start_ok() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String model = _builder.toString();
|
||||
this.initializeWithPrepareSupport();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", model);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 12);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
final Range range = this.languageServer.prepareRename(params).get().getLeft();
|
||||
this.assertEquals("MyType", new Document(Integer.valueOf(0), model).getSubstring(range));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_in_ok() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String model = _builder.toString();
|
||||
this.initializeWithPrepareSupport();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", model);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 14);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
final Range range = this.languageServer.prepareRename(params).get().getLeft();
|
||||
this.assertEquals("MyType", new Document(Integer.valueOf(0), model).getSubstring(range));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_end_ok() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String model = _builder.toString();
|
||||
this.initializeWithPrepareSupport();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", model);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 18);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
final Range range = this.languageServer.prepareRename(params).get().getLeft();
|
||||
this.assertEquals("MyType", new Document(Integer.valueOf(0), model).getSubstring(range));
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareRenameFqn_end_null() {
|
||||
try {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("package foo.bar {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type A {");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("foo.bar.MyType bar");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
_builder.append(" ");
|
||||
_builder.append("type MyType { }");
|
||||
_builder.newLine();
|
||||
_builder.append("}");
|
||||
_builder.newLine();
|
||||
final String model = _builder.toString();
|
||||
this.initialize();
|
||||
final String uri = this.writeFile("my-type-valid.testlang", model);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
|
||||
Position _position = new Position(2, 18);
|
||||
final TextDocumentPositionParams params = new TextDocumentPositionParams(_textDocumentIdentifier, _position);
|
||||
Assert.assertNull(this.languageServer.prepareRename(params).get());
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
private InitializeResult initializeWithPrepareSupport() {
|
||||
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
|
||||
ClientCapabilities _clientCapabilities = new ClientCapabilities();
|
||||
final Procedure1<ClientCapabilities> _function_1 = (ClientCapabilities it_1) -> {
|
||||
TextDocumentClientCapabilities _textDocumentClientCapabilities = new TextDocumentClientCapabilities();
|
||||
final Procedure1<TextDocumentClientCapabilities> _function_2 = (TextDocumentClientCapabilities it_2) -> {
|
||||
RenameCapabilities _renameCapabilities = new RenameCapabilities();
|
||||
final Procedure1<RenameCapabilities> _function_3 = (RenameCapabilities it_3) -> {
|
||||
it_3.setPrepareSupport(Boolean.valueOf(true));
|
||||
};
|
||||
RenameCapabilities _doubleArrow = ObjectExtensions.<RenameCapabilities>operator_doubleArrow(_renameCapabilities, _function_3);
|
||||
it_2.setRename(_doubleArrow);
|
||||
};
|
||||
TextDocumentClientCapabilities _doubleArrow = ObjectExtensions.<TextDocumentClientCapabilities>operator_doubleArrow(_textDocumentClientCapabilities, _function_2);
|
||||
it_1.setTextDocument(_doubleArrow);
|
||||
};
|
||||
ClientCapabilities _doubleArrow = ObjectExtensions.<ClientCapabilities>operator_doubleArrow(_clientCapabilities, _function_1);
|
||||
it.setCapabilities(_doubleArrow);
|
||||
};
|
||||
return this.initialize(_function);
|
||||
}
|
||||
}
|
|
@ -7,16 +7,27 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.tests.server;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.eclipse.lsp4j.ClientCapabilities;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PrepareRenameResult;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.RenameCapabilities;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -88,21 +99,25 @@ public class RenamePositionTest extends AbstractLanguageServerTest {
|
|||
protected void renameAndFail(final String model, final Position position, final String messageFragment) {
|
||||
final String modelFile = this.writeFile("MyType.testlang", model);
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(modelFile);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, position, "Tescht");
|
||||
try {
|
||||
this.languageServer.rename(params).get();
|
||||
final TextDocumentIdentifier identifier = new TextDocumentIdentifier(modelFile);
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(identifier, position);
|
||||
final Either<Range, PrepareRenameResult> prepareRenameResult = this.languageServer.prepareRename(_textDocumentPositionParams).get();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("expected null result got ");
|
||||
_builder.append(prepareRenameResult);
|
||||
_builder.append(" instead");
|
||||
Assert.assertNull(_builder.toString(), prepareRenameResult);
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(modelFile);
|
||||
final RenameParams renameParams = new RenameParams(_textDocumentIdentifier, position, "Tescht");
|
||||
this.languageServer.rename(renameParams).get();
|
||||
Assert.fail("Rename should have failed");
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof Exception) {
|
||||
final Exception exc = (Exception)_t;
|
||||
Assert.assertTrue((exc instanceof ExecutionException));
|
||||
Throwable _cause = exc.getCause();
|
||||
Assert.assertTrue((_cause instanceof ExecutionException));
|
||||
Throwable _cause_1 = exc.getCause().getCause();
|
||||
Assert.assertTrue((_cause_1 instanceof ResponseErrorException));
|
||||
Throwable _cause_2 = exc.getCause().getCause();
|
||||
final ResponseError error = ((ResponseErrorException) _cause_2).getResponseError();
|
||||
final Throwable rootCause = Throwables.getRootCause(exc);
|
||||
Assert.assertTrue((rootCause instanceof ResponseErrorException));
|
||||
final ResponseError error = ((ResponseErrorException) rootCause).getResponseError();
|
||||
Assert.assertTrue(error.getData().toString().contains(messageFragment));
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
|
@ -113,9 +128,31 @@ public class RenamePositionTest extends AbstractLanguageServerTest {
|
|||
protected void renameWithSuccess(final String model, final Position position) {
|
||||
try {
|
||||
final String modelFile = this.writeFile("MyType.testlang", model);
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(modelFile);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, position, "Tescht");
|
||||
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
|
||||
ClientCapabilities _clientCapabilities = new ClientCapabilities();
|
||||
final Procedure1<ClientCapabilities> _function_1 = (ClientCapabilities it_1) -> {
|
||||
TextDocumentClientCapabilities _textDocumentClientCapabilities = new TextDocumentClientCapabilities();
|
||||
final Procedure1<TextDocumentClientCapabilities> _function_2 = (TextDocumentClientCapabilities it_2) -> {
|
||||
RenameCapabilities _renameCapabilities = new RenameCapabilities();
|
||||
final Procedure1<RenameCapabilities> _function_3 = (RenameCapabilities it_3) -> {
|
||||
it_3.setPrepareSupport(Boolean.valueOf(true));
|
||||
};
|
||||
RenameCapabilities _doubleArrow = ObjectExtensions.<RenameCapabilities>operator_doubleArrow(_renameCapabilities, _function_3);
|
||||
it_2.setRename(_doubleArrow);
|
||||
};
|
||||
TextDocumentClientCapabilities _doubleArrow = ObjectExtensions.<TextDocumentClientCapabilities>operator_doubleArrow(_textDocumentClientCapabilities, _function_2);
|
||||
it_1.setTextDocument(_doubleArrow);
|
||||
};
|
||||
ClientCapabilities _doubleArrow = ObjectExtensions.<ClientCapabilities>operator_doubleArrow(_clientCapabilities, _function_1);
|
||||
it.setCapabilities(_doubleArrow);
|
||||
};
|
||||
this.initialize(_function);
|
||||
final TextDocumentIdentifier identifier = new TextDocumentIdentifier(modelFile);
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(identifier, position);
|
||||
final Range range = this.languageServer.prepareRename(_textDocumentPositionParams).get().getLeft();
|
||||
Assert.assertNotNull(range);
|
||||
this.assertEquals(new Document(Integer.valueOf(0), model).getSubstring(range), "Test");
|
||||
final RenameParams params = new RenameParams(identifier, position, "Tescht");
|
||||
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("changes :");
|
||||
|
|
|
@ -11,12 +11,17 @@ import org.eclipse.lsp4j.ClientCapabilities;
|
|||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.RenameCapabilities;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.WorkspaceClientCapabilities;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.WorkspaceEditCapabilities;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
import org.eclipse.xtext.testing.AbstractLanguageServerTest;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
|
@ -49,9 +54,12 @@ public class RenameTest2 extends AbstractLanguageServerTest {
|
|||
final String model = _builder.toString();
|
||||
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
|
||||
Position _position = new Position(2, 9);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Bar");
|
||||
final TextDocumentIdentifier identifier = new TextDocumentIdentifier(file);
|
||||
final Position position = new Position(2, 9);
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(identifier, position);
|
||||
final Range range = this.languageServer.prepareRename(_textDocumentPositionParams).get().getLeft();
|
||||
this.assertEquals("Foo", new Document(Integer.valueOf(0), model).getSubstring(range));
|
||||
final RenameParams params = new RenameParams(identifier, position, "Bar");
|
||||
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("changes :");
|
||||
|
@ -99,9 +107,12 @@ public class RenameTest2 extends AbstractLanguageServerTest {
|
|||
final String model = _builder.toString();
|
||||
final String file = this.writeFile("foo/Foo.fileawaretestlanguage", model);
|
||||
this.initialize();
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(file);
|
||||
Position _position = new Position(2, 9);
|
||||
final RenameParams params = new RenameParams(_textDocumentIdentifier, _position, "Baz");
|
||||
final TextDocumentIdentifier identifier = new TextDocumentIdentifier(file);
|
||||
final Position position = new Position(2, 9);
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams(identifier, position);
|
||||
final Range range = this.languageServer.prepareRename(_textDocumentPositionParams).get().getLeft();
|
||||
this.assertEquals("Foo", new Document(Integer.valueOf(0), model).getSubstring(range));
|
||||
final RenameParams params = new RenameParams(identifier, position, "Baz");
|
||||
final WorkspaceEdit workspaceEdit = this.languageServer.rename(params).get();
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("changes :");
|
||||
|
@ -139,6 +150,17 @@ public class RenameTest2 extends AbstractLanguageServerTest {
|
|||
};
|
||||
WorkspaceClientCapabilities _doubleArrow = ObjectExtensions.<WorkspaceClientCapabilities>operator_doubleArrow(_workspaceClientCapabilities, _function_2);
|
||||
it.setWorkspace(_doubleArrow);
|
||||
TextDocumentClientCapabilities _textDocumentClientCapabilities = new TextDocumentClientCapabilities();
|
||||
final Procedure1<TextDocumentClientCapabilities> _function_3 = (TextDocumentClientCapabilities it_1) -> {
|
||||
RenameCapabilities _renameCapabilities = new RenameCapabilities();
|
||||
final Procedure1<RenameCapabilities> _function_4 = (RenameCapabilities it_2) -> {
|
||||
it_2.setPrepareSupport(Boolean.valueOf(true));
|
||||
};
|
||||
RenameCapabilities _doubleArrow_1 = ObjectExtensions.<RenameCapabilities>operator_doubleArrow(_renameCapabilities, _function_4);
|
||||
it_1.setRename(_doubleArrow_1);
|
||||
};
|
||||
TextDocumentClientCapabilities _doubleArrow_1 = ObjectExtensions.<TextDocumentClientCapabilities>operator_doubleArrow(_textDocumentClientCapabilities, _function_3);
|
||||
it.setTextDocument(_doubleArrow_1);
|
||||
};
|
||||
ClientCapabilities _doubleArrow = ObjectExtensions.<ClientCapabilities>operator_doubleArrow(_clientCapabilities, _function_1);
|
||||
params.setCapabilities(_doubleArrow);
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.eclipse.xtext.ide.tests.testlanguage;
|
|||
|
||||
import org.eclipse.xtext.formatting2.IFormatter2;
|
||||
import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator;
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IReferenceUpdater;
|
||||
import org.eclipse.xtext.ide.server.coloring.IColoringService;
|
||||
import org.eclipse.xtext.ide.server.semanticHighlight.ISemanticHighlightingStyleToTokenMapper;
|
||||
import org.eclipse.xtext.ide.server.signatureHelp.ISignatureHelpService;
|
||||
|
@ -17,6 +18,7 @@ import org.eclipse.xtext.ide.tests.testlanguage.coloring.ColoringServiceImpl;
|
|||
import org.eclipse.xtext.ide.tests.testlanguage.editor.syntaxcoloring.SemanticHighlightingCalculatorImpl;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.editor.syntaxcoloring.SemanticHighlightingStyleToTokenMapper;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.formatting2.TestLanguageFormatter;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.serializer.TestLanguageReferenceUpdater;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.signatureHelp.SignatureHelpServiceImpl;
|
||||
|
||||
/**
|
||||
|
@ -43,4 +45,8 @@ public class TestLanguageRuntimeModule extends AbstractTestLanguageRuntimeModule
|
|||
public Class<? extends ISemanticHighlightingStyleToTokenMapper> bindISemanticHighlightingStyleToTokenMapper() {
|
||||
return SemanticHighlightingStyleToTokenMapper.class;
|
||||
}
|
||||
|
||||
public Class<? extends IReferenceUpdater> bindIReferenceUpdater() {
|
||||
return TestLanguageReferenceUpdater.class;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class SemanticHighlightingCalculatorImpl extends DefaultSemanticHighlight
|
|||
}
|
||||
|
||||
protected boolean _doHighlightElement(final TypeDeclaration it, final IHighlightedPositionAcceptor acceptor) {
|
||||
return this.doHighlightNode(acceptor, it, TestLanguagePackage.Literals.TYPE_DECLARATION__NAME, SemanticHighlightingCalculatorImpl.TYPE_DECLARATION_STYLE);
|
||||
return this.doHighlightNode(acceptor, it, TestLanguagePackage.Literals.ABSTRACT_ELEMENT__NAME, SemanticHighlightingCalculatorImpl.TYPE_DECLARATION_STYLE);
|
||||
}
|
||||
|
||||
protected boolean _doHighlightElement(final PrimitiveType it, final IHighlightedPositionAcceptor acceptor) {
|
||||
|
@ -135,12 +135,12 @@ public class SemanticHighlightingCalculatorImpl extends DefaultSemanticHighlight
|
|||
return _doHighlightElement((PrimitiveType)it, acceptor);
|
||||
} else if (it instanceof Property) {
|
||||
return _doHighlightElement((Property)it, acceptor);
|
||||
} else if (it instanceof TypeDeclaration) {
|
||||
return _doHighlightElement((TypeDeclaration)it, acceptor);
|
||||
} else if (it instanceof TypeReference) {
|
||||
return _doHighlightElement((TypeReference)it, acceptor);
|
||||
} else if (it instanceof Parameter) {
|
||||
return _doHighlightElement((Parameter)it, acceptor);
|
||||
} else if (it instanceof TypeDeclaration) {
|
||||
return _doHighlightElement((TypeDeclaration)it, acceptor);
|
||||
} else if (it != null) {
|
||||
return _doHighlightElement(it, acceptor);
|
||||
} else {
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.xtext.formatting2.IFormattableDocument;
|
|||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.services.TestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.AbstractElement;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Model;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
|
||||
|
@ -34,9 +35,9 @@ public class TestLanguageFormatter extends AbstractFormatter2 {
|
|||
private TestLanguageGrammarAccess _testLanguageGrammarAccess;
|
||||
|
||||
protected void _format(final Model model, @Extension final IFormattableDocument document) {
|
||||
EList<TypeDeclaration> _types = model.getTypes();
|
||||
for (final TypeDeclaration type : _types) {
|
||||
document.<TypeDeclaration>format(type);
|
||||
EList<AbstractElement> _elements = model.getElements();
|
||||
for (final AbstractElement type : _elements) {
|
||||
document.<AbstractElement>format(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,12 +79,12 @@ public class TestLanguageFormatter extends AbstractFormatter2 {
|
|||
} else if (property instanceof Property) {
|
||||
_format((Property)property, document);
|
||||
return;
|
||||
} else if (property instanceof Model) {
|
||||
_format((Model)property, document);
|
||||
return;
|
||||
} else if (property instanceof TypeDeclaration) {
|
||||
_format((TypeDeclaration)property, document);
|
||||
return;
|
||||
} else if (property instanceof Model) {
|
||||
_format((Model)property, document);
|
||||
return;
|
||||
} else if (property instanceof EObject) {
|
||||
_format((EObject)property, document);
|
||||
return;
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.xtext.ide.server.codeActions.ICodeActionService2;
|
|||
import org.eclipse.xtext.ide.server.codelens.ICodeLensResolver;
|
||||
import org.eclipse.xtext.ide.server.codelens.ICodeLensService;
|
||||
import org.eclipse.xtext.ide.server.commands.IExecutableCommandService;
|
||||
import org.eclipse.xtext.ide.server.rename.IRenameService2;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.AbstractTestLanguageIdeModule;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLangLSPExtension;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageExecutableCommandService;
|
||||
|
@ -21,6 +22,7 @@ import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeContentPropos
|
|||
import org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageProposalCreator;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.server.CodeActionService;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.ide.server.CodeLensService;
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.rename.TestLanguageRenameService;
|
||||
|
||||
/**
|
||||
* Use this class to register ide components.
|
||||
|
@ -54,4 +56,9 @@ public class TestLanguageIdeModule extends AbstractTestLanguageIdeModule {
|
|||
public Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
|
||||
return TestLanguageIdeContentProposalProvider.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IRenameService2> bindIRenameService2() {
|
||||
return TestLanguageRenameService.class;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* Copyright (c) 2019 TypeFox (http://www.itemis.eu) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.ide.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionDiffBuilder;
|
||||
import org.eclipse.xtext.ide.serializer.hooks.IUpdatableReference;
|
||||
import org.eclipse.xtext.ide.serializer.impl.ReferenceUpdater;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameConverter;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding;
|
||||
|
||||
/**
|
||||
* Customized reference updater to handle FQN renaming gracefully.
|
||||
*
|
||||
* <p>
|
||||
* When renaming {@code Foo} to {@code Bar}, it follows the default logic,
|
||||
* but when renaming {@code my.type.Foo} to {@code Bar}, it will result
|
||||
* in {@code my.type.Bar} instead of {@code Bar}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class TestLanguageReferenceUpdater extends ReferenceUpdater {
|
||||
@Inject
|
||||
private IQualifiedNameConverter nameConverter;
|
||||
|
||||
@Inject
|
||||
@SerializerScopeProviderBinding
|
||||
private IScopeProvider scopeProvider;
|
||||
|
||||
@Override
|
||||
public void updateReference(final ITextRegionDiffBuilder rewriter, final IUpdatableReference it) {
|
||||
boolean _isModified = rewriter.isModified(it.getReferenceRegion());
|
||||
if (_isModified) {
|
||||
return;
|
||||
}
|
||||
final IScope scope = this.scopeProvider.getScope(it.getSourceEObject(), it.getEReference());
|
||||
final ISemanticRegion region = it.getReferenceRegion();
|
||||
final QualifiedName oldName = this.nameConverter.toQualifiedName(region.getText());
|
||||
final IEObjectDescription oldDesc = scope.getSingleElement(oldName);
|
||||
if (((oldDesc != null) && (oldDesc.getEObjectOrProxy() == it.getTargetEObject()))) {
|
||||
return;
|
||||
}
|
||||
String newName = this.findValidName(it, scope);
|
||||
if ((newName != null)) {
|
||||
int _segmentCount = oldName.getSegmentCount();
|
||||
boolean _greaterThan = (_segmentCount > 1);
|
||||
if (_greaterThan) {
|
||||
newName = oldName.skipLast(1).append(newName).toString();
|
||||
}
|
||||
rewriter.replace(region, newName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.common.util.ECollections;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.lsp4j.CodeAction;
|
||||
|
@ -103,8 +102,8 @@ public class CodeActionService implements ICodeActionService2 {
|
|||
private CodeAction fixUnsortedMembers(final Diagnostic d, final ICodeActionService2.Options options) {
|
||||
final IChangeSerializer.IModification<Resource> _function = (Resource copiedResource) -> {
|
||||
final Model model = IterableExtensions.<Model>head(Iterables.<Model>filter(copiedResource.getContents(), Model.class));
|
||||
EList<TypeDeclaration> _types = model.getTypes();
|
||||
for (final TypeDeclaration type : _types) {
|
||||
Iterable<TypeDeclaration> _filter = Iterables.<TypeDeclaration>filter(model.getElements(), TypeDeclaration.class);
|
||||
for (final TypeDeclaration type : _filter) {
|
||||
final Comparator<Member> _function_1 = (Member a, Member b) -> {
|
||||
String _name = a.getName();
|
||||
String _name_1 = b.getName();
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* Copyright (c) 2019 TypeFox and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.ide.tests.testlanguage.rename;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.ide.server.rename.RenameService2;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class TestLanguageRenameService extends RenameService2 {
|
||||
@Inject
|
||||
@Extension
|
||||
private EObjectAtOffsetHelper _eObjectAtOffsetHelper;
|
||||
|
||||
@Override
|
||||
protected EObject getElementWithIdentifierAt(final XtextResource xtextResource, final int offset) {
|
||||
if ((offset >= 0)) {
|
||||
IParseResult _parseResult = null;
|
||||
if (xtextResource!=null) {
|
||||
_parseResult=xtextResource.getParseResult();
|
||||
}
|
||||
ICompositeNode _rootNode = null;
|
||||
if (_parseResult!=null) {
|
||||
_rootNode=_parseResult.getRootNode();
|
||||
}
|
||||
final ICompositeNode rootNode = _rootNode;
|
||||
if ((rootNode != null)) {
|
||||
final ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, offset);
|
||||
if (((leaf != null) && this.isIdentifier(leaf))) {
|
||||
final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(xtextResource, offset);
|
||||
if ((element != null)) {
|
||||
final IQualifiedNameProvider nameProvider = xtextResource.getResourceServiceProvider().<IQualifiedNameProvider>get(IQualifiedNameProvider.class);
|
||||
final QualifiedName fqn = nameProvider.getFullyQualifiedName(element);
|
||||
if ((fqn != null)) {
|
||||
final String leafText = NodeModelUtils.getTokenText(leaf);
|
||||
if ((((fqn.getSegmentCount() == 1) && Objects.equal(fqn.toString(), leafText)) || Objects.equal(fqn.getLastSegment(), leafText))) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ public class TestLanguageValidator extends AbstractTestLanguageValidator {
|
|||
boolean _not = (!_isUpperCase);
|
||||
if (_not) {
|
||||
this.warning("Name should start with a capital",
|
||||
TestLanguagePackage.Literals.TYPE_DECLARATION__NAME,
|
||||
TestLanguagePackage.Literals.ABSTRACT_ELEMENT__NAME,
|
||||
TestLanguageValidator.INVALID_NAME);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class TestLanguageValidator extends AbstractTestLanguageValidator {
|
|||
if (_notEquals) {
|
||||
this.warning(
|
||||
"Members should be in alphabetic order.",
|
||||
TestLanguagePackage.Literals.TYPE_DECLARATION__NAME,
|
||||
TestLanguagePackage.Literals.ABSTRACT_ELEMENT__NAME,
|
||||
TestLanguageValidator.UNSORTED_MEMBERS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.emf.common.util.URI
|
|||
import org.eclipse.emf.ecore.resource.Resource
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet
|
||||
import org.eclipse.lsp4j.InitializeParams
|
||||
import org.eclipse.lsp4j.InitializeResult
|
||||
import org.eclipse.lsp4j.services.LanguageClient
|
||||
import org.eclipse.xtend.lib.annotations.Data
|
||||
import org.eclipse.xtext.ide.serializer.IChangeSerializer
|
||||
|
@ -89,6 +90,13 @@ interface ILanguageServerAccess {
|
|||
* @since 2.18
|
||||
*/
|
||||
def InitializeParams getInitializeParams();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns with the {@link InitializeResult} of the LS.
|
||||
*
|
||||
* @since 2.18
|
||||
*/
|
||||
def InitializeResult getInitializeResult();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.eclipse.lsp4j.Position
|
|||
import org.eclipse.lsp4j.PublishDiagnosticsParams
|
||||
import org.eclipse.lsp4j.Range
|
||||
import org.eclipse.lsp4j.ReferenceParams
|
||||
import org.eclipse.lsp4j.RenameOptions
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.SemanticHighlightingServerCapabilities
|
||||
import org.eclipse.lsp4j.ServerCapabilities
|
||||
|
@ -90,6 +91,7 @@ import org.eclipse.xtext.ide.server.hover.IHoverService
|
|||
import org.eclipse.xtext.ide.server.occurrences.IDocumentHighlightService
|
||||
import org.eclipse.xtext.ide.server.rename.IRenameService
|
||||
import org.eclipse.xtext.ide.server.rename.IRenameService2
|
||||
import org.eclipse.xtext.ide.server.rename.IRenameService2.PrepareRenameOptions
|
||||
import org.eclipse.xtext.ide.server.semanticHighlight.SemanticHighlightingRegistry
|
||||
import org.eclipse.xtext.ide.server.signatureHelp.ISignatureHelpService
|
||||
import org.eclipse.xtext.ide.server.symbol.DocumentSymbolService
|
||||
|
@ -123,6 +125,7 @@ import static org.eclipse.xtext.diagnostics.Severity.*
|
|||
// injected below
|
||||
WorkspaceManager workspaceManager
|
||||
InitializeParams params
|
||||
InitializeResult initializeResult
|
||||
CompletableFuture<InitializedParams> initialized = new CompletableFuture
|
||||
|
||||
@Inject
|
||||
|
@ -174,7 +177,14 @@ import static org.eclipse.xtext.diagnostics.Severity.*
|
|||
documentFormattingProvider = true
|
||||
documentRangeFormattingProvider = true
|
||||
documentHighlightProvider = true
|
||||
renameProvider = allLanguages.exists[get(IRenameService) !== null || get(IRenameService2) !== null]
|
||||
val clientPrepareSupport = Boolean.TRUE == params?.capabilities?.textDocument?.rename?.prepareSupport
|
||||
renameProvider = if (clientPrepareSupport && allLanguages.exists[get(IRenameService2) !== null]) {
|
||||
Either.forRight(new RenameOptions => [
|
||||
prepareProvider = true
|
||||
])
|
||||
} else {
|
||||
Either.forLeft(allLanguages.exists[get(IRenameService) !== null || get(IRenameService2) !== null])
|
||||
}
|
||||
|
||||
val clientCapabilities = params.capabilities;
|
||||
// register execute command capability
|
||||
|
@ -199,7 +209,10 @@ import static org.eclipse.xtext.diagnostics.Severity.*
|
|||
return requestManager.runWrite([
|
||||
workspaceManager.initialize(baseDir, [this.publishDiagnostics($0, $1)], CancelIndicator.NullImpl)
|
||||
return null
|
||||
], []).thenApply [result]
|
||||
], []).thenApply [
|
||||
this.initializeResult = result
|
||||
return result
|
||||
]
|
||||
}
|
||||
|
||||
override void initialized(InitializedParams params) {
|
||||
|
@ -638,7 +651,26 @@ import static org.eclipse.xtext.diagnostics.Severity.*
|
|||
return new WorkspaceEdit
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.18
|
||||
*/
|
||||
override prepareRename(TextDocumentPositionParams params) {
|
||||
return requestManager.runRead [ cancelIndicator |
|
||||
val uri = params.textDocument.uri.toUri
|
||||
val resourceServiceProvider = uri.resourceServiceProvider
|
||||
val renameService = resourceServiceProvider?.get(IRenameService2)
|
||||
if (renameService === null) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
renameService.prepareRename(new PrepareRenameOptions => [
|
||||
it.languageServerAccess = access
|
||||
it.params = params
|
||||
it.cancelIndicator = cancelIndicator
|
||||
])
|
||||
]
|
||||
}
|
||||
|
||||
override notify(String method, Object parameter) {
|
||||
for (endpoint : extensionProviders.get(method)) {
|
||||
try {
|
||||
|
@ -746,6 +778,10 @@ import static org.eclipse.xtext.diagnostics.Severity.*
|
|||
]
|
||||
}
|
||||
|
||||
override getInitializeResult() {
|
||||
initializeResult
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override afterBuild(List<Delta> deltas) {
|
||||
|
|
|
@ -7,12 +7,16 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.server.rename
|
||||
|
||||
import org.eclipse.lsp4j.PrepareRenameResult
|
||||
import org.eclipse.lsp4j.Range
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.lsp4j.WorkspaceEdit
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.ide.server.ILanguageServerAccess
|
||||
import org.eclipse.xtext.ide.server.WorkspaceManager
|
||||
import org.eclipse.xtext.util.CancelIndicator
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
|
@ -21,25 +25,51 @@ import org.eclipse.xtend.lib.annotations.Accessors
|
|||
*/
|
||||
@Deprecated
|
||||
interface IRenameService {
|
||||
|
||||
@Deprecated
|
||||
|
||||
@Deprecated
|
||||
def WorkspaceEdit rename(WorkspaceManager workspaceManager, RenameParams renameParams, CancelIndicator cancelIndicator)
|
||||
}
|
||||
|
||||
/**
|
||||
* Service called for rename refactoring.
|
||||
* Service called for rename refactoring.
|
||||
*
|
||||
* @author koehnlein - Initial contribution and API
|
||||
* @since 2.18
|
||||
*/
|
||||
interface IRenameService2 {
|
||||
|
||||
|
||||
def WorkspaceEdit rename(Options options)
|
||||
|
||||
|
||||
/**
|
||||
* Returns a {@link Range range} describing the range of the string to rename and optionally a placeholder text of
|
||||
* the string content to be renamed.
|
||||
*
|
||||
* <p>
|
||||
* If {@code null} is returned then it is deemed that invoking {@link #rename rename} with the same text document
|
||||
* position will not result in a valid {@link WorkspaceEdit workspace edit}.
|
||||
*
|
||||
* <p>
|
||||
* The default implementation only checks whether there is an identifier under the give text document position or not.
|
||||
*
|
||||
* <p>
|
||||
* This method should be used to set up and to test the validity of a rename operation at a given location.</br>
|
||||
* See <a href="https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareRename">{@code textDocument/prepareRename}</a> for more details.
|
||||
*
|
||||
*/
|
||||
def Either<Range, PrepareRenameResult> prepareRename(PrepareRenameOptions options)
|
||||
|
||||
@Accessors
|
||||
class Options {
|
||||
ILanguageServerAccess languageServerAccess
|
||||
RenameParams renameParams
|
||||
CancelIndicator cancelIndicator
|
||||
}
|
||||
|
||||
@Accessors
|
||||
class PrepareRenameOptions {
|
||||
ILanguageServerAccess languageServerAccess
|
||||
TextDocumentPositionParams params
|
||||
CancelIndicator cancelIndicator
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,23 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.ide.server.rename
|
||||
|
||||
import com.google.common.base.Function
|
||||
import com.google.common.base.Throwables
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Provider
|
||||
import java.io.FileNotFoundException
|
||||
import org.eclipse.emf.ecore.EAttribute
|
||||
import org.eclipse.emf.ecore.EObject
|
||||
import org.eclipse.emf.ecore.resource.Resource
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil
|
||||
import org.eclipse.lsp4j.Position
|
||||
import org.eclipse.lsp4j.PrepareRenameResult
|
||||
import org.eclipse.lsp4j.Range
|
||||
import org.eclipse.lsp4j.RenameParams
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.lsp4j.WorkspaceEdit
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.CrossReference
|
||||
import org.eclipse.xtext.RuleCall
|
||||
|
@ -21,48 +32,74 @@ import org.eclipse.xtext.ide.refactoring.RenameChange
|
|||
import org.eclipse.xtext.ide.refactoring.RenameContext
|
||||
import org.eclipse.xtext.ide.serializer.IChangeSerializer
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.xtext.ide.server.ILanguageServerAccess
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils
|
||||
import org.eclipse.xtext.parsetree.reconstr.impl.TokenUtil
|
||||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
import org.eclipse.xtext.util.CancelIndicator
|
||||
import org.eclipse.xtext.util.SimpleAttributeResolver
|
||||
import org.eclipse.xtext.util.Strings
|
||||
import org.eclipse.xtext.util.internal.Log
|
||||
|
||||
import static org.eclipse.xtext.ide.refactoring.RefactoringIssueAcceptor.Severity.*
|
||||
|
||||
import static extension org.eclipse.lsp4j.util.Ranges.*
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
* @since 2.18
|
||||
*/
|
||||
@Log
|
||||
@Accessors(PROTECTED_GETTER)
|
||||
class RenameService2 implements IRenameService2 {
|
||||
|
||||
|
||||
@Inject extension EObjectAtOffsetHelper eObjectAtOffsetHelper
|
||||
|
||||
|
||||
@Inject Provider<ServerRefactoringIssueAcceptor> issueProvider
|
||||
|
||||
|
||||
@Inject IResourceServiceProvider.Registry serviceProviderRegistry
|
||||
|
||||
@Inject TokenUtil tokenUtil
|
||||
|
||||
|
||||
Function<EObject, String> attributeResolver = SimpleAttributeResolver.newResolver(String, 'name')
|
||||
|
||||
override rename(Options options) {
|
||||
val textDocument = options.renameParams.textDocument
|
||||
val uri = textDocument.uri
|
||||
val issueAcceptor = issueProvider.get
|
||||
options.languageServerAccess.doRead(options.renameParams.textDocument.uri) [ context |
|
||||
val shouldPrepareRename = options.languageServerAccess.shouldPrepareRename
|
||||
return options.languageServerAccess.doRead(uri) [ context |
|
||||
|
||||
if (shouldPrepareRename) {
|
||||
val identifier = new TextDocumentIdentifier(textDocument.uri)
|
||||
val position = options.renameParams.position
|
||||
val positionParams = new TextDocumentPositionParams(identifier, position)
|
||||
val resource = context.resource
|
||||
val document = context.document
|
||||
val cancelIndicator = options.cancelIndicator
|
||||
|
||||
val prepareRenameResult = doPrepareRename(resource, document, positionParams, cancelIndicator)
|
||||
if (!mayPerformRename(prepareRenameResult, options.renameParams)) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
val workspaceEdit = new WorkspaceEdit
|
||||
val resourceSet = options.languageServerAccess.newLiveScopeResourceSet(context.resource.URI)
|
||||
val xtextResource = resourceSet.getResource(context.resource.URI, true)
|
||||
if (xtextResource instanceof XtextResource) {
|
||||
var EObject element;
|
||||
val position = options.renameParams.position
|
||||
var EObject element
|
||||
try {
|
||||
element = xtextResource.getElementAtOffset(context.document, options.renameParams.position)
|
||||
element = xtextResource.getElementAtOffset(context.document, position)
|
||||
} catch (IndexOutOfBoundsException exc) {
|
||||
issueAcceptor.add(
|
||||
FATAL, '''Invalid document position line:«options.renameParams.position.line» column:«options.renameParams.position.character»'''
|
||||
)
|
||||
issueAcceptor.add(FATAL, '''Invalid document «position.toPositionFragment(uri)»''')
|
||||
}
|
||||
if (issueAcceptor.maximumSeverity !== FATAL && element === null || element.eIsProxy) {
|
||||
issueAcceptor.add(
|
||||
FATAL, '''No element found at position line:«options.renameParams.position.line» column:«options.renameParams.position.character»''')
|
||||
if (element === null || element.eIsProxy) {
|
||||
issueAcceptor.add(FATAL, '''No element found at «position.toPositionFragment(uri)»''')
|
||||
} else {
|
||||
val services = serviceProviderRegistry.getResourceServiceProvider(element.eResource.URI)
|
||||
val changeSerializer = services.get(IChangeSerializer)
|
||||
|
@ -77,31 +114,142 @@ class RenameService2 implements IRenameService2 {
|
|||
} else {
|
||||
issueAcceptor.add(FATAL, 'Loaded resource is not an XtextResource', context.resource.URI)
|
||||
}
|
||||
issueAcceptor.checkSeverity
|
||||
return workspaceEdit
|
||||
].exceptionally [ exception |
|
||||
val rootCause = Throwables.getRootCause(exception)
|
||||
if (rootCause instanceof FileNotFoundException) {
|
||||
if (shouldPrepareRename) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
throw exception
|
||||
].get
|
||||
}
|
||||
|
||||
protected def EObject getElementAtOffset(XtextResource xtextResource, Document document, Position caretPosition) {
|
||||
val caretOffset = document.getOffSet(caretPosition)
|
||||
return xtextResource.getElementWithIdentifierAt(caretOffset)
|
||||
return xtextResource.getElementWithIdentifierAt(caretOffset)
|
||||
?: xtextResource.getElementWithIdentifierAt(caretOffset - 1)
|
||||
}
|
||||
|
||||
|
||||
protected def getElementWithIdentifierAt(XtextResource xtextResource, int offset) {
|
||||
if (offset >= 0) {
|
||||
val rootNode = xtextResource?.parseResult?.rootNode
|
||||
if (rootNode !== null) {
|
||||
val leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, offset)
|
||||
if (leaf !== null && leaf.isIdentifier) {
|
||||
return xtextResource.resolveElementAt(offset)
|
||||
return xtextResource.resolveElementAt(offset)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
protected def isIdentifier(ILeafNode leafNode) {
|
||||
return (leafNode.grammarElement instanceof RuleCall || leafNode.grammarElement instanceof CrossReference)
|
||||
&& !tokenUtil.isWhitespaceOrCommentNode(leafNode)
|
||||
&& !tokenUtil.isWhitespaceOrCommentNode(leafNode)
|
||||
}
|
||||
|
||||
override prepareRename(PrepareRenameOptions options) {
|
||||
val uri = options.params.textDocument.uri
|
||||
val shouldPrepareRename = options.languageServerAccess.shouldPrepareRename
|
||||
return options.languageServerAccess.doRead(uri) [ context |
|
||||
// We check `shouldPrepareRename` here instead of before the `doRead`
|
||||
// because we still have to propagate the error if the resource is missing.
|
||||
if (!shouldPrepareRename) {
|
||||
return null
|
||||
}
|
||||
val resource = context.resource
|
||||
val document = context.document
|
||||
val params = options.params
|
||||
val cancelIndicator = options.cancelIndicator
|
||||
return doPrepareRename(resource, document, params, cancelIndicator)
|
||||
].exceptionally [ exception |
|
||||
val rootCause = Throwables.getRootCause(exception)
|
||||
if (rootCause instanceof FileNotFoundException) {
|
||||
if (shouldPrepareRename) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
throw exception
|
||||
].get
|
||||
}
|
||||
|
||||
protected def Either<Range, PrepareRenameResult> doPrepareRename(Resource resource, Document document,
|
||||
TextDocumentPositionParams params, CancelIndicator cancelIndicator) {
|
||||
|
||||
val uri = params.textDocument.uri
|
||||
if (resource instanceof XtextResource) {
|
||||
val rootNode = resource?.parseResult?.rootNode
|
||||
if (rootNode === null) {
|
||||
LOG.trace('''Could not retrieve root node for resource. URI: «uri».''')
|
||||
return null
|
||||
}
|
||||
val caretPosition = params.position
|
||||
try {
|
||||
val caretOffset = document.getOffSet(caretPosition)
|
||||
var EObject element
|
||||
var candidateOffset = caretOffset
|
||||
do {
|
||||
element = resource.getElementWithIdentifierAt(candidateOffset)
|
||||
if (element !== null && !element.eIsProxy) {
|
||||
val leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, candidateOffset)
|
||||
if (leaf !== null && leaf.isIdentifier) {
|
||||
val leafText = NodeModelUtils.getTokenText(leaf)
|
||||
val elementName = element.elementName
|
||||
if (!leafText.nullOrEmpty && !elementName.nullOrEmpty && leafText == elementName) {
|
||||
val start = document.getPosition(leaf.offset)
|
||||
val end = document.getPosition(leaf.offset + elementName.length)
|
||||
return Either.forLeft(new Range(start, end))
|
||||
}
|
||||
}
|
||||
}
|
||||
candidateOffset = candidateOffset - 1
|
||||
} while (candidateOffset >= 0 && candidateOffset + 1 >= caretOffset)
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
LOG.trace('''Invalid document «caretPosition.toPositionFragment(uri)»''')
|
||||
return null
|
||||
}
|
||||
LOG.trace('''No element found at «caretPosition.toPositionFragment(uri)»''')
|
||||
} else {
|
||||
LOG.trace('''Loaded resource is not an XtextResource. URI: «resource.URI»''')
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* If this method returns {@code false}, it is sure, that the rename operation will fail.
|
||||
* There is no guarantee that it will succeed even if it returns {@code true}.
|
||||
*/
|
||||
protected def boolean mayPerformRename(Either<Range, PrepareRenameResult> prepareRenameResult,
|
||||
RenameParams renameParams) {
|
||||
|
||||
return prepareRenameResult !== null && prepareRenameResult.getLeft !== null &&
|
||||
prepareRenameResult.getLeft.containsPosition(renameParams.position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to read the {@code name} {@link EAttribute} from the
|
||||
* the given {@code element}.
|
||||
*
|
||||
* It never returns an empty string, but a {@code null} instead.
|
||||
*/
|
||||
protected def getElementName(EObject element) {
|
||||
if (element === null) {
|
||||
return null
|
||||
}
|
||||
val name = attributeResolver.apply(element)
|
||||
return if(Strings.isEmpty(name)) null else name
|
||||
}
|
||||
|
||||
private def toPositionFragment(Position it, String uri) {
|
||||
return '''position line: «line» column: «character» in resource: «uri»'''
|
||||
}
|
||||
|
||||
private def shouldPrepareRename(ILanguageServerAccess access) {
|
||||
val provider = access?.initializeResult?.capabilities?.renameProvider
|
||||
return if(provider !== null && provider.isRight) Boolean.TRUE == provider.getRight.prepareProvider else false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ class ServerRefactoringIssueAcceptor implements RefactoringIssueAcceptor {
|
|||
it.severity = severity
|
||||
it.message = message
|
||||
]
|
||||
checkSeverity
|
||||
}
|
||||
|
||||
protected def boolean addIssue(Severity severity, String message) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.emf.common.util.URI;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.services.LanguageClient;
|
||||
import org.eclipse.xtend.lib.annotations.Data;
|
||||
import org.eclipse.xtext.ide.serializer.IChangeSerializer;
|
||||
|
@ -233,4 +234,11 @@ public interface ILanguageServerAccess {
|
|||
* @since 2.18
|
||||
*/
|
||||
public abstract InitializeParams getInitializeParams();
|
||||
|
||||
/**
|
||||
* Returns with the {@link InitializeResult} of the LS.
|
||||
*
|
||||
* @since 2.18
|
||||
*/
|
||||
public abstract InitializeResult getInitializeResult();
|
||||
}
|
||||
|
|
|
@ -68,9 +68,12 @@ import org.eclipse.lsp4j.InitializedParams;
|
|||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PrepareRenameResult;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.ReferenceParams;
|
||||
import org.eclipse.lsp4j.RenameCapabilities;
|
||||
import org.eclipse.lsp4j.RenameOptions;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.SemanticHighlightingServerCapabilities;
|
||||
import org.eclipse.lsp4j.ServerCapabilities;
|
||||
|
@ -209,6 +212,8 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
|
||||
private InitializeParams params;
|
||||
|
||||
private InitializeResult initializeResult;
|
||||
|
||||
private CompletableFuture<InitializedParams> initialized = new CompletableFuture<InitializedParams>();
|
||||
|
||||
@Inject
|
||||
|
@ -279,10 +284,41 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
it.setDocumentFormattingProvider(Boolean.valueOf(true));
|
||||
it.setDocumentRangeFormattingProvider(Boolean.valueOf(true));
|
||||
it.setDocumentHighlightProvider(Boolean.valueOf(true));
|
||||
final Function1<IResourceServiceProvider, Boolean> _function_5 = (IResourceServiceProvider it_1) -> {
|
||||
return Boolean.valueOf(((it_1.<IRenameService>get(IRenameService.class) != null) || (it_1.<IRenameService2>get(IRenameService2.class) != null)));
|
||||
};
|
||||
it.setRenameProvider(Boolean.valueOf(IterableExtensions.exists(this.getAllLanguages(), _function_5)));
|
||||
ClientCapabilities _capabilities = null;
|
||||
if (params!=null) {
|
||||
_capabilities=params.getCapabilities();
|
||||
}
|
||||
TextDocumentClientCapabilities _textDocument = null;
|
||||
if (_capabilities!=null) {
|
||||
_textDocument=_capabilities.getTextDocument();
|
||||
}
|
||||
RenameCapabilities _rename = null;
|
||||
if (_textDocument!=null) {
|
||||
_rename=_textDocument.getRename();
|
||||
}
|
||||
Boolean _prepareSupport = null;
|
||||
if (_rename!=null) {
|
||||
_prepareSupport=_rename.getPrepareSupport();
|
||||
}
|
||||
final boolean clientPrepareSupport = Objects.equal(Boolean.TRUE, _prepareSupport);
|
||||
Either<Boolean, RenameOptions> _xifexpression = null;
|
||||
if ((clientPrepareSupport && IterableExtensions.exists(this.getAllLanguages(), ((Function1<IResourceServiceProvider, Boolean>) (IResourceServiceProvider it_1) -> {
|
||||
IRenameService2 _get = it_1.<IRenameService2>get(IRenameService2.class);
|
||||
return Boolean.valueOf((_get != null));
|
||||
})))) {
|
||||
RenameOptions _renameOptions = new RenameOptions();
|
||||
final Procedure1<RenameOptions> _function_5 = (RenameOptions it_1) -> {
|
||||
it_1.setPrepareProvider(Boolean.valueOf(true));
|
||||
};
|
||||
RenameOptions _doubleArrow_2 = ObjectExtensions.<RenameOptions>operator_doubleArrow(_renameOptions, _function_5);
|
||||
_xifexpression = Either.<Boolean, RenameOptions>forRight(_doubleArrow_2);
|
||||
} else {
|
||||
final Function1<IResourceServiceProvider, Boolean> _function_6 = (IResourceServiceProvider it_1) -> {
|
||||
return Boolean.valueOf(((it_1.<IRenameService>get(IRenameService.class) != null) || (it_1.<IRenameService2>get(IRenameService2.class) != null)));
|
||||
};
|
||||
_xifexpression = Either.<Boolean, RenameOptions>forLeft(Boolean.valueOf(IterableExtensions.exists(this.getAllLanguages(), _function_6)));
|
||||
}
|
||||
it.setRenameProvider(_xifexpression);
|
||||
final ClientCapabilities clientCapabilities = params.getCapabilities();
|
||||
WorkspaceClientCapabilities _workspace = null;
|
||||
if (clientCapabilities!=null) {
|
||||
|
@ -296,11 +332,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
if (_tripleNotEquals) {
|
||||
this.commandRegistry.initialize(this.getAllLanguages(), clientCapabilities, this.client);
|
||||
ExecuteCommandOptions _executeCommandOptions = new ExecuteCommandOptions();
|
||||
final Procedure1<ExecuteCommandOptions> _function_6 = (ExecuteCommandOptions it_1) -> {
|
||||
final Procedure1<ExecuteCommandOptions> _function_7 = (ExecuteCommandOptions it_1) -> {
|
||||
it_1.setCommands(this.commandRegistry.getCommands());
|
||||
};
|
||||
ExecuteCommandOptions _doubleArrow_2 = ObjectExtensions.<ExecuteCommandOptions>operator_doubleArrow(_executeCommandOptions, _function_6);
|
||||
it.setExecuteCommandProvider(_doubleArrow_2);
|
||||
ExecuteCommandOptions _doubleArrow_3 = ObjectExtensions.<ExecuteCommandOptions>operator_doubleArrow(_executeCommandOptions, _function_7);
|
||||
it.setExecuteCommandProvider(_doubleArrow_3);
|
||||
}
|
||||
this.semanticHighlightingRegistry.initialize(this.getAllLanguages(), clientCapabilities, this.client);
|
||||
List<List<String>> _allScopes = this.semanticHighlightingRegistry.getAllScopes();
|
||||
|
@ -328,6 +364,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return null;
|
||||
};
|
||||
final Function<Object, InitializeResult> _function_3 = (Object it) -> {
|
||||
this.initializeResult = result;
|
||||
return result;
|
||||
};
|
||||
return this.requestManager.<Object, Object>runWrite(_function_1, _function_2).<InitializeResult>thenApply(_function_3);
|
||||
|
@ -1000,6 +1037,38 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
return this.requestManager.<WorkspaceEdit>runRead(_function);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.18
|
||||
*/
|
||||
@Override
|
||||
public CompletableFuture<Either<Range, PrepareRenameResult>> prepareRename(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, Either<Range, PrepareRenameResult>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
Either<Range, PrepareRenameResult> _xblockexpression = null;
|
||||
{
|
||||
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
|
||||
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
|
||||
IRenameService2 _get = null;
|
||||
if (resourceServiceProvider!=null) {
|
||||
_get=resourceServiceProvider.<IRenameService2>get(IRenameService2.class);
|
||||
}
|
||||
final IRenameService2 renameService = _get;
|
||||
if ((renameService == null)) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
IRenameService2.PrepareRenameOptions _prepareRenameOptions = new IRenameService2.PrepareRenameOptions();
|
||||
final Procedure1<IRenameService2.PrepareRenameOptions> _function_1 = (IRenameService2.PrepareRenameOptions it) -> {
|
||||
it.setLanguageServerAccess(this.access);
|
||||
it.setParams(params);
|
||||
it.setCancelIndicator(cancelIndicator);
|
||||
};
|
||||
IRenameService2.PrepareRenameOptions _doubleArrow = ObjectExtensions.<IRenameService2.PrepareRenameOptions>operator_doubleArrow(_prepareRenameOptions, _function_1);
|
||||
_xblockexpression = renameService.prepareRename(_doubleArrow);
|
||||
}
|
||||
return _xblockexpression;
|
||||
};
|
||||
return this.requestManager.<Either<Range, PrepareRenameResult>>runRead(_function);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(final String method, final Object parameter) {
|
||||
Collection<Endpoint> _get = this.extensionProviders.get(method);
|
||||
|
@ -1155,6 +1224,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
};
|
||||
return LanguageServerImpl.this.requestManager.<T>runRead(_function);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitializeResult getInitializeResult() {
|
||||
return LanguageServerImpl.this.initializeResult;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.server.rename;
|
||||
|
||||
import org.eclipse.lsp4j.PrepareRenameResult;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtext.ide.server.ILanguageServerAccess;
|
||||
import org.eclipse.xtext.util.CancelIndicator;
|
||||
|
@ -58,5 +62,58 @@ public interface IRenameService2 {
|
|||
}
|
||||
}
|
||||
|
||||
@Accessors
|
||||
public static class PrepareRenameOptions {
|
||||
private ILanguageServerAccess languageServerAccess;
|
||||
|
||||
private TextDocumentPositionParams params;
|
||||
|
||||
private CancelIndicator cancelIndicator;
|
||||
|
||||
@Pure
|
||||
public ILanguageServerAccess getLanguageServerAccess() {
|
||||
return this.languageServerAccess;
|
||||
}
|
||||
|
||||
public void setLanguageServerAccess(final ILanguageServerAccess languageServerAccess) {
|
||||
this.languageServerAccess = languageServerAccess;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public TextDocumentPositionParams getParams() {
|
||||
return this.params;
|
||||
}
|
||||
|
||||
public void setParams(final TextDocumentPositionParams params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public CancelIndicator getCancelIndicator() {
|
||||
return this.cancelIndicator;
|
||||
}
|
||||
|
||||
public void setCancelIndicator(final CancelIndicator cancelIndicator) {
|
||||
this.cancelIndicator = cancelIndicator;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract WorkspaceEdit rename(final IRenameService2.Options options);
|
||||
|
||||
/**
|
||||
* Returns a {@link Range range} describing the range of the string to rename and optionally a placeholder text of
|
||||
* the string content to be renamed.
|
||||
*
|
||||
* <p>
|
||||
* If {@code null} is returned then it is deemed that invoking {@link #rename rename} with the same text document
|
||||
* position will not result in a valid {@link WorkspaceEdit workspace edit}.
|
||||
*
|
||||
* <p>
|
||||
* The default implementation only checks whether there is an identifier under the give text document position or not.
|
||||
*
|
||||
* <p>
|
||||
* This method should be used to set up and to test the validity of a rename operation at a given location.</br>
|
||||
* See <a href="https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareRename">{@code textDocument/prepareRename}</a> for more details.
|
||||
*/
|
||||
public abstract Either<Range, PrepareRenameResult> prepareRename(final IRenameService2.PrepareRenameOptions options);
|
||||
}
|
||||
|
|
|
@ -7,17 +7,32 @@
|
|||
*/
|
||||
package org.eclipse.xtext.ide.server.rename;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EAttribute;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PrepareRenameResult;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.RenameOptions;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.ServerCapabilities;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.WorkspaceEdit;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.lsp4j.util.Ranges;
|
||||
import org.eclipse.xtend.lib.annotations.AccessorType;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
|
@ -41,15 +56,21 @@ import org.eclipse.xtext.parsetree.reconstr.impl.TokenUtil;
|
|||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.util.CancelIndicator;
|
||||
import org.eclipse.xtext.util.SimpleAttributeResolver;
|
||||
import org.eclipse.xtext.util.Strings;
|
||||
import org.eclipse.xtext.util.internal.Log;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Exceptions;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xbase.lib.StringExtensions;
|
||||
|
||||
/**
|
||||
* @author koehnlein - Initial contribution and API
|
||||
* @since 2.18
|
||||
*/
|
||||
@Log
|
||||
@Accessors(AccessorType.PROTECTED_GETTER)
|
||||
@SuppressWarnings("all")
|
||||
public class RenameService2 implements IRenameService2 {
|
||||
|
@ -66,66 +87,89 @@ public class RenameService2 implements IRenameService2 {
|
|||
@Inject
|
||||
private TokenUtil tokenUtil;
|
||||
|
||||
private Function<EObject, String> attributeResolver = SimpleAttributeResolver.<EObject, String>newResolver(String.class, "name");
|
||||
|
||||
@Override
|
||||
public WorkspaceEdit rename(final IRenameService2.Options options) {
|
||||
try {
|
||||
WorkspaceEdit _xblockexpression = null;
|
||||
{
|
||||
final ServerRefactoringIssueAcceptor issueAcceptor = this.issueProvider.get();
|
||||
final Function<ILanguageServerAccess.Context, WorkspaceEdit> _function = (ILanguageServerAccess.Context context) -> {
|
||||
final WorkspaceEdit workspaceEdit = new WorkspaceEdit();
|
||||
final ResourceSet resourceSet = options.getLanguageServerAccess().newLiveScopeResourceSet(context.getResource().getURI());
|
||||
final Resource xtextResource = resourceSet.getResource(context.getResource().getURI(), true);
|
||||
if ((xtextResource instanceof XtextResource)) {
|
||||
EObject element = null;
|
||||
try {
|
||||
element = this.getElementAtOffset(((XtextResource)xtextResource), context.getDocument(), options.getRenameParams().getPosition());
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IndexOutOfBoundsException) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Invalid document position line:");
|
||||
int _line = options.getRenameParams().getPosition().getLine();
|
||||
_builder.append(_line);
|
||||
_builder.append(" column:");
|
||||
int _character = options.getRenameParams().getPosition().getCharacter();
|
||||
_builder.append(_character);
|
||||
issueAcceptor.add(
|
||||
RefactoringIssueAcceptor.Severity.FATAL, _builder.toString());
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
if ((((issueAcceptor.getMaximumSeverity() != RefactoringIssueAcceptor.Severity.FATAL) && (element == null)) || element.eIsProxy())) {
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("No element found at position line:");
|
||||
int _line_1 = options.getRenameParams().getPosition().getLine();
|
||||
_builder_1.append(_line_1);
|
||||
_builder_1.append(" column:");
|
||||
int _character_1 = options.getRenameParams().getPosition().getCharacter();
|
||||
_builder_1.append(_character_1);
|
||||
issueAcceptor.add(
|
||||
RefactoringIssueAcceptor.Severity.FATAL, _builder_1.toString());
|
||||
} else {
|
||||
final IResourceServiceProvider services = this.serviceProviderRegistry.getResourceServiceProvider(element.eResource().getURI());
|
||||
final IChangeSerializer changeSerializer = services.<IChangeSerializer>get(IChangeSerializer.class);
|
||||
String _newName = options.getRenameParams().getNewName();
|
||||
URI _uRI = EcoreUtil.getURI(element);
|
||||
final RenameChange change = new RenameChange(_newName, _uRI);
|
||||
final RenameContext renameContext = new RenameContext(Collections.<RenameChange>unmodifiableList(CollectionLiterals.<RenameChange>newArrayList(change)), resourceSet, changeSerializer, issueAcceptor);
|
||||
final IRenameStrategy2 renameStrategy = services.<IRenameStrategy2>get(IRenameStrategy2.class);
|
||||
renameStrategy.applyRename(renameContext);
|
||||
final ChangeConverter2.Factory converterFactory = services.<ChangeConverter2.Factory>get(ChangeConverter2.Factory.class);
|
||||
final ChangeConverter2 changeConverter = converterFactory.create(workspaceEdit, options.getLanguageServerAccess());
|
||||
changeSerializer.applyModifications(changeConverter);
|
||||
}
|
||||
} else {
|
||||
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, "Loaded resource is not an XtextResource", context.getResource().getURI());
|
||||
final TextDocumentIdentifier textDocument = options.getRenameParams().getTextDocument();
|
||||
final String uri = textDocument.getUri();
|
||||
final ServerRefactoringIssueAcceptor issueAcceptor = this.issueProvider.get();
|
||||
final boolean shouldPrepareRename = this.shouldPrepareRename(options.getLanguageServerAccess());
|
||||
final java.util.function.Function<ILanguageServerAccess.Context, WorkspaceEdit> _function = (ILanguageServerAccess.Context context) -> {
|
||||
if (shouldPrepareRename) {
|
||||
String _uri = textDocument.getUri();
|
||||
final TextDocumentIdentifier identifier = new TextDocumentIdentifier(_uri);
|
||||
final Position position = options.getRenameParams().getPosition();
|
||||
final TextDocumentPositionParams positionParams = new TextDocumentPositionParams(identifier, position);
|
||||
final Resource resource = context.getResource();
|
||||
final Document document = context.getDocument();
|
||||
final CancelIndicator cancelIndicator = options.getCancelIndicator();
|
||||
final Either<Range, PrepareRenameResult> prepareRenameResult = this.doPrepareRename(resource, document, positionParams, cancelIndicator);
|
||||
boolean _mayPerformRename = this.mayPerformRename(prepareRenameResult, options.getRenameParams());
|
||||
boolean _not = (!_mayPerformRename);
|
||||
if (_not) {
|
||||
return null;
|
||||
}
|
||||
return workspaceEdit;
|
||||
};
|
||||
_xblockexpression = options.getLanguageServerAccess().<WorkspaceEdit>doRead(options.getRenameParams().getTextDocument().getUri(), _function).get();
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
final WorkspaceEdit workspaceEdit = new WorkspaceEdit();
|
||||
final ResourceSet resourceSet = options.getLanguageServerAccess().newLiveScopeResourceSet(context.getResource().getURI());
|
||||
final Resource xtextResource = resourceSet.getResource(context.getResource().getURI(), true);
|
||||
if ((xtextResource instanceof XtextResource)) {
|
||||
final Position position_1 = options.getRenameParams().getPosition();
|
||||
EObject element = null;
|
||||
try {
|
||||
element = this.getElementAtOffset(((XtextResource)xtextResource), context.getDocument(), position_1);
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IndexOutOfBoundsException) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Invalid document ");
|
||||
String _positionFragment = this.toPositionFragment(position_1, uri);
|
||||
_builder.append(_positionFragment);
|
||||
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, _builder.toString());
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
if (((element == null) || element.eIsProxy())) {
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("No element found at ");
|
||||
String _positionFragment_1 = this.toPositionFragment(position_1, uri);
|
||||
_builder_1.append(_positionFragment_1);
|
||||
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, _builder_1.toString());
|
||||
} else {
|
||||
final IResourceServiceProvider services = this.serviceProviderRegistry.getResourceServiceProvider(element.eResource().getURI());
|
||||
final IChangeSerializer changeSerializer = services.<IChangeSerializer>get(IChangeSerializer.class);
|
||||
String _newName = options.getRenameParams().getNewName();
|
||||
URI _uRI = EcoreUtil.getURI(element);
|
||||
final RenameChange change = new RenameChange(_newName, _uRI);
|
||||
final RenameContext renameContext = new RenameContext(Collections.<RenameChange>unmodifiableList(CollectionLiterals.<RenameChange>newArrayList(change)), resourceSet, changeSerializer, issueAcceptor);
|
||||
final IRenameStrategy2 renameStrategy = services.<IRenameStrategy2>get(IRenameStrategy2.class);
|
||||
renameStrategy.applyRename(renameContext);
|
||||
final ChangeConverter2.Factory converterFactory = services.<ChangeConverter2.Factory>get(ChangeConverter2.Factory.class);
|
||||
final ChangeConverter2 changeConverter = converterFactory.create(workspaceEdit, options.getLanguageServerAccess());
|
||||
changeSerializer.applyModifications(changeConverter);
|
||||
}
|
||||
} else {
|
||||
issueAcceptor.add(RefactoringIssueAcceptor.Severity.FATAL, "Loaded resource is not an XtextResource", context.getResource().getURI());
|
||||
}
|
||||
issueAcceptor.checkSeverity();
|
||||
return workspaceEdit;
|
||||
};
|
||||
final java.util.function.Function<Throwable, WorkspaceEdit> _function_1 = (Throwable exception) -> {
|
||||
try {
|
||||
final Throwable rootCause = Throwables.getRootCause(exception);
|
||||
if ((rootCause instanceof FileNotFoundException)) {
|
||||
if (shouldPrepareRename) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
throw exception;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
};
|
||||
return options.getLanguageServerAccess().<WorkspaceEdit>doRead(uri, _function).exceptionally(_function_1).get();
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
|
@ -169,6 +213,183 @@ public class RenameService2 implements IRenameService2 {
|
|||
return (((leafNode.getGrammarElement() instanceof RuleCall) || (leafNode.getGrammarElement() instanceof CrossReference)) && (!this.tokenUtil.isWhitespaceOrCommentNode(leafNode)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Either<Range, PrepareRenameResult> prepareRename(final IRenameService2.PrepareRenameOptions options) {
|
||||
try {
|
||||
final String uri = options.getParams().getTextDocument().getUri();
|
||||
final boolean shouldPrepareRename = this.shouldPrepareRename(options.getLanguageServerAccess());
|
||||
final java.util.function.Function<ILanguageServerAccess.Context, Either<Range, PrepareRenameResult>> _function = (ILanguageServerAccess.Context context) -> {
|
||||
if ((!shouldPrepareRename)) {
|
||||
return null;
|
||||
}
|
||||
final Resource resource = context.getResource();
|
||||
final Document document = context.getDocument();
|
||||
final TextDocumentPositionParams params = options.getParams();
|
||||
final CancelIndicator cancelIndicator = options.getCancelIndicator();
|
||||
return this.doPrepareRename(resource, document, params, cancelIndicator);
|
||||
};
|
||||
final java.util.function.Function<Throwable, Either<Range, PrepareRenameResult>> _function_1 = (Throwable exception) -> {
|
||||
try {
|
||||
final Throwable rootCause = Throwables.getRootCause(exception);
|
||||
if ((rootCause instanceof FileNotFoundException)) {
|
||||
if (shouldPrepareRename) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
throw exception;
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
};
|
||||
return options.getLanguageServerAccess().<Either<Range, PrepareRenameResult>>doRead(uri, _function).exceptionally(_function_1).get();
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
}
|
||||
}
|
||||
|
||||
protected Either<Range, PrepareRenameResult> doPrepareRename(final Resource resource, final Document document, final TextDocumentPositionParams params, final CancelIndicator cancelIndicator) {
|
||||
final String uri = params.getTextDocument().getUri();
|
||||
if ((resource instanceof XtextResource)) {
|
||||
IParseResult _parseResult = null;
|
||||
if (((XtextResource)resource)!=null) {
|
||||
_parseResult=((XtextResource)resource).getParseResult();
|
||||
}
|
||||
ICompositeNode _rootNode = null;
|
||||
if (_parseResult!=null) {
|
||||
_rootNode=_parseResult.getRootNode();
|
||||
}
|
||||
final ICompositeNode rootNode = _rootNode;
|
||||
if ((rootNode == null)) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("Could not retrieve root node for resource. URI: ");
|
||||
_builder.append(uri);
|
||||
_builder.append(".");
|
||||
RenameService2.LOG.trace(_builder);
|
||||
return null;
|
||||
}
|
||||
final Position caretPosition = params.getPosition();
|
||||
try {
|
||||
final int caretOffset = document.getOffSet(caretPosition);
|
||||
EObject element = null;
|
||||
int candidateOffset = caretOffset;
|
||||
do {
|
||||
{
|
||||
element = this.getElementWithIdentifierAt(((XtextResource)resource), candidateOffset);
|
||||
if (((element != null) && (!element.eIsProxy()))) {
|
||||
final ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, candidateOffset);
|
||||
if (((leaf != null) && this.isIdentifier(leaf))) {
|
||||
final String leafText = NodeModelUtils.getTokenText(leaf);
|
||||
final String elementName = this.getElementName(element);
|
||||
if ((((!StringExtensions.isNullOrEmpty(leafText)) && (!StringExtensions.isNullOrEmpty(elementName))) && Objects.equal(leafText, elementName))) {
|
||||
final Position start = document.getPosition(leaf.getOffset());
|
||||
int _offset = leaf.getOffset();
|
||||
int _length = elementName.length();
|
||||
int _plus = (_offset + _length);
|
||||
final Position end = document.getPosition(_plus);
|
||||
Range _range = new Range(start, end);
|
||||
return Either.<Range, PrepareRenameResult>forLeft(_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
candidateOffset = (candidateOffset - 1);
|
||||
}
|
||||
} while(((candidateOffset >= 0) && ((candidateOffset + 1) >= caretOffset)));
|
||||
} catch (final Throwable _t) {
|
||||
if (_t instanceof IndexOutOfBoundsException) {
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("Invalid document ");
|
||||
String _positionFragment = this.toPositionFragment(caretPosition, uri);
|
||||
_builder_1.append(_positionFragment);
|
||||
RenameService2.LOG.trace(_builder_1);
|
||||
return null;
|
||||
} else {
|
||||
throw Exceptions.sneakyThrow(_t);
|
||||
}
|
||||
}
|
||||
StringConcatenation _builder_2 = new StringConcatenation();
|
||||
_builder_2.append("No element found at ");
|
||||
String _positionFragment_1 = this.toPositionFragment(caretPosition, uri);
|
||||
_builder_2.append(_positionFragment_1);
|
||||
RenameService2.LOG.trace(_builder_2);
|
||||
} else {
|
||||
StringConcatenation _builder_3 = new StringConcatenation();
|
||||
_builder_3.append("Loaded resource is not an XtextResource. URI: ");
|
||||
URI _uRI = resource.getURI();
|
||||
_builder_3.append(_uRI);
|
||||
RenameService2.LOG.trace(_builder_3);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this method returns {@code false}, it is sure, that the rename operation will fail.
|
||||
* There is no guarantee that it will succeed even if it returns {@code true}.
|
||||
*/
|
||||
protected boolean mayPerformRename(final Either<Range, PrepareRenameResult> prepareRenameResult, final RenameParams renameParams) {
|
||||
return (((prepareRenameResult != null) && (prepareRenameResult.getLeft() != null)) &&
|
||||
Ranges.containsPosition(prepareRenameResult.getLeft(), renameParams.getPosition()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to read the {@code name} {@link EAttribute} from the
|
||||
* the given {@code element}.
|
||||
*
|
||||
* It never returns an empty string, but a {@code null} instead.
|
||||
*/
|
||||
protected String getElementName(final EObject element) {
|
||||
if ((element == null)) {
|
||||
return null;
|
||||
}
|
||||
final String name = this.attributeResolver.apply(element);
|
||||
String _xifexpression = null;
|
||||
boolean _isEmpty = Strings.isEmpty(name);
|
||||
if (_isEmpty) {
|
||||
_xifexpression = null;
|
||||
} else {
|
||||
_xifexpression = name;
|
||||
}
|
||||
return _xifexpression;
|
||||
}
|
||||
|
||||
private String toPositionFragment(final Position it, final String uri) {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("position line: ");
|
||||
int _line = it.getLine();
|
||||
_builder.append(_line);
|
||||
_builder.append(" column: ");
|
||||
int _character = it.getCharacter();
|
||||
_builder.append(_character);
|
||||
_builder.append(" in resource: ");
|
||||
_builder.append(uri);
|
||||
return _builder.toString();
|
||||
}
|
||||
|
||||
private boolean shouldPrepareRename(final ILanguageServerAccess access) {
|
||||
InitializeResult _initializeResult = null;
|
||||
if (access!=null) {
|
||||
_initializeResult=access.getInitializeResult();
|
||||
}
|
||||
ServerCapabilities _capabilities = null;
|
||||
if (_initializeResult!=null) {
|
||||
_capabilities=_initializeResult.getCapabilities();
|
||||
}
|
||||
Either<Boolean, RenameOptions> _renameProvider = null;
|
||||
if (_capabilities!=null) {
|
||||
_renameProvider=_capabilities.getRenameProvider();
|
||||
}
|
||||
final Either<Boolean, RenameOptions> provider = _renameProvider;
|
||||
boolean _xifexpression = false;
|
||||
if (((provider != null) && provider.isRight())) {
|
||||
Boolean _prepareProvider = provider.getRight().getPrepareProvider();
|
||||
_xifexpression = Objects.equal(Boolean.TRUE, _prepareProvider);
|
||||
} else {
|
||||
_xifexpression = false;
|
||||
}
|
||||
return _xifexpression;
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(RenameService2.class);
|
||||
|
||||
@Pure
|
||||
protected EObjectAtOffsetHelper getEObjectAtOffsetHelper() {
|
||||
return this.eObjectAtOffsetHelper;
|
||||
|
@ -188,4 +409,9 @@ public class RenameService2 implements IRenameService2 {
|
|||
protected TokenUtil getTokenUtil() {
|
||||
return this.tokenUtil;
|
||||
}
|
||||
|
||||
@Pure
|
||||
protected Function<EObject, String> getAttributeResolver() {
|
||||
return this.attributeResolver;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ public class ServerRefactoringIssueAcceptor implements RefactoringIssueAcceptor
|
|||
};
|
||||
ServerRefactoringIssueAcceptor.Issue _doubleArrow = ObjectExtensions.<ServerRefactoringIssueAcceptor.Issue>operator_doubleArrow(_issue, _function);
|
||||
this.issues.add(_doubleArrow);
|
||||
this.checkSeverity();
|
||||
}
|
||||
|
||||
protected boolean addIssue(final RefactoringIssueAcceptor.Severity severity, final String message) {
|
||||
|
|
|
@ -86,6 +86,8 @@ import org.junit.jupiter.api.AfterEach
|
|||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.eclipse.lsp4j.services.LanguageClient
|
||||
|
||||
import static extension org.eclipse.lsp4j.util.Ranges.containsRange
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
|
@ -290,7 +292,7 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
* @since 2.16
|
||||
*/
|
||||
protected def dispatch String toExpectation(DocumentSymbol it) {
|
||||
Assert.assertTrue('''selectionRange must be contained in the range: «it»''', range.contains(selectionRange))
|
||||
Assert.assertTrue('''selectionRange must be contained in the range: «it»''', range.containsRange(selectionRange))
|
||||
'''
|
||||
symbol "«name»" {
|
||||
kind: «kind.value»
|
||||
|
@ -448,7 +450,7 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
configuration.filePath = 'MyModel.' + fileExtension
|
||||
configurator.apply(configuration)
|
||||
val filePath = initializeContext(configuration).uri
|
||||
val codeLenses = languageServer.codeAction(new CodeActionParams=>[
|
||||
val result = languageServer.codeAction(new CodeActionParams=>[
|
||||
textDocument = new TextDocumentIdentifier(filePath)
|
||||
range = new Range => [
|
||||
start = new Position(configuration.line, configuration.column)
|
||||
|
@ -460,9 +462,9 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
])
|
||||
|
||||
if (configuration.assertCodeActions !== null) {
|
||||
configuration.assertCodeActions.apply(codeLenses.get)
|
||||
configuration.assertCodeActions.apply(result.get)
|
||||
} else {
|
||||
assertEquals(configuration.expectedCodeActions, codeLenses.get.toExpectation)
|
||||
assertEquals(configuration.expectedCodeActions, result.get.toExpectation)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,40 +597,6 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if the {@code smaller} range is inside or equal to the {@code bigger} range.
|
||||
* Otherwise, {@code false}.
|
||||
*/
|
||||
// `private` visibility because this should be in LSP4J: https://github.com/eclipse/lsp4j/issues/261
|
||||
private static def boolean contains(Range bigger, Range smaller) {
|
||||
return bigger.contains(smaller.start) && bigger.contains(smaller.end);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if the position is either inside or on the border of the range.
|
||||
* Otherwise, {@code false}.
|
||||
*/
|
||||
private static def boolean contains(Range range, Position position) {
|
||||
return (range.start == position || range.start.isBefore(position))
|
||||
&& (range.end == position || position.isBefore(range.end))
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if {@left} is strictly before than {@code right}.
|
||||
* Otherwise, {@code false}.
|
||||
* <p>
|
||||
* If you want to allow equality, use {@link Position#equals}.
|
||||
*/
|
||||
private static def boolean isBefore(Position left, Position right) {
|
||||
if (left.line < right.line) {
|
||||
return true;
|
||||
}
|
||||
if (left.line > right.line) {
|
||||
return false;
|
||||
}
|
||||
return left.character < right.character;
|
||||
}
|
||||
|
||||
protected def void testSymbol((WorkspaceSymbolConfiguration)=>void configurator) {
|
||||
val extension configuration = new WorkspaceSymbolConfiguration
|
||||
configuration.filePath = 'MyModel.' + fileExtension
|
||||
|
|
|
@ -79,6 +79,7 @@ import org.eclipse.lsp4j.jsonrpc.Endpoint;
|
|||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints;
|
||||
import org.eclipse.lsp4j.services.LanguageClient;
|
||||
import org.eclipse.lsp4j.util.Ranges;
|
||||
import org.eclipse.lsp4j.util.SemanticHighlightingTokens;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
|
@ -547,7 +548,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("selectionRange must be contained in the range: ");
|
||||
_builder.append(it);
|
||||
Assert.assertTrue(_builder.toString(), AbstractLanguageServerTest.contains(it.getRange(), it.getSelectionRange()));
|
||||
Assert.assertTrue(_builder.toString(), Ranges.containsRange(it.getRange(), it.getSelectionRange()));
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
_builder_1.append("symbol \"");
|
||||
String _name = it.getName();
|
||||
|
@ -995,11 +996,11 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
it.setContext(_doubleArrow_1);
|
||||
};
|
||||
CodeActionParams _doubleArrow = ObjectExtensions.<CodeActionParams>operator_doubleArrow(_codeActionParams, _function);
|
||||
final CompletableFuture<List<Either<Command, CodeAction>>> codeLenses = this.languageServer.codeAction(_doubleArrow);
|
||||
final CompletableFuture<List<Either<Command, CodeAction>>> result = this.languageServer.codeAction(_doubleArrow);
|
||||
if ((configuration.assertCodeActions != null)) {
|
||||
configuration.assertCodeActions.apply(codeLenses.get());
|
||||
configuration.assertCodeActions.apply(result.get());
|
||||
} else {
|
||||
this.assertEquals(configuration.expectedCodeActions, this.toExpectation(codeLenses.get()));
|
||||
this.assertEquals(configuration.expectedCodeActions, this.toExpectation(result.get()));
|
||||
}
|
||||
} catch (Throwable _e) {
|
||||
throw Exceptions.sneakyThrow(_e);
|
||||
|
@ -1239,46 +1240,6 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if the {@code smaller} range is inside or equal to the {@code bigger} range.
|
||||
* Otherwise, {@code false}.
|
||||
*/
|
||||
private static boolean contains(final Range bigger, final Range smaller) {
|
||||
return (AbstractLanguageServerTest.contains(bigger, smaller.getStart()) && AbstractLanguageServerTest.contains(bigger, smaller.getEnd()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if the position is either inside or on the border of the range.
|
||||
* Otherwise, {@code false}.
|
||||
*/
|
||||
private static boolean contains(final Range range, final Position position) {
|
||||
return ((Objects.equal(range.getStart(), position) || AbstractLanguageServerTest.isBefore(range.getStart(), position)) && (Objects.equal(range.getEnd(), position) || AbstractLanguageServerTest.isBefore(position, range.getEnd())));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code true} if {@left} is strictly before than {@code right}.
|
||||
* Otherwise, {@code false}.
|
||||
* <p>
|
||||
* If you want to allow equality, use {@link Position#equals}.
|
||||
*/
|
||||
private static boolean isBefore(final Position left, final Position right) {
|
||||
int _line = left.getLine();
|
||||
int _line_1 = right.getLine();
|
||||
boolean _lessThan = (_line < _line_1);
|
||||
if (_lessThan) {
|
||||
return true;
|
||||
}
|
||||
int _line_2 = left.getLine();
|
||||
int _line_3 = right.getLine();
|
||||
boolean _greaterThan = (_line_2 > _line_3);
|
||||
if (_greaterThan) {
|
||||
return false;
|
||||
}
|
||||
int _character = left.getCharacter();
|
||||
int _character_1 = right.getCharacter();
|
||||
return (_character < _character_1);
|
||||
}
|
||||
|
||||
protected void testSymbol(final Procedure1<? super WorkspaceSymbolConfiguration> configurator) {
|
||||
try {
|
||||
@Extension
|
||||
|
|
Loading…
Reference in a new issue