diff --git a/org.eclipse.xtext.ide.tests/.classpath b/org.eclipse.xtext.ide.tests/.classpath index 0043d86df7..1a09af3de8 100644 --- a/org.eclipse.xtext.ide.tests/.classpath +++ b/org.eclipse.xtext.ide.tests/.classpath @@ -8,6 +8,7 @@ + diff --git a/org.eclipse.xtext.ide.tests/build.gradle b/org.eclipse.xtext.ide.tests/build.gradle index cdb7e19397..0cc43c0b4b 100644 --- a/org.eclipse.xtext.ide.tests/build.gradle +++ b/org.eclipse.xtext.ide.tests/build.gradle @@ -13,12 +13,18 @@ dependencies { sourceSets.test.java { srcDir 'testlang-src' srcDir 'testlang-src-gen' + srcDir 'suites' } + sourceSets.test.resources { srcDir 'testlang-src' srcDir 'testlang-src-gen' } +test { + exclude '**/*Suite.class' +} + task generateTestLanguages(type: XtextGeneratorTask) { workflow = file('testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2') inputs.file 'testlang-src/org/eclipse/xtext/ide/tests/testlanguage/TestLanguage.xtext' diff --git a/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.ecore b/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.ecore new file mode 100644 index 0000000000..d0ac621734 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.ecore @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.genmodel b/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.genmodel new file mode 100644 index 0000000000..7efff1b9d7 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/model/generated/IndentationAwareUiTestLanguage.genmodel @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.xtend b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.xtend deleted file mode 100644 index 4188f0d613..0000000000 --- a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.xtend +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - *******************************************************************************/ -package org.eclipse.xtext.ide.tests.editor.contentassist.antlr - -/** - * @author Moritz Eysholdt - Initial contribution and API - */ -class CustomEntryPointContentAssistTest { - -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.xtend b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.xtend new file mode 100644 index 0000000000..7d7b27c921 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.xtend @@ -0,0 +1,945 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation + +import com.google.inject.Inject +import org.eclipse.emf.ecore.EObject +import org.eclipse.xtext.AbstractRule +import org.eclipse.xtext.Action +import org.eclipse.xtext.Keyword +import org.eclipse.xtext.RuleCall +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree +import org.eclipse.xtext.nodemodel.INode +import org.eclipse.xtext.nodemodel.util.NodeModelUtils +import org.eclipse.xtext.testing.util.ParseHelper +import org.junit.Test + +import static org.junit.Assert.* + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +abstract class AbstractCompletePrefixProviderTest { + + def CompletionPrefixProvider getTestee(); + + @Inject ParseHelper parseHelper; + + @Test def void testInputToParse_01() { + assertEquals("abc", testee.getInputToParse("abcdefg", 3, 7 /* do not care about this */)) + } + + @Test def void testInputToParse_02() { + assertEquals("abc", testee.getInputToParse("abc defg", 3, 7 /* do not care about this */)) + } + + @Test def void testWholeNodeModel() { + ''' + parent1 + child1 + grandChild1 + grandChild2 + child1 + grandChild3 + + grandChild4 + + child2 + + grandChild5 + parent2 + + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [ID:grandChild2] + [DEDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild3] + [ID:grandChild4] + [DEDENT:] + [ID:child2] + [INDENT:] + [ID:grandChild5] + [DEDENT:] + [DEDENT:] + [ID:parent2] + ''') + } + + @Test def void testLastCompleteNode_0_0() { + ''' + <|>parent1 + child1 + + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_0_2() { + ''' + pa<|>rent1 + child1 + '''.assertLastCompleteNode(''' + [ID:parent1] + ''') + } + + @Test def void testLastCompleteNode_1_0() { + ''' + parent1 + <|> child1 + '''.assertLastCompleteNode(''' + [ID:parent1] + ''') + } + + @Test def void testLastCompleteNode_1_1() { + ''' + parent1 + <|>child1 + '''.assertLastCompleteNode(''' + [ID:parent1] + ''') + } + + @Test def void testLastCompleteNode_1_2() { + ''' + parent1 + c<|>hild1 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + ''') + } + + @Test def void testLastCompleteNode_2_0() { + ''' + parent1 + child1 + <|> grandChild1 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + ''') + } + + @Test def void testLastCompleteNode_2_1() { + ''' + parent1 + child1 + <|> grandChild1 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + ''') + } + + @Test def void testLastCompleteNode_2_2() { + ''' + parent1 + child1 + <|>grandChild1 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + ''') + } + + @Test def void testLastCompleteNode_3_1() { + ''' + c + d + g + <|> + '''.assertLastCompleteNode(''' + [ID:c] + [INDENT:] + [ID:d] + [ID:g] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_3_2() { + ''' + parent1 + child1 + grandChild1 + <|>grandChild2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_2() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_1() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_0() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_2b() { + ''' + parent1 + child1 + grandChild1 + <|> + grandChild2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_1b() { + ''' + parent1 + child1 + grandChild1 + <|> + grandChild2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_0b() { + ''' + parent1 + child1 + grandChild1 + <|> + grandChild2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_2c() { + ''' + parent1 + child1 + grandChild1 + <|> + child2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_1c() { + ''' + parent1 + child1 + grandChild1 + <|> + child2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_0c() { + ''' + parent1 + child1 + grandChild1 + <|> + child2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_4_2d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_1d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_4_0d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test def void testLastCompleteNode_6_0() { + ''' + a + b + c + d + e + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + ''') + } + + @Test def void testLastCompleteNode_6_0b() { + ''' + a + b + c + d + e + <|> + f + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + ''') + } + + @Test def void testLastCompleteNode_6_1b() { + ''' + a + b + c + d + e + <|> + f + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_5_1() { + ''' + a + b + c + d + <|> + e + '''.assertLastCompleteNode(''' + [ID:a] + [INDENT:] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + ''') + } + + @Test def void testLastCompleteNode_6_3() { + ''' + a + b + c + d + e + g <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_6_3b() { + ''' + a + b + c + d + e + g <|>'''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_6_3c() { + ''' + a + b + c + d + e + g <|> '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_6_3d() { + ''' + a + b + c + d + e + g <|> // comment'''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_7_0() { + ''' + a + b + c + d + e + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_7_1() { + ''' + a + b + c + d + e + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_1() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_2() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_2b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_8_2c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_3() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_3b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_8_3c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_4() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test def void testLastCompleteNode_8_4b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test def void testLastCompleteNode_8_4c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + protected def void assertLastCompleteNode(CharSequence model, String expectation) { + val modelAsString = model.toString + modelAsString.assertLastCompleteNode(expectation); + val withStringLiterals = modelAsString.replaceAll("(\\w+(<\\|>\\w+)?)", "\"$1\"") + val expectationWithLiterals = expectation.replaceAll("ID:(\\w+)", "STRING:\"$1\""); + withStringLiterals.assertLastCompleteNode(expectationWithLiterals); + } + + private def void assertLastCompleteNode(String model, String expectation) { + var offset = model.indexOf('<|>') + if (offset === -1) { + offset = model.length + + } + var completionOffset = model.indexOf('<|>', offset); + if (completionOffset === -1) { + completionOffset = offset; + } + val tree = parseHelper.parse(model.replace('<|>', '')) + val nodeModel = NodeModelUtils.findActualNodeFor(tree) + val completeNode = testee.getLastCompleteNodeByOffset(nodeModel, offset, completionOffset) + assertNodeModel(expectation, completeNode); + } + + def private void assertNodeModel(String expectation, INode node) { + assertEquals(expectation, node.rootNode.asText(node)) + } + + private def String asText(INode node, INode stop) ''' + «FOR leaf : node.leafNodes.filter[!(grammarElement instanceof Action)].filter[!isHidden].upTo(stop)» + [«leaf.grammarElement.tokenType»:«leaf.text.replace('\t', '\\t')»] + «ENDFOR» + ''' + + private def upTo(Iterable iter, Object element) { + return iter.filter(new Functions.Function1() { + var found = false; + override apply(T t) { + if (found) return false; + try { + return true; + } finally { + found = t == element; + } + } + }) + } + + private def String tokenType(EObject obj) { + switch(obj) { + RuleCall: obj.rule.name + Keyword: obj.value + AbstractRule: obj.name + } + } +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.xtend b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.xtend new file mode 100644 index 0000000000..6ebcf6e943 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.xtend @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation + +import com.google.inject.Inject +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider +import org.eclipse.xtext.ide.tests.testlanguage.tests.IndentationAwareUiTestLanguageInjectorProvider +import org.eclipse.xtext.testing.InjectWith +import org.eclipse.xtext.testing.XtextRunner +import org.junit.runner.RunWith + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner) +@InjectWith(IndentationAwareUiTestLanguageInjectorProvider) +class CompletionPrefixProviderTest extends AbstractCompletePrefixProviderTest { + + @Inject CompletionPrefixProvider testee; + + override getTestee() { + return testee + } + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.xtend b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.xtend new file mode 100644 index 0000000000..8a68b6e8c9 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.xtend @@ -0,0 +1,635 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation + +import com.google.inject.Inject +import org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider +import org.eclipse.xtext.ide.tests.testlanguage.tests.IndentationAwareUiTestLanguageInjectorProvider +import org.eclipse.xtext.testing.InjectWith +import org.eclipse.xtext.testing.XtextRunner +import org.junit.Test +import org.junit.runner.RunWith + +import static org.junit.Assert.* + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner) +@InjectWith(IndentationAwareUiTestLanguageInjectorProvider) +class IndentationAwareCompletionPrefixProviderTest extends AbstractCompletePrefixProviderTest { + + @Inject IndentationAwareCompletionPrefixProvider testee + + override getTestee() { + return testee + } + + @Test override void testInputToParse_02() { + assertEquals("abc ", testee.getInputToParse("abc defg", 3, 5)) + } + + @Test override void testLastCompleteNode_1_1() { + ''' + parent1 + <|>child1 + grandChild1 + grandChild2 + child1 + grandChild3 + + grandChild4 + + child2 + + grandChild5 + parent2 + + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + ''') + } + + @Test override void testLastCompleteNode_2_2() { + ''' + parent1 + child1 + <|>grandChild1 + grandChild2 + child1 + grandChild3 + + grandChild4 + + child2 + + grandChild5 + parent2 + + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + ''') + } + + @Test override void testLastCompleteNode_3_1() { + ''' + c + d + g + <|> + '''.assertLastCompleteNode(''' + [ID:c] + [INDENT:] + [ID:d] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_4_2() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test override void testLastCompleteNode_4_1() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_1b() { + ''' + parent1 + child1 + grandChild1 + <|> + grandChild2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [ID:grandChild2] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_0() { + ''' + parent1 + child1 + grandChild1 + <|> + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_0c() { + ''' + parent1 + child1 + grandChild1 + <|> + child2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_0d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_1d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_4_2c() { + ''' + parent1 + child1 + grandChild1 + <|> + child2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test override void testLastCompleteNode_4_2d() { + ''' + parent1 + child1 + grandChild1 + <|> + parent2 + '''.assertLastCompleteNode(''' + [ID:parent1] + [INDENT:] + [ID:child1] + [INDENT:] + [ID:grandChild1] + ''') + } + + @Test override void testLastCompleteNode_6_0() { + ''' + a + b + c + d + e + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_6_0b() { + ''' + a + b + c + d + e + <|> + f + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_5_1() { + ''' + a + b + c + d + <|> + e + '''.assertLastCompleteNode(''' + [ID:a] + [INDENT:] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [ID:e] + [DEDENT:] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_7_0() { + ''' + a + b + c + d + e + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + [DEDENT:] + ''') + } + + @Test override void testLastCompleteNode_7_1() { + ''' + a + b + c + d + e + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_1() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_2() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_2b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_2c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_3() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_3b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_3c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_4() { + ''' + a + b + c + d + e + f + g + <|> + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_4b() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + + @Test override void testLastCompleteNode_8_4c() { + ''' + a + b + c + d + e + f + g + <|> + h + '''.assertLastCompleteNode(''' + [ID:a] + [ID:b] + [INDENT:] + [ID:c] + [INDENT:] + [ID:d] + [INDENT:] + [ID:e] + [INDENT:] + [ID:f] + [DEDENT:] + [DEDENT:] + [ID:g] + ''') + } + +} diff --git a/org.eclipse.xtext.ide.tests/suites/org/eclipse/xtext/ide/tests/indentation/IndentationTestLanguageSuite.java b/org.eclipse.xtext.ide.tests/suites/org/eclipse/xtext/ide/tests/indentation/IndentationTestLanguageSuite.java new file mode 100644 index 0000000000..50334ffd28 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/suites/org/eclipse/xtext/ide/tests/indentation/IndentationTestLanguageSuite.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(Suite.class) +@SuiteClasses({ + CompletionPrefixProviderTest.class, + IndentationAwareCompletionPrefixProviderTest.class +}) +public class IndentationTestLanguageSuite { + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/META-INF/services/org.eclipse.xtext.ISetup b/org.eclipse.xtext.ide.tests/testlang-src-gen/META-INF/services/org.eclipse.xtext.ISetup index 101b22dd3c..1c0df7bcc4 100644 --- a/org.eclipse.xtext.ide.tests/testlang-src-gen/META-INF/services/org.eclipse.xtext.ISetup +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/META-INF/services/org.eclipse.xtext.ISetup @@ -1,3 +1,4 @@ org.eclipse.xtext.ide.tests.testlanguage.ide.TestLanguageIdeSetup +org.eclipse.xtext.ide.tests.testlanguage.ide.IndentationAwareUiTestLanguageIdeSetup org.eclipse.xtext.ide.tests.testlanguage.ide.PartialContentAssistTestLanguageIdeSetup org.eclipse.xtext.ide.tests.testlanguage.ide.PartialSerializationTestLanguageIdeSetup diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/AbstractIndentationAwareUiTestLanguageRuntimeModule.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/AbstractIndentationAwareUiTestLanguageRuntimeModule.java new file mode 100644 index 0000000000..de9f09e2a4 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/AbstractIndentationAwareUiTestLanguageRuntimeModule.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage; + +import com.google.inject.Binder; +import com.google.inject.Provider; +import com.google.inject.name.Names; +import java.util.Properties; +import org.eclipse.xtext.Constants; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.generator.IGenerator2; +import org.eclipse.xtext.ide.tests.testlanguage.generator.IndentationAwareUiTestLanguageGenerator; +import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.IndentationAwareUiTestLanguageAntlrTokenFileProvider; +import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.IndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.lexer.InternalIndentationAwareUiTestLanguageLexer; +import org.eclipse.xtext.ide.tests.testlanguage.scoping.IndentationAwareUiTestLanguageScopeProvider; +import org.eclipse.xtext.ide.tests.testlanguage.serializer.IndentationAwareUiTestLanguageSemanticSequencer; +import org.eclipse.xtext.ide.tests.testlanguage.serializer.IndentationAwareUiTestLanguageSyntacticSequencer; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; +import org.eclipse.xtext.ide.tests.testlanguage.validation.IndentationAwareUiTestLanguageValidator; +import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider; +import org.eclipse.xtext.naming.IQualifiedNameProvider; +import org.eclipse.xtext.parser.IParser; +import org.eclipse.xtext.parser.ITokenToStringConverter; +import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider; +import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; +import org.eclipse.xtext.parser.antlr.ITokenDefProvider; +import org.eclipse.xtext.parser.antlr.Lexer; +import org.eclipse.xtext.parser.antlr.LexerBindings; +import org.eclipse.xtext.parser.antlr.LexerProvider; +import org.eclipse.xtext.resource.IContainer; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.containers.IAllContainersState; +import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider; +import org.eclipse.xtext.resource.containers.StateBasedContainerManager; +import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; +import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; +import org.eclipse.xtext.scoping.IScopeProvider; +import org.eclipse.xtext.scoping.IgnoreCaseLinking; +import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; +import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider; +import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider; +import org.eclipse.xtext.serializer.ISerializer; +import org.eclipse.xtext.serializer.impl.Serializer; +import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; +import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer; +import org.eclipse.xtext.service.DefaultRuntimeModule; +import org.eclipse.xtext.service.SingletonBinding; + +/** + * Manual modifications go to {@link IndentationAwareUiTestLanguageRuntimeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractIndentationAwareUiTestLanguageRuntimeModule extends DefaultRuntimeModule { + + protected Properties properties = null; + + @Override + public void configure(Binder binder) { + properties = tryBindProperties(binder, "org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.properties"); + super.configure(binder); + } + + public void configureLanguageName(Binder binder) { + binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage"); + } + + public void configureFileExtensions(Binder binder) { + if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) + binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("indentationAwareUiTestLang"); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public ClassLoader bindClassLoaderToInstance() { + return getClass().getClassLoader(); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public Class bindIGrammarAccess() { + return IndentationAwareUiTestLanguageGrammarAccess.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISemanticSequencer() { + return IndentationAwareUiTestLanguageSemanticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISyntacticSequencer() { + return IndentationAwareUiTestLanguageSyntacticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISerializer() { + return Serializer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIParser() { + return IndentationAwareUiTestLanguageParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenToStringConverter() { + return AntlrTokenToStringConverter.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIAntlrTokenFileProvider() { + return IndentationAwareUiTestLanguageAntlrTokenFileProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindLexer() { + return InternalIndentationAwareUiTestLanguageLexer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenDefProvider() { + return AntlrTokenDefProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Provider provideInternalIndentationAwareUiTestLanguageLexer() { + return LexerProvider.create(InternalIndentationAwareUiTestLanguageLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureRuntimeLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerBindings.RUNTIME)) + .to(InternalIndentationAwareUiTestLanguageLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + @SingletonBinding(eager=true) + public Class bindIndentationAwareUiTestLanguageValidator() { + return IndentationAwareUiTestLanguageValidator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIScopeProvider() { + return IndentationAwareUiTestLanguageScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIScopeProviderDelegate(Binder binder) { + binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIGlobalScopeProvider() { + return DefaultGlobalScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIgnoreCaseLinking(Binder binder) { + binder.bindConstant().annotatedWith(IgnoreCaseLinking.class).to(false); + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIQualifiedNameProvider() { + return DefaultDeclarativeQualifiedNameProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIContainer$Manager() { + return StateBasedContainerManager.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIAllContainersState$Provider() { + return ResourceSetBasedAllContainersStateProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptions(Binder binder) { + binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptionsPersisted(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public Class bindIGenerator2() { + return IndentationAwareUiTestLanguageGenerator.class; + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtextbin b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtextbin new file mode 100644 index 0000000000..b0ffef2bdb Binary files /dev/null and b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtextbin differ diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetupGenerated.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetupGenerated.java new file mode 100644 index 0000000000..6fe814768e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetupGenerated.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.ISetup; +import org.eclipse.xtext.common.TerminalsStandaloneSetup; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.resource.IResourceFactory; +import org.eclipse.xtext.resource.IResourceServiceProvider; + +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageStandaloneSetupGenerated implements ISetup { + + @Override + public Injector createInjectorAndDoEMFRegistration() { + TerminalsStandaloneSetup.doSetup(); + + Injector injector = createInjector(); + register(injector); + return injector; + } + + public Injector createInjector() { + return Guice.createInjector(new IndentationAwareUiTestLanguageRuntimeModule()); + } + + public void register(Injector injector) { + if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage")) { + EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage", IndentationAwareUiTestLanguagePackage.eINSTANCE); + } + IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); + IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); + + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("indentationAwareUiTestLang", resourceFactory); + IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("indentationAwareUiTestLang", serviceProvider); + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/AbstractIndentationAwareUiTestLanguageIdeModule.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/AbstractIndentationAwareUiTestLanguageIdeModule.java new file mode 100644 index 0000000000..367c65c22e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/AbstractIndentationAwareUiTestLanguageIdeModule.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide; + +import com.google.inject.Binder; +import com.google.inject.name.Names; +import org.eclipse.xtext.ide.DefaultIdeModule; +import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider; +import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher; +import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher; +import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider; +import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.IndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.lexer.InternalIndentationAwareUiTestLanguageLexer; + +/** + * Manual modifications go to {@link IndentationAwareUiTestLanguageIdeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractIndentationAwareUiTestLanguageIdeModule extends DefaultIdeModule { + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureContentAssistLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) + .to(InternalIndentationAwareUiTestLanguageLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIContentAssistParser() { + return IndentationAwareUiTestLanguageParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIProposalConflictHelper() { + return AntlrProposalConflictHelper.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindCompletionPrefixProvider() { + return IndentationAwareCompletionPrefixProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIPrefixMatcher() { + return FQNPrefixMatcher.class; + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageParser.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageParser.java new file mode 100644 index 0000000000..015f8a96d8 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageParser.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr; + +import com.google.inject.Inject; +import java.util.HashMap; +import java.util.Map; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.TokenSource; +import org.eclipse.xtext.AbstractElement; +import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser; +import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalIndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; + +public class IndentationAwareUiTestLanguageParser extends AbstractContentAssistParser { + + @Inject + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + + private Map nameMappings; + + @Override + protected InternalIndentationAwareUiTestLanguageParser createParser() { + InternalIndentationAwareUiTestLanguageParser result = new InternalIndentationAwareUiTestLanguageParser(null); + result.setGrammarAccess(grammarAccess); + return result; + } + + @Override + protected TokenSource createLexer(CharStream stream) { + return new IndentationAwareUiTestLanguageTokenSource(super.createLexer(stream)); + } + + @Override + protected String getRuleName(AbstractElement element) { + if (nameMappings == null) { + nameMappings = new HashMap() { + private static final long serialVersionUID = 1L; + { + put(grammarAccess.getTreeAccess().getGroup(), "rule__Tree__Group__0"); + put(grammarAccess.getTreeNodeAccess().getGroup(), "rule__TreeNode__Group__0"); + put(grammarAccess.getTreeNodeAccess().getGroup_1(), "rule__TreeNode__Group_1__0"); + put(grammarAccess.getOtherTreeNodeAccess().getGroup(), "rule__OtherTreeNode__Group__0"); + put(grammarAccess.getChildListAccess().getGroup(), "rule__ChildList__Group__0"); + put(grammarAccess.getTreeAccess().getNodesAssignment_1(), "rule__Tree__NodesAssignment_1"); + put(grammarAccess.getTreeAccess().getMoreNodesAssignment_2(), "rule__Tree__MoreNodesAssignment_2"); + put(grammarAccess.getTreeNodeAccess().getNameAssignment_0(), "rule__TreeNode__NameAssignment_0"); + put(grammarAccess.getTreeNodeAccess().getChildrenAssignment_1_1(), "rule__TreeNode__ChildrenAssignment_1_1"); + put(grammarAccess.getOtherTreeNodeAccess().getNameAssignment_0(), "rule__OtherTreeNode__NameAssignment_0"); + put(grammarAccess.getOtherTreeNodeAccess().getChildListAssignment_1(), "rule__OtherTreeNode__ChildListAssignment_1"); + put(grammarAccess.getChildListAccess().getChildrenAssignment_2(), "rule__ChildList__ChildrenAssignment_2"); + } + }; + } + return nameMappings.get(element); + } + + @Override + protected String[] getInitialHiddenTokens() { + return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" }; + } + + public IndentationAwareUiTestLanguageGrammarAccess getGrammarAccess() { + return this.grammarAccess; + } + + public void setGrammarAccess(IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/PartialIndentationAwareUiTestLanguageContentAssistParser.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/PartialIndentationAwareUiTestLanguageContentAssistParser.java new file mode 100644 index 0000000000..d244af62a3 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/PartialIndentationAwareUiTestLanguageContentAssistParser.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr; + +import java.util.Collection; +import java.util.Collections; +import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser; +import org.eclipse.xtext.util.PolymorphicDispatcher; + +public class PartialIndentationAwareUiTestLanguageContentAssistParser extends IndentationAwareUiTestLanguageParser implements IPartialEditingContentAssistParser { + + private AbstractRule rule; + + @Override + public void initializeFor(AbstractRule rule) { + this.rule = rule; + } + + @Override + protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { + if (rule == null || rule.eIsProxy()) + return Collections.emptyList(); + String methodName = "entryRule" + rule.getName(); + PolymorphicDispatcher> dispatcher = + new PolymorphicDispatcher>(methodName, 0, 0, Collections.singletonList(parser)); + dispatcher.invoke(); + return parser.getFollowElements(); + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g new file mode 100644 index 0000000000..50b5252ee8 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g @@ -0,0 +1,646 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +parser grammar InternalIndentationAwareUiTestLanguageParser; + +options { + tokenVocab=InternalIndentationAwareUiTestLanguageLexer; + superClass=AbstractInternalContentAssistParser; +} + +@header { +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal; +import java.util.Map; +import java.util.HashMap; + +import java.io.InputStream; +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; + +} +@members { + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + private final Map tokenNameToValue = new HashMap(); + + { + } + + public void setGrammarAccess(IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } + + @Override + protected Grammar getGrammar() { + return grammarAccess.getGrammar(); + } + + @Override + protected String getValueForTokenName(String tokenName) { + String result = tokenNameToValue.get(tokenName); + if (result == null) + result = tokenName; + return result; + } +} + +// Entry rule entryRuleTree +entryRuleTree +: +{ before(grammarAccess.getTreeRule()); } + ruleTree +{ after(grammarAccess.getTreeRule()); } + EOF +; + +// Rule Tree +ruleTree + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getTreeAccess().getGroup()); } + (rule__Tree__Group__0) + { after(grammarAccess.getTreeAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +// Entry rule entryRuleTreeNode +entryRuleTreeNode +: +{ before(grammarAccess.getTreeNodeRule()); } + ruleTreeNode +{ after(grammarAccess.getTreeNodeRule()); } + EOF +; + +// Rule TreeNode +ruleTreeNode + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getTreeNodeAccess().getGroup()); } + (rule__TreeNode__Group__0) + { after(grammarAccess.getTreeNodeAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +// Entry rule entryRuleOtherTreeNode +entryRuleOtherTreeNode +: +{ before(grammarAccess.getOtherTreeNodeRule()); } + ruleOtherTreeNode +{ after(grammarAccess.getOtherTreeNodeRule()); } + EOF +; + +// Rule OtherTreeNode +ruleOtherTreeNode + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getOtherTreeNodeAccess().getGroup()); } + (rule__OtherTreeNode__Group__0) + { after(grammarAccess.getOtherTreeNodeAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +// Entry rule entryRuleChildList +entryRuleChildList +: +{ before(grammarAccess.getChildListRule()); } + ruleChildList +{ after(grammarAccess.getChildListRule()); } + EOF +; + +// Rule ChildList +ruleChildList + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getChildListAccess().getGroup()); } + (rule__ChildList__Group__0) + { after(grammarAccess.getChildListAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__Tree__Group__0__Impl + rule__Tree__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeAccess().getTreeAction_0()); } + () + { after(grammarAccess.getTreeAccess().getTreeAction_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__Tree__Group__1__Impl + rule__Tree__Group__2 +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeAccess().getNodesAssignment_1()); } + (rule__Tree__NodesAssignment_1)* + { after(grammarAccess.getTreeAccess().getNodesAssignment_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__2 + @init { + int stackSize = keepStackSize(); + } +: + rule__Tree__Group__2__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__Group__2__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeAccess().getMoreNodesAssignment_2()); } + (rule__Tree__MoreNodesAssignment_2)* + { after(grammarAccess.getTreeAccess().getMoreNodesAssignment_2()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__TreeNode__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__TreeNode__Group__0__Impl + rule__TreeNode__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeNodeAccess().getNameAssignment_0()); } + (rule__TreeNode__NameAssignment_0) + { after(grammarAccess.getTreeNodeAccess().getNameAssignment_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__TreeNode__Group__1__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeNodeAccess().getGroup_1()); } + (rule__TreeNode__Group_1__0)? + { after(grammarAccess.getTreeNodeAccess().getGroup_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__TreeNode__Group_1__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__TreeNode__Group_1__0__Impl + rule__TreeNode__Group_1__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group_1__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); } + RULE_INDENT + { after(grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group_1__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__TreeNode__Group_1__1__Impl + rule__TreeNode__Group_1__2 +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group_1__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeNodeAccess().getChildrenAssignment_1_1()); } + (rule__TreeNode__ChildrenAssignment_1_1)* + { after(grammarAccess.getTreeNodeAccess().getChildrenAssignment_1_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group_1__2 + @init { + int stackSize = keepStackSize(); + } +: + rule__TreeNode__Group_1__2__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__Group_1__2__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); } + RULE_DEDENT + { after(grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__OtherTreeNode__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__OtherTreeNode__Group__0__Impl + rule__OtherTreeNode__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__OtherTreeNode__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getOtherTreeNodeAccess().getNameAssignment_0()); } + (rule__OtherTreeNode__NameAssignment_0) + { after(grammarAccess.getOtherTreeNodeAccess().getNameAssignment_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__OtherTreeNode__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__OtherTreeNode__Group__1__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__OtherTreeNode__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getOtherTreeNodeAccess().getChildListAssignment_1()); } + (rule__OtherTreeNode__ChildListAssignment_1)? + { after(grammarAccess.getOtherTreeNodeAccess().getChildListAssignment_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__ChildList__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__ChildList__Group__0__Impl + rule__ChildList__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getChildListAccess().getChildListAction_0()); } + () + { after(grammarAccess.getChildListAccess().getChildListAction_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__ChildList__Group__1__Impl + rule__ChildList__Group__2 +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); } + RULE_INDENT + { after(grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__2 + @init { + int stackSize = keepStackSize(); + } +: + rule__ChildList__Group__2__Impl + rule__ChildList__Group__3 +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__2__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + ( + { before(grammarAccess.getChildListAccess().getChildrenAssignment_2()); } + (rule__ChildList__ChildrenAssignment_2) + { after(grammarAccess.getChildListAccess().getChildrenAssignment_2()); } + ) + ( + { before(grammarAccess.getChildListAccess().getChildrenAssignment_2()); } + (rule__ChildList__ChildrenAssignment_2)* + { after(grammarAccess.getChildListAccess().getChildrenAssignment_2()); } + ) +) +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__3 + @init { + int stackSize = keepStackSize(); + } +: + rule__ChildList__Group__3__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__Group__3__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); } + RULE_DEDENT + { after(grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__Tree__NodesAssignment_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); } + ruleTreeNode + { after(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Tree__MoreNodesAssignment_2 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); } + ruleOtherTreeNode + { after(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__NameAssignment_0 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); } + RULE_ID + { after(grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__TreeNode__ChildrenAssignment_1_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); } + ruleTreeNode + { after(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__OtherTreeNode__NameAssignment_0 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); } + RULE_STRING + { after(grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__OtherTreeNode__ChildListAssignment_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); } + ruleChildList + { after(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__ChildList__ChildrenAssignment_2 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); } + ruleOtherTreeNode + { after(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java new file mode 100644 index 0000000000..473bde7a5a --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java @@ -0,0 +1,1907 @@ +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal; +import java.util.Map; +import java.util.HashMap; + +import java.io.InputStream; +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; + + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalIndentationAwareUiTestLanguageParser extends AbstractInternalContentAssistParser { + public static final String[] tokenNames = new String[] { + "", "", "", "", "RULE_SL_COMMENT", "RULE_INDENT", "RULE_DEDENT", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_WS", "RULE_ANY_OTHER" + }; + public static final int RULE_DEDENT=6; + public static final int RULE_ID=7; + public static final int RULE_WS=11; + public static final int RULE_STRING=9; + public static final int RULE_ANY_OTHER=12; + public static final int RULE_SL_COMMENT=4; + public static final int RULE_INT=8; + public static final int RULE_ML_COMMENT=10; + public static final int EOF=-1; + public static final int RULE_INDENT=5; + + // delegates + // delegators + + + public InternalIndentationAwareUiTestLanguageParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + public InternalIndentationAwareUiTestLanguageParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return InternalIndentationAwareUiTestLanguageParser.tokenNames; } + public String getGrammarFileName() { return "InternalIndentationAwareUiTestLanguageParser.g"; } + + + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + private final Map tokenNameToValue = new HashMap(); + + { + } + + public void setGrammarAccess(IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } + + @Override + protected Grammar getGrammar() { + return grammarAccess.getGrammar(); + } + + @Override + protected String getValueForTokenName(String tokenName) { + String result = tokenNameToValue.get(tokenName); + if (result == null) + result = tokenName; + return result; + } + + + + // $ANTLR start "entryRuleTree" + // InternalIndentationAwareUiTestLanguageParser.g:59:1: entryRuleTree : ruleTree EOF ; + public final void entryRuleTree() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageParser.g:60:1: ( ruleTree EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:61:1: ruleTree EOF + { + before(grammarAccess.getTreeRule()); + pushFollow(FOLLOW_1); + ruleTree(); + + state._fsp--; + + after(grammarAccess.getTreeRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleTree" + + + // $ANTLR start "ruleTree" + // InternalIndentationAwareUiTestLanguageParser.g:68:1: ruleTree : ( ( rule__Tree__Group__0 ) ) ; + public final void ruleTree() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:72:2: ( ( ( rule__Tree__Group__0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:73:2: ( ( rule__Tree__Group__0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:73:2: ( ( rule__Tree__Group__0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:74:3: ( rule__Tree__Group__0 ) + { + before(grammarAccess.getTreeAccess().getGroup()); + // InternalIndentationAwareUiTestLanguageParser.g:75:3: ( rule__Tree__Group__0 ) + // InternalIndentationAwareUiTestLanguageParser.g:75:4: rule__Tree__Group__0 + { + pushFollow(FOLLOW_2); + rule__Tree__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getTreeAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleTree" + + + // $ANTLR start "entryRuleTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:84:1: entryRuleTreeNode : ruleTreeNode EOF ; + public final void entryRuleTreeNode() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageParser.g:85:1: ( ruleTreeNode EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:86:1: ruleTreeNode EOF + { + before(grammarAccess.getTreeNodeRule()); + pushFollow(FOLLOW_1); + ruleTreeNode(); + + state._fsp--; + + after(grammarAccess.getTreeNodeRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleTreeNode" + + + // $ANTLR start "ruleTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:93:1: ruleTreeNode : ( ( rule__TreeNode__Group__0 ) ) ; + public final void ruleTreeNode() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:97:2: ( ( ( rule__TreeNode__Group__0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:98:2: ( ( rule__TreeNode__Group__0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:98:2: ( ( rule__TreeNode__Group__0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:99:3: ( rule__TreeNode__Group__0 ) + { + before(grammarAccess.getTreeNodeAccess().getGroup()); + // InternalIndentationAwareUiTestLanguageParser.g:100:3: ( rule__TreeNode__Group__0 ) + // InternalIndentationAwareUiTestLanguageParser.g:100:4: rule__TreeNode__Group__0 + { + pushFollow(FOLLOW_2); + rule__TreeNode__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getTreeNodeAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleTreeNode" + + + // $ANTLR start "entryRuleOtherTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:109:1: entryRuleOtherTreeNode : ruleOtherTreeNode EOF ; + public final void entryRuleOtherTreeNode() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageParser.g:110:1: ( ruleOtherTreeNode EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:111:1: ruleOtherTreeNode EOF + { + before(grammarAccess.getOtherTreeNodeRule()); + pushFollow(FOLLOW_1); + ruleOtherTreeNode(); + + state._fsp--; + + after(grammarAccess.getOtherTreeNodeRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleOtherTreeNode" + + + // $ANTLR start "ruleOtherTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:118:1: ruleOtherTreeNode : ( ( rule__OtherTreeNode__Group__0 ) ) ; + public final void ruleOtherTreeNode() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:122:2: ( ( ( rule__OtherTreeNode__Group__0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:123:2: ( ( rule__OtherTreeNode__Group__0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:123:2: ( ( rule__OtherTreeNode__Group__0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:124:3: ( rule__OtherTreeNode__Group__0 ) + { + before(grammarAccess.getOtherTreeNodeAccess().getGroup()); + // InternalIndentationAwareUiTestLanguageParser.g:125:3: ( rule__OtherTreeNode__Group__0 ) + // InternalIndentationAwareUiTestLanguageParser.g:125:4: rule__OtherTreeNode__Group__0 + { + pushFollow(FOLLOW_2); + rule__OtherTreeNode__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getOtherTreeNodeAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleOtherTreeNode" + + + // $ANTLR start "entryRuleChildList" + // InternalIndentationAwareUiTestLanguageParser.g:134:1: entryRuleChildList : ruleChildList EOF ; + public final void entryRuleChildList() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageParser.g:135:1: ( ruleChildList EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:136:1: ruleChildList EOF + { + before(grammarAccess.getChildListRule()); + pushFollow(FOLLOW_1); + ruleChildList(); + + state._fsp--; + + after(grammarAccess.getChildListRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleChildList" + + + // $ANTLR start "ruleChildList" + // InternalIndentationAwareUiTestLanguageParser.g:143:1: ruleChildList : ( ( rule__ChildList__Group__0 ) ) ; + public final void ruleChildList() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:147:2: ( ( ( rule__ChildList__Group__0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:148:2: ( ( rule__ChildList__Group__0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:148:2: ( ( rule__ChildList__Group__0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:149:3: ( rule__ChildList__Group__0 ) + { + before(grammarAccess.getChildListAccess().getGroup()); + // InternalIndentationAwareUiTestLanguageParser.g:150:3: ( rule__ChildList__Group__0 ) + // InternalIndentationAwareUiTestLanguageParser.g:150:4: rule__ChildList__Group__0 + { + pushFollow(FOLLOW_2); + rule__ChildList__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getChildListAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleChildList" + + + // $ANTLR start "rule__Tree__Group__0" + // InternalIndentationAwareUiTestLanguageParser.g:158:1: rule__Tree__Group__0 : rule__Tree__Group__0__Impl rule__Tree__Group__1 ; + public final void rule__Tree__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:162:1: ( rule__Tree__Group__0__Impl rule__Tree__Group__1 ) + // InternalIndentationAwareUiTestLanguageParser.g:163:2: rule__Tree__Group__0__Impl rule__Tree__Group__1 + { + pushFollow(FOLLOW_3); + rule__Tree__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Tree__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__0" + + + // $ANTLR start "rule__Tree__Group__0__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:170:1: rule__Tree__Group__0__Impl : ( () ) ; + public final void rule__Tree__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:174:1: ( ( () ) ) + // InternalIndentationAwareUiTestLanguageParser.g:175:1: ( () ) + { + // InternalIndentationAwareUiTestLanguageParser.g:175:1: ( () ) + // InternalIndentationAwareUiTestLanguageParser.g:176:2: () + { + before(grammarAccess.getTreeAccess().getTreeAction_0()); + // InternalIndentationAwareUiTestLanguageParser.g:177:2: () + // InternalIndentationAwareUiTestLanguageParser.g:177:3: + { + } + + after(grammarAccess.getTreeAccess().getTreeAction_0()); + + } + + + } + + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__0__Impl" + + + // $ANTLR start "rule__Tree__Group__1" + // InternalIndentationAwareUiTestLanguageParser.g:185:1: rule__Tree__Group__1 : rule__Tree__Group__1__Impl rule__Tree__Group__2 ; + public final void rule__Tree__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:189:1: ( rule__Tree__Group__1__Impl rule__Tree__Group__2 ) + // InternalIndentationAwareUiTestLanguageParser.g:190:2: rule__Tree__Group__1__Impl rule__Tree__Group__2 + { + pushFollow(FOLLOW_3); + rule__Tree__Group__1__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Tree__Group__2(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__1" + + + // $ANTLR start "rule__Tree__Group__1__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:197:1: rule__Tree__Group__1__Impl : ( ( rule__Tree__NodesAssignment_1 )* ) ; + public final void rule__Tree__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:201:1: ( ( ( rule__Tree__NodesAssignment_1 )* ) ) + // InternalIndentationAwareUiTestLanguageParser.g:202:1: ( ( rule__Tree__NodesAssignment_1 )* ) + { + // InternalIndentationAwareUiTestLanguageParser.g:202:1: ( ( rule__Tree__NodesAssignment_1 )* ) + // InternalIndentationAwareUiTestLanguageParser.g:203:2: ( rule__Tree__NodesAssignment_1 )* + { + before(grammarAccess.getTreeAccess().getNodesAssignment_1()); + // InternalIndentationAwareUiTestLanguageParser.g:204:2: ( rule__Tree__NodesAssignment_1 )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_ID) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:204:3: rule__Tree__NodesAssignment_1 + { + pushFollow(FOLLOW_4); + rule__Tree__NodesAssignment_1(); + + state._fsp--; + + + } + break; + + default : + break loop1; + } + } while (true); + + after(grammarAccess.getTreeAccess().getNodesAssignment_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__1__Impl" + + + // $ANTLR start "rule__Tree__Group__2" + // InternalIndentationAwareUiTestLanguageParser.g:212:1: rule__Tree__Group__2 : rule__Tree__Group__2__Impl ; + public final void rule__Tree__Group__2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:216:1: ( rule__Tree__Group__2__Impl ) + // InternalIndentationAwareUiTestLanguageParser.g:217:2: rule__Tree__Group__2__Impl + { + pushFollow(FOLLOW_2); + rule__Tree__Group__2__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__2" + + + // $ANTLR start "rule__Tree__Group__2__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:223:1: rule__Tree__Group__2__Impl : ( ( rule__Tree__MoreNodesAssignment_2 )* ) ; + public final void rule__Tree__Group__2__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:227:1: ( ( ( rule__Tree__MoreNodesAssignment_2 )* ) ) + // InternalIndentationAwareUiTestLanguageParser.g:228:1: ( ( rule__Tree__MoreNodesAssignment_2 )* ) + { + // InternalIndentationAwareUiTestLanguageParser.g:228:1: ( ( rule__Tree__MoreNodesAssignment_2 )* ) + // InternalIndentationAwareUiTestLanguageParser.g:229:2: ( rule__Tree__MoreNodesAssignment_2 )* + { + before(grammarAccess.getTreeAccess().getMoreNodesAssignment_2()); + // InternalIndentationAwareUiTestLanguageParser.g:230:2: ( rule__Tree__MoreNodesAssignment_2 )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0==RULE_STRING) ) { + alt2=1; + } + + + switch (alt2) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:230:3: rule__Tree__MoreNodesAssignment_2 + { + pushFollow(FOLLOW_5); + rule__Tree__MoreNodesAssignment_2(); + + state._fsp--; + + + } + break; + + default : + break loop2; + } + } while (true); + + after(grammarAccess.getTreeAccess().getMoreNodesAssignment_2()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__Group__2__Impl" + + + // $ANTLR start "rule__TreeNode__Group__0" + // InternalIndentationAwareUiTestLanguageParser.g:239:1: rule__TreeNode__Group__0 : rule__TreeNode__Group__0__Impl rule__TreeNode__Group__1 ; + public final void rule__TreeNode__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:243:1: ( rule__TreeNode__Group__0__Impl rule__TreeNode__Group__1 ) + // InternalIndentationAwareUiTestLanguageParser.g:244:2: rule__TreeNode__Group__0__Impl rule__TreeNode__Group__1 + { + pushFollow(FOLLOW_6); + rule__TreeNode__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__TreeNode__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group__0" + + + // $ANTLR start "rule__TreeNode__Group__0__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:251:1: rule__TreeNode__Group__0__Impl : ( ( rule__TreeNode__NameAssignment_0 ) ) ; + public final void rule__TreeNode__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:255:1: ( ( ( rule__TreeNode__NameAssignment_0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:256:1: ( ( rule__TreeNode__NameAssignment_0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:256:1: ( ( rule__TreeNode__NameAssignment_0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:257:2: ( rule__TreeNode__NameAssignment_0 ) + { + before(grammarAccess.getTreeNodeAccess().getNameAssignment_0()); + // InternalIndentationAwareUiTestLanguageParser.g:258:2: ( rule__TreeNode__NameAssignment_0 ) + // InternalIndentationAwareUiTestLanguageParser.g:258:3: rule__TreeNode__NameAssignment_0 + { + pushFollow(FOLLOW_2); + rule__TreeNode__NameAssignment_0(); + + state._fsp--; + + + } + + after(grammarAccess.getTreeNodeAccess().getNameAssignment_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group__0__Impl" + + + // $ANTLR start "rule__TreeNode__Group__1" + // InternalIndentationAwareUiTestLanguageParser.g:266:1: rule__TreeNode__Group__1 : rule__TreeNode__Group__1__Impl ; + public final void rule__TreeNode__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:270:1: ( rule__TreeNode__Group__1__Impl ) + // InternalIndentationAwareUiTestLanguageParser.g:271:2: rule__TreeNode__Group__1__Impl + { + pushFollow(FOLLOW_2); + rule__TreeNode__Group__1__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group__1" + + + // $ANTLR start "rule__TreeNode__Group__1__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:277:1: rule__TreeNode__Group__1__Impl : ( ( rule__TreeNode__Group_1__0 )? ) ; + public final void rule__TreeNode__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:281:1: ( ( ( rule__TreeNode__Group_1__0 )? ) ) + // InternalIndentationAwareUiTestLanguageParser.g:282:1: ( ( rule__TreeNode__Group_1__0 )? ) + { + // InternalIndentationAwareUiTestLanguageParser.g:282:1: ( ( rule__TreeNode__Group_1__0 )? ) + // InternalIndentationAwareUiTestLanguageParser.g:283:2: ( rule__TreeNode__Group_1__0 )? + { + before(grammarAccess.getTreeNodeAccess().getGroup_1()); + // InternalIndentationAwareUiTestLanguageParser.g:284:2: ( rule__TreeNode__Group_1__0 )? + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0==RULE_INDENT) ) { + alt3=1; + } + switch (alt3) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:284:3: rule__TreeNode__Group_1__0 + { + pushFollow(FOLLOW_2); + rule__TreeNode__Group_1__0(); + + state._fsp--; + + + } + break; + + } + + after(grammarAccess.getTreeNodeAccess().getGroup_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group__1__Impl" + + + // $ANTLR start "rule__TreeNode__Group_1__0" + // InternalIndentationAwareUiTestLanguageParser.g:293:1: rule__TreeNode__Group_1__0 : rule__TreeNode__Group_1__0__Impl rule__TreeNode__Group_1__1 ; + public final void rule__TreeNode__Group_1__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:297:1: ( rule__TreeNode__Group_1__0__Impl rule__TreeNode__Group_1__1 ) + // InternalIndentationAwareUiTestLanguageParser.g:298:2: rule__TreeNode__Group_1__0__Impl rule__TreeNode__Group_1__1 + { + pushFollow(FOLLOW_7); + rule__TreeNode__Group_1__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__TreeNode__Group_1__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__0" + + + // $ANTLR start "rule__TreeNode__Group_1__0__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:305:1: rule__TreeNode__Group_1__0__Impl : ( RULE_INDENT ) ; + public final void rule__TreeNode__Group_1__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:309:1: ( ( RULE_INDENT ) ) + // InternalIndentationAwareUiTestLanguageParser.g:310:1: ( RULE_INDENT ) + { + // InternalIndentationAwareUiTestLanguageParser.g:310:1: ( RULE_INDENT ) + // InternalIndentationAwareUiTestLanguageParser.g:311:2: RULE_INDENT + { + before(grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); + match(input,RULE_INDENT,FOLLOW_2); + after(grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__0__Impl" + + + // $ANTLR start "rule__TreeNode__Group_1__1" + // InternalIndentationAwareUiTestLanguageParser.g:320:1: rule__TreeNode__Group_1__1 : rule__TreeNode__Group_1__1__Impl rule__TreeNode__Group_1__2 ; + public final void rule__TreeNode__Group_1__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:324:1: ( rule__TreeNode__Group_1__1__Impl rule__TreeNode__Group_1__2 ) + // InternalIndentationAwareUiTestLanguageParser.g:325:2: rule__TreeNode__Group_1__1__Impl rule__TreeNode__Group_1__2 + { + pushFollow(FOLLOW_7); + rule__TreeNode__Group_1__1__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__TreeNode__Group_1__2(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__1" + + + // $ANTLR start "rule__TreeNode__Group_1__1__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:332:1: rule__TreeNode__Group_1__1__Impl : ( ( rule__TreeNode__ChildrenAssignment_1_1 )* ) ; + public final void rule__TreeNode__Group_1__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:336:1: ( ( ( rule__TreeNode__ChildrenAssignment_1_1 )* ) ) + // InternalIndentationAwareUiTestLanguageParser.g:337:1: ( ( rule__TreeNode__ChildrenAssignment_1_1 )* ) + { + // InternalIndentationAwareUiTestLanguageParser.g:337:1: ( ( rule__TreeNode__ChildrenAssignment_1_1 )* ) + // InternalIndentationAwareUiTestLanguageParser.g:338:2: ( rule__TreeNode__ChildrenAssignment_1_1 )* + { + before(grammarAccess.getTreeNodeAccess().getChildrenAssignment_1_1()); + // InternalIndentationAwareUiTestLanguageParser.g:339:2: ( rule__TreeNode__ChildrenAssignment_1_1 )* + loop4: + do { + int alt4=2; + int LA4_0 = input.LA(1); + + if ( (LA4_0==RULE_ID) ) { + alt4=1; + } + + + switch (alt4) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:339:3: rule__TreeNode__ChildrenAssignment_1_1 + { + pushFollow(FOLLOW_4); + rule__TreeNode__ChildrenAssignment_1_1(); + + state._fsp--; + + + } + break; + + default : + break loop4; + } + } while (true); + + after(grammarAccess.getTreeNodeAccess().getChildrenAssignment_1_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__1__Impl" + + + // $ANTLR start "rule__TreeNode__Group_1__2" + // InternalIndentationAwareUiTestLanguageParser.g:347:1: rule__TreeNode__Group_1__2 : rule__TreeNode__Group_1__2__Impl ; + public final void rule__TreeNode__Group_1__2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:351:1: ( rule__TreeNode__Group_1__2__Impl ) + // InternalIndentationAwareUiTestLanguageParser.g:352:2: rule__TreeNode__Group_1__2__Impl + { + pushFollow(FOLLOW_2); + rule__TreeNode__Group_1__2__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__2" + + + // $ANTLR start "rule__TreeNode__Group_1__2__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:358:1: rule__TreeNode__Group_1__2__Impl : ( RULE_DEDENT ) ; + public final void rule__TreeNode__Group_1__2__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:362:1: ( ( RULE_DEDENT ) ) + // InternalIndentationAwareUiTestLanguageParser.g:363:1: ( RULE_DEDENT ) + { + // InternalIndentationAwareUiTestLanguageParser.g:363:1: ( RULE_DEDENT ) + // InternalIndentationAwareUiTestLanguageParser.g:364:2: RULE_DEDENT + { + before(grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); + match(input,RULE_DEDENT,FOLLOW_2); + after(grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__Group_1__2__Impl" + + + // $ANTLR start "rule__OtherTreeNode__Group__0" + // InternalIndentationAwareUiTestLanguageParser.g:374:1: rule__OtherTreeNode__Group__0 : rule__OtherTreeNode__Group__0__Impl rule__OtherTreeNode__Group__1 ; + public final void rule__OtherTreeNode__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:378:1: ( rule__OtherTreeNode__Group__0__Impl rule__OtherTreeNode__Group__1 ) + // InternalIndentationAwareUiTestLanguageParser.g:379:2: rule__OtherTreeNode__Group__0__Impl rule__OtherTreeNode__Group__1 + { + pushFollow(FOLLOW_6); + rule__OtherTreeNode__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__OtherTreeNode__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__Group__0" + + + // $ANTLR start "rule__OtherTreeNode__Group__0__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:386:1: rule__OtherTreeNode__Group__0__Impl : ( ( rule__OtherTreeNode__NameAssignment_0 ) ) ; + public final void rule__OtherTreeNode__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:390:1: ( ( ( rule__OtherTreeNode__NameAssignment_0 ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:391:1: ( ( rule__OtherTreeNode__NameAssignment_0 ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:391:1: ( ( rule__OtherTreeNode__NameAssignment_0 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:392:2: ( rule__OtherTreeNode__NameAssignment_0 ) + { + before(grammarAccess.getOtherTreeNodeAccess().getNameAssignment_0()); + // InternalIndentationAwareUiTestLanguageParser.g:393:2: ( rule__OtherTreeNode__NameAssignment_0 ) + // InternalIndentationAwareUiTestLanguageParser.g:393:3: rule__OtherTreeNode__NameAssignment_0 + { + pushFollow(FOLLOW_2); + rule__OtherTreeNode__NameAssignment_0(); + + state._fsp--; + + + } + + after(grammarAccess.getOtherTreeNodeAccess().getNameAssignment_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__Group__0__Impl" + + + // $ANTLR start "rule__OtherTreeNode__Group__1" + // InternalIndentationAwareUiTestLanguageParser.g:401:1: rule__OtherTreeNode__Group__1 : rule__OtherTreeNode__Group__1__Impl ; + public final void rule__OtherTreeNode__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:405:1: ( rule__OtherTreeNode__Group__1__Impl ) + // InternalIndentationAwareUiTestLanguageParser.g:406:2: rule__OtherTreeNode__Group__1__Impl + { + pushFollow(FOLLOW_2); + rule__OtherTreeNode__Group__1__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__Group__1" + + + // $ANTLR start "rule__OtherTreeNode__Group__1__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:412:1: rule__OtherTreeNode__Group__1__Impl : ( ( rule__OtherTreeNode__ChildListAssignment_1 )? ) ; + public final void rule__OtherTreeNode__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:416:1: ( ( ( rule__OtherTreeNode__ChildListAssignment_1 )? ) ) + // InternalIndentationAwareUiTestLanguageParser.g:417:1: ( ( rule__OtherTreeNode__ChildListAssignment_1 )? ) + { + // InternalIndentationAwareUiTestLanguageParser.g:417:1: ( ( rule__OtherTreeNode__ChildListAssignment_1 )? ) + // InternalIndentationAwareUiTestLanguageParser.g:418:2: ( rule__OtherTreeNode__ChildListAssignment_1 )? + { + before(grammarAccess.getOtherTreeNodeAccess().getChildListAssignment_1()); + // InternalIndentationAwareUiTestLanguageParser.g:419:2: ( rule__OtherTreeNode__ChildListAssignment_1 )? + int alt5=2; + int LA5_0 = input.LA(1); + + if ( (LA5_0==RULE_INDENT) ) { + alt5=1; + } + switch (alt5) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:419:3: rule__OtherTreeNode__ChildListAssignment_1 + { + pushFollow(FOLLOW_2); + rule__OtherTreeNode__ChildListAssignment_1(); + + state._fsp--; + + + } + break; + + } + + after(grammarAccess.getOtherTreeNodeAccess().getChildListAssignment_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__Group__1__Impl" + + + // $ANTLR start "rule__ChildList__Group__0" + // InternalIndentationAwareUiTestLanguageParser.g:428:1: rule__ChildList__Group__0 : rule__ChildList__Group__0__Impl rule__ChildList__Group__1 ; + public final void rule__ChildList__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:432:1: ( rule__ChildList__Group__0__Impl rule__ChildList__Group__1 ) + // InternalIndentationAwareUiTestLanguageParser.g:433:2: rule__ChildList__Group__0__Impl rule__ChildList__Group__1 + { + pushFollow(FOLLOW_6); + rule__ChildList__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__ChildList__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__0" + + + // $ANTLR start "rule__ChildList__Group__0__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:440:1: rule__ChildList__Group__0__Impl : ( () ) ; + public final void rule__ChildList__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:444:1: ( ( () ) ) + // InternalIndentationAwareUiTestLanguageParser.g:445:1: ( () ) + { + // InternalIndentationAwareUiTestLanguageParser.g:445:1: ( () ) + // InternalIndentationAwareUiTestLanguageParser.g:446:2: () + { + before(grammarAccess.getChildListAccess().getChildListAction_0()); + // InternalIndentationAwareUiTestLanguageParser.g:447:2: () + // InternalIndentationAwareUiTestLanguageParser.g:447:3: + { + } + + after(grammarAccess.getChildListAccess().getChildListAction_0()); + + } + + + } + + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__0__Impl" + + + // $ANTLR start "rule__ChildList__Group__1" + // InternalIndentationAwareUiTestLanguageParser.g:455:1: rule__ChildList__Group__1 : rule__ChildList__Group__1__Impl rule__ChildList__Group__2 ; + public final void rule__ChildList__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:459:1: ( rule__ChildList__Group__1__Impl rule__ChildList__Group__2 ) + // InternalIndentationAwareUiTestLanguageParser.g:460:2: rule__ChildList__Group__1__Impl rule__ChildList__Group__2 + { + pushFollow(FOLLOW_8); + rule__ChildList__Group__1__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__ChildList__Group__2(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__1" + + + // $ANTLR start "rule__ChildList__Group__1__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:467:1: rule__ChildList__Group__1__Impl : ( RULE_INDENT ) ; + public final void rule__ChildList__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:471:1: ( ( RULE_INDENT ) ) + // InternalIndentationAwareUiTestLanguageParser.g:472:1: ( RULE_INDENT ) + { + // InternalIndentationAwareUiTestLanguageParser.g:472:1: ( RULE_INDENT ) + // InternalIndentationAwareUiTestLanguageParser.g:473:2: RULE_INDENT + { + before(grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + match(input,RULE_INDENT,FOLLOW_2); + after(grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__1__Impl" + + + // $ANTLR start "rule__ChildList__Group__2" + // InternalIndentationAwareUiTestLanguageParser.g:482:1: rule__ChildList__Group__2 : rule__ChildList__Group__2__Impl rule__ChildList__Group__3 ; + public final void rule__ChildList__Group__2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:486:1: ( rule__ChildList__Group__2__Impl rule__ChildList__Group__3 ) + // InternalIndentationAwareUiTestLanguageParser.g:487:2: rule__ChildList__Group__2__Impl rule__ChildList__Group__3 + { + pushFollow(FOLLOW_9); + rule__ChildList__Group__2__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__ChildList__Group__3(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__2" + + + // $ANTLR start "rule__ChildList__Group__2__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:494:1: rule__ChildList__Group__2__Impl : ( ( ( rule__ChildList__ChildrenAssignment_2 ) ) ( ( rule__ChildList__ChildrenAssignment_2 )* ) ) ; + public final void rule__ChildList__Group__2__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:498:1: ( ( ( ( rule__ChildList__ChildrenAssignment_2 ) ) ( ( rule__ChildList__ChildrenAssignment_2 )* ) ) ) + // InternalIndentationAwareUiTestLanguageParser.g:499:1: ( ( ( rule__ChildList__ChildrenAssignment_2 ) ) ( ( rule__ChildList__ChildrenAssignment_2 )* ) ) + { + // InternalIndentationAwareUiTestLanguageParser.g:499:1: ( ( ( rule__ChildList__ChildrenAssignment_2 ) ) ( ( rule__ChildList__ChildrenAssignment_2 )* ) ) + // InternalIndentationAwareUiTestLanguageParser.g:500:2: ( ( rule__ChildList__ChildrenAssignment_2 ) ) ( ( rule__ChildList__ChildrenAssignment_2 )* ) + { + // InternalIndentationAwareUiTestLanguageParser.g:500:2: ( ( rule__ChildList__ChildrenAssignment_2 ) ) + // InternalIndentationAwareUiTestLanguageParser.g:501:3: ( rule__ChildList__ChildrenAssignment_2 ) + { + before(grammarAccess.getChildListAccess().getChildrenAssignment_2()); + // InternalIndentationAwareUiTestLanguageParser.g:502:3: ( rule__ChildList__ChildrenAssignment_2 ) + // InternalIndentationAwareUiTestLanguageParser.g:502:4: rule__ChildList__ChildrenAssignment_2 + { + pushFollow(FOLLOW_5); + rule__ChildList__ChildrenAssignment_2(); + + state._fsp--; + + + } + + after(grammarAccess.getChildListAccess().getChildrenAssignment_2()); + + } + + // InternalIndentationAwareUiTestLanguageParser.g:505:2: ( ( rule__ChildList__ChildrenAssignment_2 )* ) + // InternalIndentationAwareUiTestLanguageParser.g:506:3: ( rule__ChildList__ChildrenAssignment_2 )* + { + before(grammarAccess.getChildListAccess().getChildrenAssignment_2()); + // InternalIndentationAwareUiTestLanguageParser.g:507:3: ( rule__ChildList__ChildrenAssignment_2 )* + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==RULE_STRING) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:507:4: rule__ChildList__ChildrenAssignment_2 + { + pushFollow(FOLLOW_5); + rule__ChildList__ChildrenAssignment_2(); + + state._fsp--; + + + } + break; + + default : + break loop6; + } + } while (true); + + after(grammarAccess.getChildListAccess().getChildrenAssignment_2()); + + } + + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__2__Impl" + + + // $ANTLR start "rule__ChildList__Group__3" + // InternalIndentationAwareUiTestLanguageParser.g:516:1: rule__ChildList__Group__3 : rule__ChildList__Group__3__Impl ; + public final void rule__ChildList__Group__3() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:520:1: ( rule__ChildList__Group__3__Impl ) + // InternalIndentationAwareUiTestLanguageParser.g:521:2: rule__ChildList__Group__3__Impl + { + pushFollow(FOLLOW_2); + rule__ChildList__Group__3__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__3" + + + // $ANTLR start "rule__ChildList__Group__3__Impl" + // InternalIndentationAwareUiTestLanguageParser.g:527:1: rule__ChildList__Group__3__Impl : ( RULE_DEDENT ) ; + public final void rule__ChildList__Group__3__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:531:1: ( ( RULE_DEDENT ) ) + // InternalIndentationAwareUiTestLanguageParser.g:532:1: ( RULE_DEDENT ) + { + // InternalIndentationAwareUiTestLanguageParser.g:532:1: ( RULE_DEDENT ) + // InternalIndentationAwareUiTestLanguageParser.g:533:2: RULE_DEDENT + { + before(grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + match(input,RULE_DEDENT,FOLLOW_2); + after(grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__Group__3__Impl" + + + // $ANTLR start "rule__Tree__NodesAssignment_1" + // InternalIndentationAwareUiTestLanguageParser.g:543:1: rule__Tree__NodesAssignment_1 : ( ruleTreeNode ) ; + public final void rule__Tree__NodesAssignment_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:547:1: ( ( ruleTreeNode ) ) + // InternalIndentationAwareUiTestLanguageParser.g:548:2: ( ruleTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:548:2: ( ruleTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:549:3: ruleTreeNode + { + before(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); + pushFollow(FOLLOW_2); + ruleTreeNode(); + + state._fsp--; + + after(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__NodesAssignment_1" + + + // $ANTLR start "rule__Tree__MoreNodesAssignment_2" + // InternalIndentationAwareUiTestLanguageParser.g:558:1: rule__Tree__MoreNodesAssignment_2 : ( ruleOtherTreeNode ) ; + public final void rule__Tree__MoreNodesAssignment_2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:562:1: ( ( ruleOtherTreeNode ) ) + // InternalIndentationAwareUiTestLanguageParser.g:563:2: ( ruleOtherTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:563:2: ( ruleOtherTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:564:3: ruleOtherTreeNode + { + before(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + pushFollow(FOLLOW_2); + ruleOtherTreeNode(); + + state._fsp--; + + after(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Tree__MoreNodesAssignment_2" + + + // $ANTLR start "rule__TreeNode__NameAssignment_0" + // InternalIndentationAwareUiTestLanguageParser.g:573:1: rule__TreeNode__NameAssignment_0 : ( RULE_ID ) ; + public final void rule__TreeNode__NameAssignment_0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:577:1: ( ( RULE_ID ) ) + // InternalIndentationAwareUiTestLanguageParser.g:578:2: ( RULE_ID ) + { + // InternalIndentationAwareUiTestLanguageParser.g:578:2: ( RULE_ID ) + // InternalIndentationAwareUiTestLanguageParser.g:579:3: RULE_ID + { + before(grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); + match(input,RULE_ID,FOLLOW_2); + after(grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__NameAssignment_0" + + + // $ANTLR start "rule__TreeNode__ChildrenAssignment_1_1" + // InternalIndentationAwareUiTestLanguageParser.g:588:1: rule__TreeNode__ChildrenAssignment_1_1 : ( ruleTreeNode ) ; + public final void rule__TreeNode__ChildrenAssignment_1_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:592:1: ( ( ruleTreeNode ) ) + // InternalIndentationAwareUiTestLanguageParser.g:593:2: ( ruleTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:593:2: ( ruleTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:594:3: ruleTreeNode + { + before(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); + pushFollow(FOLLOW_2); + ruleTreeNode(); + + state._fsp--; + + after(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__TreeNode__ChildrenAssignment_1_1" + + + // $ANTLR start "rule__OtherTreeNode__NameAssignment_0" + // InternalIndentationAwareUiTestLanguageParser.g:603:1: rule__OtherTreeNode__NameAssignment_0 : ( RULE_STRING ) ; + public final void rule__OtherTreeNode__NameAssignment_0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:607:1: ( ( RULE_STRING ) ) + // InternalIndentationAwareUiTestLanguageParser.g:608:2: ( RULE_STRING ) + { + // InternalIndentationAwareUiTestLanguageParser.g:608:2: ( RULE_STRING ) + // InternalIndentationAwareUiTestLanguageParser.g:609:3: RULE_STRING + { + before(grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + match(input,RULE_STRING,FOLLOW_2); + after(grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__NameAssignment_0" + + + // $ANTLR start "rule__OtherTreeNode__ChildListAssignment_1" + // InternalIndentationAwareUiTestLanguageParser.g:618:1: rule__OtherTreeNode__ChildListAssignment_1 : ( ruleChildList ) ; + public final void rule__OtherTreeNode__ChildListAssignment_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:622:1: ( ( ruleChildList ) ) + // InternalIndentationAwareUiTestLanguageParser.g:623:2: ( ruleChildList ) + { + // InternalIndentationAwareUiTestLanguageParser.g:623:2: ( ruleChildList ) + // InternalIndentationAwareUiTestLanguageParser.g:624:3: ruleChildList + { + before(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + pushFollow(FOLLOW_2); + ruleChildList(); + + state._fsp--; + + after(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__OtherTreeNode__ChildListAssignment_1" + + + // $ANTLR start "rule__ChildList__ChildrenAssignment_2" + // InternalIndentationAwareUiTestLanguageParser.g:633:1: rule__ChildList__ChildrenAssignment_2 : ( ruleOtherTreeNode ) ; + public final void rule__ChildList__ChildrenAssignment_2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:637:1: ( ( ruleOtherTreeNode ) ) + // InternalIndentationAwareUiTestLanguageParser.g:638:2: ( ruleOtherTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:638:2: ( ruleOtherTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:639:3: ruleOtherTreeNode + { + before(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + pushFollow(FOLLOW_2); + ruleOtherTreeNode(); + + state._fsp--; + + after(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__ChildList__ChildrenAssignment_2" + + // Delegated rules + + + + + public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000280L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000082L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000202L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000000020L}); + public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x00000000000000C0L}); + public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000000040L}); + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens new file mode 100644 index 0000000000..eae27a90fe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens @@ -0,0 +1,9 @@ +RULE_ANY_OTHER=12 +RULE_DEDENT=6 +RULE_ID=7 +RULE_INDENT=5 +RULE_INT=8 +RULE_ML_COMMENT=10 +RULE_SL_COMMENT=4 +RULE_STRING=9 +RULE_WS=11 diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g new file mode 100644 index 0000000000..20883cc79d --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +lexer grammar InternalIndentationAwareUiTestLanguageLexer; + +@header { +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.lexer; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +} + +RULE_SL_COMMENT : '//' ~(('\n'|'\r'))*; + +fragment RULE_INDENT : ; + +fragment RULE_DEDENT : ; + +RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + +RULE_INT : ('0'..'9')+; + +RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); + +RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; + +RULE_WS : (' '|'\t'|'\r'|'\n')+; + +RULE_ANY_OTHER : .; diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java new file mode 100644 index 0000000000..ba93288abe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java @@ -0,0 +1,707 @@ +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.lexer; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalIndentationAwareUiTestLanguageLexer extends Lexer { + public static final int RULE_DEDENT=6; + public static final int RULE_ID=7; + public static final int RULE_WS=11; + public static final int RULE_STRING=9; + public static final int RULE_ANY_OTHER=12; + public static final int RULE_SL_COMMENT=4; + public static final int RULE_INT=8; + public static final int RULE_ML_COMMENT=10; + public static final int EOF=-1; + public static final int RULE_INDENT=5; + + // delegates + // delegators + + public InternalIndentationAwareUiTestLanguageLexer() {;} + public InternalIndentationAwareUiTestLanguageLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + public InternalIndentationAwareUiTestLanguageLexer(CharStream input, RecognizerSharedState state) { + super(input,state); + + } + public String getGrammarFileName() { return "InternalIndentationAwareUiTestLanguageLexer.g"; } + + // $ANTLR start "RULE_SL_COMMENT" + public final void mRULE_SL_COMMENT() throws RecognitionException { + try { + int _type = RULE_SL_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:18:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ) + // InternalIndentationAwareUiTestLanguageLexer.g:18:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* + { + match("//"); + + // InternalIndentationAwareUiTestLanguageLexer.g:18:24: (~ ( ( '\\n' | '\\r' ) ) )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( ((LA1_0>='\u0000' && LA1_0<='\t')||(LA1_0>='\u000B' && LA1_0<='\f')||(LA1_0>='\u000E' && LA1_0<='\uFFFF')) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:18:24: ~ ( ( '\\n' | '\\r' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop1; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_SL_COMMENT" + + // $ANTLR start "RULE_INDENT" + public final void mRULE_INDENT() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageLexer.g:20:22: () + // InternalIndentationAwareUiTestLanguageLexer.g:20:24: + { + } + + } + finally { + } + } + // $ANTLR end "RULE_INDENT" + + // $ANTLR start "RULE_DEDENT" + public final void mRULE_DEDENT() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageLexer.g:22:22: () + // InternalIndentationAwareUiTestLanguageLexer.g:22:24: + { + } + + } + finally { + } + } + // $ANTLR end "RULE_DEDENT" + + // $ANTLR start "RULE_ID" + public final void mRULE_ID() throws RecognitionException { + try { + int _type = RULE_ID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:24:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + { + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: ( '^' )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0=='^') ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: '^' + { + match('^'); + + } + break; + + } + + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // InternalIndentationAwareUiTestLanguageLexer.g:24:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( ((LA3_0>='0' && LA3_0<='9')||(LA3_0>='A' && LA3_0<='Z')||LA3_0=='_'||(LA3_0>='a' && LA3_0<='z')) ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop3; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ID" + + // $ANTLR start "RULE_INT" + public final void mRULE_INT() throws RecognitionException { + try { + int _type = RULE_INT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:26:10: ( ( '0' .. '9' )+ ) + // InternalIndentationAwareUiTestLanguageLexer.g:26:12: ( '0' .. '9' )+ + { + // InternalIndentationAwareUiTestLanguageLexer.g:26:12: ( '0' .. '9' )+ + int cnt4=0; + loop4: + do { + int alt4=2; + int LA4_0 = input.LA(1); + + if ( ((LA4_0>='0' && LA4_0<='9')) ) { + alt4=1; + } + + + switch (alt4) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:26:13: '0' .. '9' + { + matchRange('0','9'); + + } + break; + + default : + if ( cnt4 >= 1 ) break loop4; + EarlyExitException eee = + new EarlyExitException(4, input); + throw eee; + } + cnt4++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_INT" + + // $ANTLR start "RULE_STRING" + public final void mRULE_STRING() throws RecognitionException { + try { + int _type = RULE_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:28:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalIndentationAwareUiTestLanguageLexer.g:28:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + { + // InternalIndentationAwareUiTestLanguageLexer.g:28:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + int alt7=2; + int LA7_0 = input.LA(1); + + if ( (LA7_0=='\"') ) { + alt7=1; + } + else if ( (LA7_0=='\'') ) { + alt7=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 7, 0, input); + + throw nvae; + } + switch (alt7) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + { + match('\"'); + // InternalIndentationAwareUiTestLanguageLexer.g:28:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + loop5: + do { + int alt5=3; + int LA5_0 = input.LA(1); + + if ( (LA5_0=='\\') ) { + alt5=1; + } + else if ( ((LA5_0>='\u0000' && LA5_0<='!')||(LA5_0>='#' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) { + alt5=2; + } + + + switch (alt5) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:21: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:28: ~ ( ( '\\\\' | '\"' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop5; + } + } while (true); + + match('\"'); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + { + match('\''); + // InternalIndentationAwareUiTestLanguageLexer.g:28:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + loop6: + do { + int alt6=3; + int LA6_0 = input.LA(1); + + if ( (LA6_0=='\\') ) { + alt6=1; + } + else if ( ((LA6_0>='\u0000' && LA6_0<='&')||(LA6_0>='(' && LA6_0<='[')||(LA6_0>=']' && LA6_0<='\uFFFF')) ) { + alt6=2; + } + + + switch (alt6) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:54: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:61: ~ ( ( '\\\\' | '\\'' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop6; + } + } while (true); + + match('\''); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_STRING" + + // $ANTLR start "RULE_ML_COMMENT" + public final void mRULE_ML_COMMENT() throws RecognitionException { + try { + int _type = RULE_ML_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:30:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalIndentationAwareUiTestLanguageLexer.g:30:19: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); + + // InternalIndentationAwareUiTestLanguageLexer.g:30:24: ( options {greedy=false; } : . )* + loop8: + do { + int alt8=2; + int LA8_0 = input.LA(1); + + if ( (LA8_0=='*') ) { + int LA8_1 = input.LA(2); + + if ( (LA8_1=='/') ) { + alt8=2; + } + else if ( ((LA8_1>='\u0000' && LA8_1<='.')||(LA8_1>='0' && LA8_1<='\uFFFF')) ) { + alt8=1; + } + + + } + else if ( ((LA8_0>='\u0000' && LA8_0<=')')||(LA8_0>='+' && LA8_0<='\uFFFF')) ) { + alt8=1; + } + + + switch (alt8) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:30:52: . + { + matchAny(); + + } + break; + + default : + break loop8; + } + } while (true); + + match("*/"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ML_COMMENT" + + // $ANTLR start "RULE_WS" + public final void mRULE_WS() throws RecognitionException { + try { + int _type = RULE_WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:32:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalIndentationAwareUiTestLanguageLexer.g:32:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + { + // InternalIndentationAwareUiTestLanguageLexer.g:32:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + int cnt9=0; + loop9: + do { + int alt9=2; + int LA9_0 = input.LA(1); + + if ( ((LA9_0>='\t' && LA9_0<='\n')||LA9_0=='\r'||LA9_0==' ') ) { + alt9=1; + } + + + switch (alt9) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g: + { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + if ( cnt9 >= 1 ) break loop9; + EarlyExitException eee = + new EarlyExitException(9, input); + throw eee; + } + cnt9++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_WS" + + // $ANTLR start "RULE_ANY_OTHER" + public final void mRULE_ANY_OTHER() throws RecognitionException { + try { + int _type = RULE_ANY_OTHER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:34:16: ( . ) + // InternalIndentationAwareUiTestLanguageLexer.g:34:18: . + { + matchAny(); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ANY_OTHER" + + public void mTokens() throws RecognitionException { + // InternalIndentationAwareUiTestLanguageLexer.g:1:8: ( RULE_SL_COMMENT | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt10=7; + alt10 = dfa10.predict(input); + switch (alt10) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:10: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:26: RULE_ID + { + mRULE_ID(); + + } + break; + case 3 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:34: RULE_INT + { + mRULE_INT(); + + } + break; + case 4 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:43: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 5 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:55: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 6 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:71: RULE_WS + { + mRULE_WS(); + + } + break; + case 7 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:79: RULE_ANY_OTHER + { + mRULE_ANY_OTHER(); + + } + break; + + } + + } + + + protected DFA10 dfa10 = new DFA10(this); + static final String DFA10_eotS = + "\1\uffff\2\10\2\uffff\2\10\10\uffff"; + static final String DFA10_eofS = + "\17\uffff"; + static final String DFA10_minS = + "\1\0\1\52\1\101\2\uffff\2\0\10\uffff"; + static final String DFA10_maxS = + "\1\uffff\1\57\1\172\2\uffff\2\uffff\10\uffff"; + static final String DFA10_acceptS = + "\3\uffff\1\2\1\3\2\uffff\1\6\1\7\1\1\1\5\1\2\1\3\1\4\1\6"; + static final String DFA10_specialS = + "\1\2\4\uffff\1\0\1\1\10\uffff}>"; + static final String[] DFA10_transitionS = { + "\11\10\2\7\2\10\1\7\22\10\1\7\1\10\1\5\4\10\1\6\7\10\1\1\12\4\7\10\32\3\3\10\1\2\1\3\1\10\32\3\uff85\10", + "\1\12\4\uffff\1\11", + "\32\13\4\uffff\1\13\1\uffff\32\13", + "", + "", + "\0\15", + "\0\15", + "", + "", + "", + "", + "", + "", + "", + "" + }; + + static final short[] DFA10_eot = DFA.unpackEncodedString(DFA10_eotS); + static final short[] DFA10_eof = DFA.unpackEncodedString(DFA10_eofS); + static final char[] DFA10_min = DFA.unpackEncodedStringToUnsignedChars(DFA10_minS); + static final char[] DFA10_max = DFA.unpackEncodedStringToUnsignedChars(DFA10_maxS); + static final short[] DFA10_accept = DFA.unpackEncodedString(DFA10_acceptS); + static final short[] DFA10_special = DFA.unpackEncodedString(DFA10_specialS); + static final short[][] DFA10_transition; + + static { + int numStates = DFA10_transitionS.length; + DFA10_transition = new short[numStates][]; + for (int i=0; i='\u0000' && LA10_5<='\uFFFF')) ) {s = 13;} + + else s = 8; + + if ( s>=0 ) return s; + break; + case 1 : + int LA10_6 = input.LA(1); + + s = -1; + if ( ((LA10_6>='\u0000' && LA10_6<='\uFFFF')) ) {s = 13;} + + else s = 8; + + if ( s>=0 ) return s; + break; + case 2 : + int LA10_0 = input.LA(1); + + s = -1; + if ( (LA10_0=='/') ) {s = 1;} + + else if ( (LA10_0=='^') ) {s = 2;} + + else if ( ((LA10_0>='A' && LA10_0<='Z')||LA10_0=='_'||(LA10_0>='a' && LA10_0<='z')) ) {s = 3;} + + else if ( ((LA10_0>='0' && LA10_0<='9')) ) {s = 4;} + + else if ( (LA10_0=='\"') ) {s = 5;} + + else if ( (LA10_0=='\'') ) {s = 6;} + + else if ( ((LA10_0>='\t' && LA10_0<='\n')||LA10_0=='\r'||LA10_0==' ') ) {s = 7;} + + else if ( ((LA10_0>='\u0000' && LA10_0<='\b')||(LA10_0>='\u000B' && LA10_0<='\f')||(LA10_0>='\u000E' && LA10_0<='\u001F')||LA10_0=='!'||(LA10_0>='#' && LA10_0<='&')||(LA10_0>='(' && LA10_0<='.')||(LA10_0>=':' && LA10_0<='@')||(LA10_0>='[' && LA10_0<=']')||LA10_0=='`'||(LA10_0>='{' && LA10_0<='\uFFFF')) ) {s = 8;} + + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 10, _s, input); + error(nvae); + throw nvae; + } + } + + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens new file mode 100644 index 0000000000..eae27a90fe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens @@ -0,0 +1,9 @@ +RULE_ANY_OTHER=12 +RULE_DEDENT=6 +RULE_ID=7 +RULE_INDENT=5 +RULE_INT=8 +RULE_ML_COMMENT=10 +RULE_SL_COMMENT=4 +RULE_STRING=9 +RULE_WS=11 diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/ChildList.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/ChildList.java new file mode 100644 index 0000000000..34e526d463 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/ChildList.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Child List'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList#getChildren Children}
  • + *
+ * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getChildList() + * @model + * @generated + */ +public interface ChildList extends EObject +{ + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode}. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getChildList_Children() + * @model containment="true" + * @generated + */ + EList getChildren(); + +} // ChildList diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguageFactory.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguageFactory.java new file mode 100644 index 0000000000..4b2e2f5b75 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguageFactory.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage + * @generated + */ +public interface IndentationAwareUiTestLanguageFactory extends EFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + IndentationAwareUiTestLanguageFactory eINSTANCE = org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguageFactoryImpl.init(); + + /** + * Returns a new object of class 'Tree'. + * + * + * @return a new object of class 'Tree'. + * @generated + */ + Tree createTree(); + + /** + * Returns a new object of class 'Tree Node'. + * + * + * @return a new object of class 'Tree Node'. + * @generated + */ + TreeNode createTreeNode(); + + /** + * Returns a new object of class 'Other Tree Node'. + * + * + * @return a new object of class 'Other Tree Node'. + * @generated + */ + OtherTreeNode createOtherTreeNode(); + + /** + * Returns a new object of class 'Child List'. + * + * + * @return a new object of class 'Child List'. + * @generated + */ + ChildList createChildList(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + IndentationAwareUiTestLanguagePackage getIndentationAwareUiTestLanguagePackage(); + +} //IndentationAwareUiTestLanguageFactory diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguagePackage.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguagePackage.java new file mode 100644 index 0000000000..bee2d81194 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/IndentationAwareUiTestLanguagePackage.java @@ -0,0 +1,442 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguageFactory + * @model kind="package" + * @generated + */ +public interface IndentationAwareUiTestLanguagePackage extends EPackage +{ + /** + * The package name. + * + * + * @generated + */ + String eNAME = "indentationAwareUiTestLanguage"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "indentationAwareUiTestLanguage"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + IndentationAwareUiTestLanguagePackage eINSTANCE = org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl Tree}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getTree() + * @generated + */ + int TREE = 0; + + /** + * The feature id for the 'Nodes' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE__NODES = 0; + + /** + * The feature id for the 'More Nodes' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE__MORE_NODES = 1; + + /** + * The number of structural features of the 'Tree' class. + * + * + * @generated + * @ordered + */ + int TREE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getTreeNode() + * @generated + */ + int TREE_NODE = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__NAME = 0; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE_NODE__CHILDREN = 1; + + /** + * The number of structural features of the 'Tree Node' class. + * + * + * @generated + * @ordered + */ + int TREE_NODE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl Other Tree Node}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getOtherTreeNode() + * @generated + */ + int OTHER_TREE_NODE = 2; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE__NAME = 0; + + /** + * The feature id for the 'Child List' containment reference. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE__CHILD_LIST = 1; + + /** + * The number of structural features of the 'Other Tree Node' class. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.ChildListImpl Child List}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.ChildListImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getChildList() + * @generated + */ + int CHILD_LIST = 3; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * @generated + * @ordered + */ + int CHILD_LIST__CHILDREN = 0; + + /** + * The number of structural features of the 'Child List' class. + * + * + * @generated + * @ordered + */ + int CHILD_LIST_FEATURE_COUNT = 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree Tree}'. + * + * + * @return the meta object for class 'Tree'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree + * @generated + */ + EClass getTree(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getNodes Nodes}'. + * + * + * @return the meta object for the containment reference list 'Nodes'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getNodes() + * @see #getTree() + * @generated + */ + EReference getTree_Nodes(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getMoreNodes More Nodes}'. + * + * + * @return the meta object for the containment reference list 'More Nodes'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getMoreNodes() + * @see #getTree() + * @generated + */ + EReference getTree_MoreNodes(); + + /** + * Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode Tree Node}'. + * + * + * @return the meta object for class 'Tree Node'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode + * @generated + */ + EClass getTreeNode(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getName() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_Name(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getChildren Children}'. + * + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getChildren() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_Children(); + + /** + * Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode Other Tree Node}'. + * + * + * @return the meta object for class 'Other Tree Node'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode + * @generated + */ + EClass getOtherTreeNode(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getName() + * @see #getOtherTreeNode() + * @generated + */ + EAttribute getOtherTreeNode_Name(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getChildList Child List}'. + * + * + * @return the meta object for the containment reference 'Child List'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getChildList() + * @see #getOtherTreeNode() + * @generated + */ + EReference getOtherTreeNode_ChildList(); + + /** + * Returns the meta object for class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList Child List}'. + * + * + * @return the meta object for class 'Child List'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList + * @generated + */ + EClass getChildList(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList#getChildren Children}'. + * + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList#getChildren() + * @see #getChildList() + * @generated + */ + EReference getChildList_Children(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + IndentationAwareUiTestLanguageFactory getIndentationAwareUiTestLanguageFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals + { + /** + * The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl Tree}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getTree() + * @generated + */ + EClass TREE = eINSTANCE.getTree(); + + /** + * The meta object literal for the 'Nodes' containment reference list feature. + * + * + * @generated + */ + EReference TREE__NODES = eINSTANCE.getTree_Nodes(); + + /** + * The meta object literal for the 'More Nodes' containment reference list feature. + * + * + * @generated + */ + EReference TREE__MORE_NODES = eINSTANCE.getTree_MoreNodes(); + + /** + * The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getTreeNode() + * @generated + */ + EClass TREE_NODE = eINSTANCE.getTreeNode(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__NAME = eINSTANCE.getTreeNode_Name(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * @generated + */ + EReference TREE_NODE__CHILDREN = eINSTANCE.getTreeNode_Children(); + + /** + * The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl Other Tree Node}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getOtherTreeNode() + * @generated + */ + EClass OTHER_TREE_NODE = eINSTANCE.getOtherTreeNode(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute OTHER_TREE_NODE__NAME = eINSTANCE.getOtherTreeNode_Name(); + + /** + * The meta object literal for the 'Child List' containment reference feature. + * + * + * @generated + */ + EReference OTHER_TREE_NODE__CHILD_LIST = eINSTANCE.getOtherTreeNode_ChildList(); + + /** + * The meta object literal for the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.ChildListImpl Child List}' class. + * + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.ChildListImpl + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.IndentationAwareUiTestLanguagePackageImpl#getChildList() + * @generated + */ + EClass CHILD_LIST = eINSTANCE.getChildList(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * @generated + */ + EReference CHILD_LIST__CHILDREN = eINSTANCE.getChildList_Children(); + + } + +} //IndentationAwareUiTestLanguagePackage diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/OtherTreeNode.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/OtherTreeNode.java new file mode 100644 index 0000000000..3ec5144768 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/OtherTreeNode.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Other Tree Node'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getName Name}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getChildList Child List}
  • + *
+ * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getOtherTreeNode() + * @model + * @generated + */ +public interface OtherTreeNode extends EObject +{ + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getOtherTreeNode_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Child List' containment reference. + * + *

+ * If the meaning of the 'Child List' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Child List' containment reference. + * @see #setChildList(ChildList) + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getOtherTreeNode_ChildList() + * @model containment="true" + * @generated + */ + ChildList getChildList(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode#getChildList Child List}' containment reference. + * + * + * @param value the new value of the 'Child List' containment reference. + * @see #getChildList() + * @generated + */ + void setChildList(ChildList value); + +} // OtherTreeNode diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/Tree.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/Tree.java new file mode 100644 index 0000000000..6b9f4bc5c9 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/Tree.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Tree'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getNodes Nodes}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree#getMoreNodes More Nodes}
  • + *
+ * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTree() + * @model + * @generated + */ +public interface Tree extends EObject +{ + /** + * Returns the value of the 'Nodes' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode}. + * + *

+ * If the meaning of the 'Nodes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Nodes' containment reference list. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTree_Nodes() + * @model containment="true" + * @generated + */ + EList getNodes(); + + /** + * Returns the value of the 'More Nodes' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode}. + * + *

+ * If the meaning of the 'More Nodes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'More Nodes' containment reference list. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTree_MoreNodes() + * @model containment="true" + * @generated + */ + EList getMoreNodes(); + +} // Tree diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/TreeNode.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/TreeNode.java new file mode 100644 index 0000000000..389a4ad493 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/TreeNode.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Tree Node'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getName Name}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getChildren Children}
  • + *
+ * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTreeNode() + * @model + * @generated + */ +public interface TreeNode extends EObject +{ + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTreeNode_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode}. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#getTreeNode_Children() + * @model containment="true" + * @generated + */ + EList getChildren(); + +} // TreeNode diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/ChildListImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/ChildListImpl.java new file mode 100644 index 0000000000..31b3f50fd0 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/ChildListImpl.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.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.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode; + +/** + * + * An implementation of the model object 'Child List'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.ChildListImpl#getChildren Children}
  • + *
+ * + * @generated + */ +public class ChildListImpl extends MinimalEObjectImpl.Container implements ChildList +{ + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * @generated + */ + protected ChildListImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareUiTestLanguagePackage.Literals.CHILD_LIST; + } + + /** + * + * + * @generated + */ + public EList getChildren() + { + if (children == null) + { + children = new EObjectContainmentEList(OtherTreeNode.class, this, IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN); + } + return children; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN: + return ((InternalEList)getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN: + return getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN: + getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST__CHILDREN: + return children != null && !children.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ChildListImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguageFactoryImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguageFactoryImpl.java new file mode 100644 index 0000000000..621d907b85 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguageFactoryImpl.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class IndentationAwareUiTestLanguageFactoryImpl extends EFactoryImpl implements IndentationAwareUiTestLanguageFactory +{ + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static IndentationAwareUiTestLanguageFactory init() + { + try + { + IndentationAwareUiTestLanguageFactory theIndentationAwareUiTestLanguageFactory = (IndentationAwareUiTestLanguageFactory)EPackage.Registry.INSTANCE.getEFactory(IndentationAwareUiTestLanguagePackage.eNS_URI); + if (theIndentationAwareUiTestLanguageFactory != null) + { + return theIndentationAwareUiTestLanguageFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new IndentationAwareUiTestLanguageFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public IndentationAwareUiTestLanguageFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case IndentationAwareUiTestLanguagePackage.TREE: return createTree(); + case IndentationAwareUiTestLanguagePackage.TREE_NODE: return createTreeNode(); + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE: return createOtherTreeNode(); + case IndentationAwareUiTestLanguagePackage.CHILD_LIST: return createChildList(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Tree createTree() + { + TreeImpl tree = new TreeImpl(); + return tree; + } + + /** + * + * + * @generated + */ + public TreeNode createTreeNode() + { + TreeNodeImpl treeNode = new TreeNodeImpl(); + return treeNode; + } + + /** + * + * + * @generated + */ + public OtherTreeNode createOtherTreeNode() + { + OtherTreeNodeImpl otherTreeNode = new OtherTreeNodeImpl(); + return otherTreeNode; + } + + /** + * + * + * @generated + */ + public ChildList createChildList() + { + ChildListImpl childList = new ChildListImpl(); + return childList; + } + + /** + * + * + * @generated + */ + public IndentationAwareUiTestLanguagePackage getIndentationAwareUiTestLanguagePackage() + { + return (IndentationAwareUiTestLanguagePackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static IndentationAwareUiTestLanguagePackage getPackage() + { + return IndentationAwareUiTestLanguagePackage.eINSTANCE; + } + +} //IndentationAwareUiTestLanguageFactoryImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguagePackageImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguagePackageImpl.java new file mode 100644 index 0000000000..d961f6b3fe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/IndentationAwareUiTestLanguagePackageImpl.java @@ -0,0 +1,329 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguageFactory; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class IndentationAwareUiTestLanguagePackageImpl extends EPackageImpl implements IndentationAwareUiTestLanguagePackage +{ + /** + * + * + * @generated + */ + private EClass treeEClass = null; + + /** + * + * + * @generated + */ + private EClass treeNodeEClass = null; + + /** + * + * + * @generated + */ + private EClass otherTreeNodeEClass = null; + + /** + * + * + * @generated + */ + private EClass childListEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage#eNS_URI + * @see #init() + * @generated + */ + private IndentationAwareUiTestLanguagePackageImpl() + { + super(eNS_URI, IndentationAwareUiTestLanguageFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link IndentationAwareUiTestLanguagePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static IndentationAwareUiTestLanguagePackage init() + { + if (isInited) return (IndentationAwareUiTestLanguagePackage)EPackage.Registry.INSTANCE.getEPackage(IndentationAwareUiTestLanguagePackage.eNS_URI); + + // Obtain or create and register package + IndentationAwareUiTestLanguagePackageImpl theIndentationAwareUiTestLanguagePackage = (IndentationAwareUiTestLanguagePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof IndentationAwareUiTestLanguagePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new IndentationAwareUiTestLanguagePackageImpl()); + + isInited = true; + + // Create package meta-data objects + theIndentationAwareUiTestLanguagePackage.createPackageContents(); + + // Initialize created meta-data + theIndentationAwareUiTestLanguagePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theIndentationAwareUiTestLanguagePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(IndentationAwareUiTestLanguagePackage.eNS_URI, theIndentationAwareUiTestLanguagePackage); + return theIndentationAwareUiTestLanguagePackage; + } + + /** + * + * + * @generated + */ + public EClass getTree() + { + return treeEClass; + } + + /** + * + * + * @generated + */ + public EReference getTree_Nodes() + { + return (EReference)treeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getTree_MoreNodes() + { + return (EReference)treeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getTreeNode() + { + return treeNodeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_Name() + { + return (EAttribute)treeNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_Children() + { + return (EReference)treeNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getOtherTreeNode() + { + return otherTreeNodeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getOtherTreeNode_Name() + { + return (EAttribute)otherTreeNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getOtherTreeNode_ChildList() + { + return (EReference)otherTreeNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getChildList() + { + return childListEClass; + } + + /** + * + * + * @generated + */ + public EReference getChildList_Children() + { + return (EReference)childListEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public IndentationAwareUiTestLanguageFactory getIndentationAwareUiTestLanguageFactory() + { + return (IndentationAwareUiTestLanguageFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + treeEClass = createEClass(TREE); + createEReference(treeEClass, TREE__NODES); + createEReference(treeEClass, TREE__MORE_NODES); + + treeNodeEClass = createEClass(TREE_NODE); + createEAttribute(treeNodeEClass, TREE_NODE__NAME); + createEReference(treeNodeEClass, TREE_NODE__CHILDREN); + + otherTreeNodeEClass = createEClass(OTHER_TREE_NODE); + createEAttribute(otherTreeNodeEClass, OTHER_TREE_NODE__NAME); + createEReference(otherTreeNodeEClass, OTHER_TREE_NODE__CHILD_LIST); + + childListEClass = createEClass(CHILD_LIST); + createEReference(childListEClass, CHILD_LIST__CHILDREN); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(treeEClass, Tree.class, "Tree", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTree_Nodes(), this.getTreeNode(), null, "nodes", null, 0, -1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTree_MoreNodes(), this.getOtherTreeNode(), null, "moreNodes", null, 0, -1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTreeNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeNode_Children(), this.getTreeNode(), null, "children", null, 0, -1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(otherTreeNodeEClass, OtherTreeNode.class, "OtherTreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getOtherTreeNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, OtherTreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getOtherTreeNode_ChildList(), this.getChildList(), null, "childList", null, 0, 1, OtherTreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(childListEClass, ChildList.class, "ChildList", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getChildList_Children(), this.getOtherTreeNode(), null, "children", null, 0, -1, ChildList.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //IndentationAwareUiTestLanguagePackageImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/OtherTreeNodeImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/OtherTreeNodeImpl.java new file mode 100644 index 0000000000..3b4f09c5b5 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/OtherTreeNodeImpl.java @@ -0,0 +1,270 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode; + +/** + * + * An implementation of the model object 'Other Tree Node'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl#getName Name}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.OtherTreeNodeImpl#getChildList Child List}
  • + *
+ * + * @generated + */ +public class OtherTreeNodeImpl extends MinimalEObjectImpl.Container implements OtherTreeNode +{ + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getChildList() Child List}' containment reference. + * + * + * @see #getChildList() + * @generated + * @ordered + */ + protected ChildList childList; + + /** + * + * + * @generated + */ + protected OtherTreeNodeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareUiTestLanguagePackage.Literals.OTHER_TREE_NODE; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public ChildList getChildList() + { + return childList; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetChildList(ChildList newChildList, NotificationChain msgs) + { + ChildList oldChildList = childList; + childList = newChildList; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, oldChildList, newChildList); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setChildList(ChildList newChildList) + { + if (newChildList != childList) + { + NotificationChain msgs = null; + if (childList != null) + msgs = ((InternalEObject)childList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, null, msgs); + if (newChildList != null) + msgs = ((InternalEObject)newChildList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, null, msgs); + msgs = basicSetChildList(newChildList, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, newChildList, newChildList)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return basicSetChildList(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__NAME: + return getName(); + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return getChildList(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__NAME: + setName((String)newValue); + return; + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + setChildList((ChildList)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__NAME: + setName(NAME_EDEFAULT); + return; + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + setChildList((ChildList)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return childList != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @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(); + } + +} //OtherTreeNodeImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeImpl.java new file mode 100644 index 0000000000..8067793131 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeImpl.java @@ -0,0 +1,211 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.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.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode; + +/** + * + * An implementation of the model object 'Tree'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl#getNodes Nodes}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeImpl#getMoreNodes More Nodes}
  • + *
+ * + * @generated + */ +public class TreeImpl extends MinimalEObjectImpl.Container implements Tree +{ + /** + * The cached value of the '{@link #getNodes() Nodes}' containment reference list. + * + * + * @see #getNodes() + * @generated + * @ordered + */ + protected EList nodes; + + /** + * The cached value of the '{@link #getMoreNodes() More Nodes}' containment reference list. + * + * + * @see #getMoreNodes() + * @generated + * @ordered + */ + protected EList moreNodes; + + /** + * + * + * @generated + */ + protected TreeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareUiTestLanguagePackage.Literals.TREE; + } + + /** + * + * + * @generated + */ + public EList getNodes() + { + if (nodes == null) + { + nodes = new EObjectContainmentEList(TreeNode.class, this, IndentationAwareUiTestLanguagePackage.TREE__NODES); + } + return nodes; + } + + /** + * + * + * @generated + */ + public EList getMoreNodes() + { + if (moreNodes == null) + { + moreNodes = new EObjectContainmentEList(OtherTreeNode.class, this, IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES); + } + return moreNodes; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE__NODES: + return ((InternalEList)getNodes()).basicRemove(otherEnd, msgs); + case IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES: + return ((InternalEList)getMoreNodes()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE__NODES: + return getNodes(); + case IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES: + return getMoreNodes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE__NODES: + getNodes().clear(); + getNodes().addAll((Collection)newValue); + return; + case IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES: + getMoreNodes().clear(); + getMoreNodes().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE__NODES: + getNodes().clear(); + return; + case IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES: + getMoreNodes().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE__NODES: + return nodes != null && !nodes.isEmpty(); + case IndentationAwareUiTestLanguagePackage.TREE__MORE_NODES: + return moreNodes != null && !moreNodes.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //TreeImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeNodeImpl.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeNodeImpl.java new file mode 100644 index 0000000000..34ace1f61e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/impl/TreeNodeImpl.java @@ -0,0 +1,244 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode; + +/** + * + * An implementation of the model object 'Tree Node'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl#getName Name}
  • + *
  • {@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.impl.TreeNodeImpl#getChildren Children}
  • + *
+ * + * @generated + */ +public class TreeNodeImpl extends MinimalEObjectImpl.Container implements TreeNode +{ + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * @generated + */ + protected TreeNodeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareUiTestLanguagePackage.Literals.TREE_NODE; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IndentationAwareUiTestLanguagePackage.TREE_NODE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public EList getChildren() + { + if (children == null) + { + children = new EObjectContainmentEList(TreeNode.class, this, IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN); + } + return children; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN: + return ((InternalEList)getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE_NODE__NAME: + return getName(); + case IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN: + return getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE_NODE__NAME: + setName((String)newValue); + return; + case IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE_NODE__NAME: + setName(NAME_EDEFAULT); + return; + case IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN: + getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareUiTestLanguagePackage.TREE_NODE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case IndentationAwareUiTestLanguagePackage.TREE_NODE__CHILDREN: + return children != null && !children.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @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(); + } + +} //TreeNodeImpl diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageAdapterFactory.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageAdapterFactory.java new file mode 100644 index 0000000000..d56a626a2a --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageAdapterFactory.java @@ -0,0 +1,197 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage + * @generated + */ +public class IndentationAwareUiTestLanguageAdapterFactory extends AdapterFactoryImpl +{ + /** + * The cached model package. + * + * + * @generated + */ + protected static IndentationAwareUiTestLanguagePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public IndentationAwareUiTestLanguageAdapterFactory() + { + if (modelPackage == null) + { + modelPackage = IndentationAwareUiTestLanguagePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) + { + if (object == modelPackage) + { + return true; + } + if (object instanceof EObject) + { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected IndentationAwareUiTestLanguageSwitch modelSwitch = + new IndentationAwareUiTestLanguageSwitch() + { + @Override + public Adapter caseTree(Tree object) + { + return createTreeAdapter(); + } + @Override + public Adapter caseTreeNode(TreeNode object) + { + return createTreeNodeAdapter(); + } + @Override + public Adapter caseOtherTreeNode(OtherTreeNode object) + { + return createOtherTreeNodeAdapter(); + } + @Override + public Adapter caseChildList(ChildList object) + { + return createChildListAdapter(); + } + @Override + public Adapter defaultCase(EObject object) + { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) + { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree Tree}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree + * @generated + */ + public Adapter createTreeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode Tree Node}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode + * @generated + */ + public Adapter createTreeNodeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode Other Tree Node}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode + * @generated + */ + public Adapter createOtherTreeNodeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList Child List}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList + * @generated + */ + public Adapter createChildListAdapter() + { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() + { + return null; + } + +} //IndentationAwareUiTestLanguageAdapterFactory diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageSwitch.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageSwitch.java new file mode 100644 index 0000000000..f9c83df398 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/indentationAwareUiTestLanguage/util/IndentationAwareUiTestLanguageSwitch.java @@ -0,0 +1,193 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage + * @generated + */ +public class IndentationAwareUiTestLanguageSwitch extends Switch +{ + /** + * The cached model package + * + * + * @generated + */ + protected static IndentationAwareUiTestLanguagePackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public IndentationAwareUiTestLanguageSwitch() + { + if (modelPackage == null) + { + modelPackage = IndentationAwareUiTestLanguagePackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) + { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) + { + switch (classifierID) + { + case IndentationAwareUiTestLanguagePackage.TREE: + { + Tree tree = (Tree)theEObject; + T result = caseTree(tree); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IndentationAwareUiTestLanguagePackage.TREE_NODE: + { + TreeNode treeNode = (TreeNode)theEObject; + T result = caseTreeNode(treeNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE: + { + OtherTreeNode otherTreeNode = (OtherTreeNode)theEObject; + T result = caseOtherTreeNode(otherTreeNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IndentationAwareUiTestLanguagePackage.CHILD_LIST: + { + ChildList childList = (ChildList)theEObject; + T result = caseChildList(childList); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Tree'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Tree'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTree(Tree object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Tree Node'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Tree Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTreeNode(TreeNode object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Other Tree Node'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Other Tree Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseOtherTreeNode(OtherTreeNode object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Child List'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Child List'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseChildList(ChildList object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) + { + return null; + } + +} //IndentationAwareUiTestLanguageSwitch diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageAntlrTokenFileProvider.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageAntlrTokenFileProvider.java new file mode 100644 index 0000000000..c1bd1686ec --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageAntlrTokenFileProvider.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr; + +import java.io.InputStream; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; + +public class IndentationAwareUiTestLanguageAntlrTokenFileProvider implements IAntlrTokenFileProvider { + + @Override + public InputStream getAntlrTokenFile() { + ClassLoader classLoader = getClass().getClassLoader(); + return classLoader.getResourceAsStream("org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens"); + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageParser.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageParser.java new file mode 100644 index 0000000000..8cc833c597 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageParser.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr; + +import com.google.inject.Inject; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.TokenSource; +import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal.InternalIndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; +import org.eclipse.xtext.parser.antlr.AbstractAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; + +public class IndentationAwareUiTestLanguageParser extends AbstractAntlrParser { + + @Inject + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + + @Override + protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { + tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); + } + + @Override + protected TokenSource createLexer(CharStream stream) { + return new IndentationAwareUiTestLanguageTokenSource(super.createLexer(stream)); + } + + /** + * Indentation aware languages do not support partial parsing since the lexer is inherently stateful. + * Override and return {@code true} if your terminal splitting is stateless. + */ + @Override + protected boolean isReparseSupported() { + return false; + } + + @Override + protected InternalIndentationAwareUiTestLanguageParser createParser(XtextTokenStream stream) { + return new InternalIndentationAwareUiTestLanguageParser(stream, getGrammarAccess()); + } + + @Override + protected String getDefaultRuleName() { + return "Tree"; + } + + public IndentationAwareUiTestLanguageGrammarAccess getGrammarAccess() { + return this.grammarAccess; + } + + public void setGrammarAccess(IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g new file mode 100644 index 0000000000..29ab926912 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.g @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +parser grammar InternalIndentationAwareUiTestLanguageParser; + +options { + tokenVocab=InternalIndentationAwareUiTestLanguageLexer; + superClass=AbstractInternalAntlrParser; +} + +@header { +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal; + +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; + +} + +@members { + + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + + public InternalIndentationAwareUiTestLanguageParser(TokenStream input, IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Tree"; + } + + @Override + protected IndentationAwareUiTestLanguageGrammarAccess getGrammarAccess() { + return grammarAccess; + } + +} + +@rulecatch { + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } +} + +// Entry rule entryRuleTree +entryRuleTree returns [EObject current=null]: + { newCompositeNode(grammarAccess.getTreeRule()); } + iv_ruleTree=ruleTree + { $current=$iv_ruleTree.current; } + EOF; + +// Rule Tree +ruleTree returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + $current = forceCreateModelElement( + grammarAccess.getTreeAccess().getTreeAction_0(), + $current); + } + ) + ( + ( + { + newCompositeNode(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); + } + lv_nodes_1_0=ruleTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + $current, + "nodes", + lv_nodes_1_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.TreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )* + ( + ( + { + newCompositeNode(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + } + lv_moreNodes_2_0=ruleOtherTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + $current, + "moreNodes", + lv_moreNodes_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )* + ) +; + +// Entry rule entryRuleTreeNode +entryRuleTreeNode returns [EObject current=null]: + { newCompositeNode(grammarAccess.getTreeNodeRule()); } + iv_ruleTreeNode=ruleTreeNode + { $current=$iv_ruleTreeNode.current; } + EOF; + +// Rule TreeNode +ruleTreeNode returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + lv_name_0_0=RULE_ID + { + newLeafNode(lv_name_0_0, grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getTreeNodeRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.ID"); + } + ) + ) + ( + this_INDENT_1=RULE_INDENT + { + newLeafNode(this_INDENT_1, grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); + } + lv_children_2_0=ruleTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getTreeNodeRule()); + } + add( + $current, + "children", + lv_children_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.TreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )* + this_DEDENT_3=RULE_DEDENT + { + newLeafNode(this_DEDENT_3, grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); + } + )? + ) +; + +// Entry rule entryRuleOtherTreeNode +entryRuleOtherTreeNode returns [EObject current=null]: + { newCompositeNode(grammarAccess.getOtherTreeNodeRule()); } + iv_ruleOtherTreeNode=ruleOtherTreeNode + { $current=$iv_ruleOtherTreeNode.current; } + EOF; + +// Rule OtherTreeNode +ruleOtherTreeNode returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + lv_name_0_0=RULE_STRING + { + newLeafNode(lv_name_0_0, grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getOtherTreeNodeRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.STRING"); + } + ) + ) + ( + ( + { + newCompositeNode(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + } + lv_childList_1_0=ruleChildList + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getOtherTreeNodeRule()); + } + set( + $current, + "childList", + lv_childList_1_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.ChildList"); + afterParserOrEnumRuleCall(); + } + ) + )? + ) +; + +// Entry rule entryRuleChildList +entryRuleChildList returns [EObject current=null]: + { newCompositeNode(grammarAccess.getChildListRule()); } + iv_ruleChildList=ruleChildList + { $current=$iv_ruleChildList.current; } + EOF; + +// Rule ChildList +ruleChildList returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + $current = forceCreateModelElement( + grammarAccess.getChildListAccess().getChildListAction_0(), + $current); + } + ) + this_INDENT_1=RULE_INDENT + { + newLeafNode(this_INDENT_1, grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + } + ( + ( + { + newCompositeNode(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + } + lv_children_2_0=ruleOtherTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getChildListRule()); + } + add( + $current, + "children", + lv_children_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )+ + this_DEDENT_3=RULE_DEDENT + { + newLeafNode(this_DEDENT_3, grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + } + ) +; diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java new file mode 100644 index 0000000000..05c0a2f6fb --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.java @@ -0,0 +1,751 @@ +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal; + +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; + + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalIndentationAwareUiTestLanguageParser extends AbstractInternalAntlrParser { + public static final String[] tokenNames = new String[] { + "", "", "", "", "RULE_SL_COMMENT", "RULE_INDENT", "RULE_DEDENT", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_WS", "RULE_ANY_OTHER" + }; + public static final int RULE_DEDENT=6; + public static final int RULE_ID=7; + public static final int RULE_WS=11; + public static final int RULE_STRING=9; + public static final int RULE_ANY_OTHER=12; + public static final int RULE_SL_COMMENT=4; + public static final int RULE_INT=8; + public static final int RULE_ML_COMMENT=10; + public static final int EOF=-1; + public static final int RULE_INDENT=5; + + // delegates + // delegators + + + public InternalIndentationAwareUiTestLanguageParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + public InternalIndentationAwareUiTestLanguageParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return InternalIndentationAwareUiTestLanguageParser.tokenNames; } + public String getGrammarFileName() { return "InternalIndentationAwareUiTestLanguageParser.g"; } + + + + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + + public InternalIndentationAwareUiTestLanguageParser(TokenStream input, IndentationAwareUiTestLanguageGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Tree"; + } + + @Override + protected IndentationAwareUiTestLanguageGrammarAccess getGrammarAccess() { + return grammarAccess; + } + + + + + // $ANTLR start "entryRuleTree" + // InternalIndentationAwareUiTestLanguageParser.g:61:1: entryRuleTree returns [EObject current=null] : iv_ruleTree= ruleTree EOF ; + public final EObject entryRuleTree() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTree = null; + + + try { + // InternalIndentationAwareUiTestLanguageParser.g:61:45: (iv_ruleTree= ruleTree EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:62:2: iv_ruleTree= ruleTree EOF + { + newCompositeNode(grammarAccess.getTreeRule()); + pushFollow(FOLLOW_1); + iv_ruleTree=ruleTree(); + + state._fsp--; + + current =iv_ruleTree; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleTree" + + + // $ANTLR start "ruleTree" + // InternalIndentationAwareUiTestLanguageParser.g:68:1: ruleTree returns [EObject current=null] : ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) ; + public final EObject ruleTree() throws RecognitionException { + EObject current = null; + + EObject lv_nodes_1_0 = null; + + EObject lv_moreNodes_2_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:74:2: ( ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) ) + // InternalIndentationAwareUiTestLanguageParser.g:75:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) + { + // InternalIndentationAwareUiTestLanguageParser.g:75:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) + // InternalIndentationAwareUiTestLanguageParser.g:76:3: () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* + { + // InternalIndentationAwareUiTestLanguageParser.g:76:3: () + // InternalIndentationAwareUiTestLanguageParser.g:77:4: + { + + current = forceCreateModelElement( + grammarAccess.getTreeAccess().getTreeAction_0(), + current); + + + } + + // InternalIndentationAwareUiTestLanguageParser.g:83:3: ( (lv_nodes_1_0= ruleTreeNode ) )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_ID) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:84:4: (lv_nodes_1_0= ruleTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:84:4: (lv_nodes_1_0= ruleTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:85:5: lv_nodes_1_0= ruleTreeNode + { + + newCompositeNode(grammarAccess.getTreeAccess().getNodesTreeNodeParserRuleCall_1_0()); + + pushFollow(FOLLOW_3); + lv_nodes_1_0=ruleTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + current, + "nodes", + lv_nodes_1_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.TreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + break loop1; + } + } while (true); + + // InternalIndentationAwareUiTestLanguageParser.g:102:3: ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0==RULE_STRING) ) { + alt2=1; + } + + + switch (alt2) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:103:4: (lv_moreNodes_2_0= ruleOtherTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:103:4: (lv_moreNodes_2_0= ruleOtherTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:104:5: lv_moreNodes_2_0= ruleOtherTreeNode + { + + newCompositeNode(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + + pushFollow(FOLLOW_4); + lv_moreNodes_2_0=ruleOtherTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + current, + "moreNodes", + lv_moreNodes_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + break loop2; + } + } while (true); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleTree" + + + // $ANTLR start "entryRuleTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:125:1: entryRuleTreeNode returns [EObject current=null] : iv_ruleTreeNode= ruleTreeNode EOF ; + public final EObject entryRuleTreeNode() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTreeNode = null; + + + try { + // InternalIndentationAwareUiTestLanguageParser.g:125:49: (iv_ruleTreeNode= ruleTreeNode EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:126:2: iv_ruleTreeNode= ruleTreeNode EOF + { + newCompositeNode(grammarAccess.getTreeNodeRule()); + pushFollow(FOLLOW_1); + iv_ruleTreeNode=ruleTreeNode(); + + state._fsp--; + + current =iv_ruleTreeNode; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleTreeNode" + + + // $ANTLR start "ruleTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:132:1: ruleTreeNode returns [EObject current=null] : ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ; + public final EObject ruleTreeNode() throws RecognitionException { + EObject current = null; + + Token lv_name_0_0=null; + Token this_INDENT_1=null; + Token this_DEDENT_3=null; + EObject lv_children_2_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:138:2: ( ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ) + // InternalIndentationAwareUiTestLanguageParser.g:139:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) + { + // InternalIndentationAwareUiTestLanguageParser.g:139:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) + // InternalIndentationAwareUiTestLanguageParser.g:140:3: ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? + { + // InternalIndentationAwareUiTestLanguageParser.g:140:3: ( (lv_name_0_0= RULE_ID ) ) + // InternalIndentationAwareUiTestLanguageParser.g:141:4: (lv_name_0_0= RULE_ID ) + { + // InternalIndentationAwareUiTestLanguageParser.g:141:4: (lv_name_0_0= RULE_ID ) + // InternalIndentationAwareUiTestLanguageParser.g:142:5: lv_name_0_0= RULE_ID + { + lv_name_0_0=(Token)match(input,RULE_ID,FOLLOW_5); + + newLeafNode(lv_name_0_0, grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getTreeNodeRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.ID"); + + + } + + + } + + // InternalIndentationAwareUiTestLanguageParser.g:158:3: (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? + int alt4=2; + int LA4_0 = input.LA(1); + + if ( (LA4_0==RULE_INDENT) ) { + alt4=1; + } + switch (alt4) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:159:4: this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT + { + this_INDENT_1=(Token)match(input,RULE_INDENT,FOLLOW_6); + + newLeafNode(this_INDENT_1, grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); + + // InternalIndentationAwareUiTestLanguageParser.g:163:4: ( (lv_children_2_0= ruleTreeNode ) )* + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0==RULE_ID) ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:164:5: (lv_children_2_0= ruleTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:164:5: (lv_children_2_0= ruleTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:165:6: lv_children_2_0= ruleTreeNode + { + + newCompositeNode(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); + + pushFollow(FOLLOW_6); + lv_children_2_0=ruleTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getTreeNodeRule()); + } + add( + current, + "children", + lv_children_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.TreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + break loop3; + } + } while (true); + + this_DEDENT_3=(Token)match(input,RULE_DEDENT,FOLLOW_2); + + newLeafNode(this_DEDENT_3, grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2()); + + + } + break; + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleTreeNode" + + + // $ANTLR start "entryRuleOtherTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:191:1: entryRuleOtherTreeNode returns [EObject current=null] : iv_ruleOtherTreeNode= ruleOtherTreeNode EOF ; + public final EObject entryRuleOtherTreeNode() throws RecognitionException { + EObject current = null; + + EObject iv_ruleOtherTreeNode = null; + + + try { + // InternalIndentationAwareUiTestLanguageParser.g:191:54: (iv_ruleOtherTreeNode= ruleOtherTreeNode EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:192:2: iv_ruleOtherTreeNode= ruleOtherTreeNode EOF + { + newCompositeNode(grammarAccess.getOtherTreeNodeRule()); + pushFollow(FOLLOW_1); + iv_ruleOtherTreeNode=ruleOtherTreeNode(); + + state._fsp--; + + current =iv_ruleOtherTreeNode; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleOtherTreeNode" + + + // $ANTLR start "ruleOtherTreeNode" + // InternalIndentationAwareUiTestLanguageParser.g:198:1: ruleOtherTreeNode returns [EObject current=null] : ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) ; + public final EObject ruleOtherTreeNode() throws RecognitionException { + EObject current = null; + + Token lv_name_0_0=null; + EObject lv_childList_1_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:204:2: ( ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) ) + // InternalIndentationAwareUiTestLanguageParser.g:205:2: ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) + { + // InternalIndentationAwareUiTestLanguageParser.g:205:2: ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) + // InternalIndentationAwareUiTestLanguageParser.g:206:3: ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? + { + // InternalIndentationAwareUiTestLanguageParser.g:206:3: ( (lv_name_0_0= RULE_STRING ) ) + // InternalIndentationAwareUiTestLanguageParser.g:207:4: (lv_name_0_0= RULE_STRING ) + { + // InternalIndentationAwareUiTestLanguageParser.g:207:4: (lv_name_0_0= RULE_STRING ) + // InternalIndentationAwareUiTestLanguageParser.g:208:5: lv_name_0_0= RULE_STRING + { + lv_name_0_0=(Token)match(input,RULE_STRING,FOLLOW_5); + + newLeafNode(lv_name_0_0, grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getOtherTreeNodeRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.STRING"); + + + } + + + } + + // InternalIndentationAwareUiTestLanguageParser.g:224:3: ( (lv_childList_1_0= ruleChildList ) )? + int alt5=2; + int LA5_0 = input.LA(1); + + if ( (LA5_0==RULE_INDENT) ) { + alt5=1; + } + switch (alt5) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:225:4: (lv_childList_1_0= ruleChildList ) + { + // InternalIndentationAwareUiTestLanguageParser.g:225:4: (lv_childList_1_0= ruleChildList ) + // InternalIndentationAwareUiTestLanguageParser.g:226:5: lv_childList_1_0= ruleChildList + { + + newCompositeNode(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + + pushFollow(FOLLOW_2); + lv_childList_1_0=ruleChildList(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getOtherTreeNodeRule()); + } + set( + current, + "childList", + lv_childList_1_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.ChildList"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleOtherTreeNode" + + + // $ANTLR start "entryRuleChildList" + // InternalIndentationAwareUiTestLanguageParser.g:247:1: entryRuleChildList returns [EObject current=null] : iv_ruleChildList= ruleChildList EOF ; + public final EObject entryRuleChildList() throws RecognitionException { + EObject current = null; + + EObject iv_ruleChildList = null; + + + try { + // InternalIndentationAwareUiTestLanguageParser.g:247:50: (iv_ruleChildList= ruleChildList EOF ) + // InternalIndentationAwareUiTestLanguageParser.g:248:2: iv_ruleChildList= ruleChildList EOF + { + newCompositeNode(grammarAccess.getChildListRule()); + pushFollow(FOLLOW_1); + iv_ruleChildList=ruleChildList(); + + state._fsp--; + + current =iv_ruleChildList; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleChildList" + + + // $ANTLR start "ruleChildList" + // InternalIndentationAwareUiTestLanguageParser.g:254:1: ruleChildList returns [EObject current=null] : ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) ; + public final EObject ruleChildList() throws RecognitionException { + EObject current = null; + + Token this_INDENT_1=null; + Token this_DEDENT_3=null; + EObject lv_children_2_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareUiTestLanguageParser.g:260:2: ( ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) ) + // InternalIndentationAwareUiTestLanguageParser.g:261:2: ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) + { + // InternalIndentationAwareUiTestLanguageParser.g:261:2: ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) + // InternalIndentationAwareUiTestLanguageParser.g:262:3: () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT + { + // InternalIndentationAwareUiTestLanguageParser.g:262:3: () + // InternalIndentationAwareUiTestLanguageParser.g:263:4: + { + + current = forceCreateModelElement( + grammarAccess.getChildListAccess().getChildListAction_0(), + current); + + + } + + this_INDENT_1=(Token)match(input,RULE_INDENT,FOLLOW_7); + + newLeafNode(this_INDENT_1, grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + + // InternalIndentationAwareUiTestLanguageParser.g:273:3: ( (lv_children_2_0= ruleOtherTreeNode ) )+ + int cnt6=0; + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==RULE_STRING) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // InternalIndentationAwareUiTestLanguageParser.g:274:4: (lv_children_2_0= ruleOtherTreeNode ) + { + // InternalIndentationAwareUiTestLanguageParser.g:274:4: (lv_children_2_0= ruleOtherTreeNode ) + // InternalIndentationAwareUiTestLanguageParser.g:275:5: lv_children_2_0= ruleOtherTreeNode + { + + newCompositeNode(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + + pushFollow(FOLLOW_8); + lv_children_2_0=ruleOtherTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getChildListRule()); + } + add( + current, + "children", + lv_children_2_0, + "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + if ( cnt6 >= 1 ) break loop6; + EarlyExitException eee = + new EarlyExitException(6, input); + throw eee; + } + cnt6++; + } while (true); + + this_DEDENT_3=(Token)match(input,RULE_DEDENT,FOLLOW_2); + + newLeafNode(this_DEDENT_3, grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleChildList" + + // Delegated rules + + + + + public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000282L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000202L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000022L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x00000000000002C0L}); + public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000000240L}); + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens new file mode 100644 index 0000000000..eae27a90fe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/internal/InternalIndentationAwareUiTestLanguageParser.tokens @@ -0,0 +1,9 @@ +RULE_ANY_OTHER=12 +RULE_DEDENT=6 +RULE_ID=7 +RULE_INDENT=5 +RULE_INT=8 +RULE_ML_COMMENT=10 +RULE_SL_COMMENT=4 +RULE_STRING=9 +RULE_WS=11 diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g new file mode 100644 index 0000000000..cb81a1829c --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.g @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +lexer grammar InternalIndentationAwareUiTestLanguageLexer; + +@header { +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.lexer; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.parser.antlr.Lexer; +} + +RULE_SL_COMMENT : '//' ~(('\n'|'\r'))*; + +fragment RULE_INDENT : ; + +fragment RULE_DEDENT : ; + +RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + +RULE_INT : ('0'..'9')+; + +RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); + +RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; + +RULE_WS : (' '|'\t'|'\r'|'\n')+; + +RULE_ANY_OTHER : .; diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java new file mode 100644 index 0000000000..3599b1141e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.java @@ -0,0 +1,707 @@ +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.lexer; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.parser.antlr.Lexer; + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalIndentationAwareUiTestLanguageLexer extends Lexer { + public static final int RULE_DEDENT=6; + public static final int RULE_ID=7; + public static final int RULE_WS=11; + public static final int RULE_STRING=9; + public static final int RULE_ANY_OTHER=12; + public static final int RULE_SL_COMMENT=4; + public static final int RULE_INT=8; + public static final int RULE_ML_COMMENT=10; + public static final int EOF=-1; + public static final int RULE_INDENT=5; + + // delegates + // delegators + + public InternalIndentationAwareUiTestLanguageLexer() {;} + public InternalIndentationAwareUiTestLanguageLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + public InternalIndentationAwareUiTestLanguageLexer(CharStream input, RecognizerSharedState state) { + super(input,state); + + } + public String getGrammarFileName() { return "InternalIndentationAwareUiTestLanguageLexer.g"; } + + // $ANTLR start "RULE_SL_COMMENT" + public final void mRULE_SL_COMMENT() throws RecognitionException { + try { + int _type = RULE_SL_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:18:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ) + // InternalIndentationAwareUiTestLanguageLexer.g:18:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* + { + match("//"); + + // InternalIndentationAwareUiTestLanguageLexer.g:18:24: (~ ( ( '\\n' | '\\r' ) ) )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( ((LA1_0>='\u0000' && LA1_0<='\t')||(LA1_0>='\u000B' && LA1_0<='\f')||(LA1_0>='\u000E' && LA1_0<='\uFFFF')) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:18:24: ~ ( ( '\\n' | '\\r' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop1; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_SL_COMMENT" + + // $ANTLR start "RULE_INDENT" + public final void mRULE_INDENT() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageLexer.g:20:22: () + // InternalIndentationAwareUiTestLanguageLexer.g:20:24: + { + } + + } + finally { + } + } + // $ANTLR end "RULE_INDENT" + + // $ANTLR start "RULE_DEDENT" + public final void mRULE_DEDENT() throws RecognitionException { + try { + // InternalIndentationAwareUiTestLanguageLexer.g:22:22: () + // InternalIndentationAwareUiTestLanguageLexer.g:22:24: + { + } + + } + finally { + } + } + // $ANTLR end "RULE_DEDENT" + + // $ANTLR start "RULE_ID" + public final void mRULE_ID() throws RecognitionException { + try { + int _type = RULE_ID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:24:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + { + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: ( '^' )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0=='^') ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:24:11: '^' + { + match('^'); + + } + break; + + } + + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // InternalIndentationAwareUiTestLanguageLexer.g:24:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( ((LA3_0>='0' && LA3_0<='9')||(LA3_0>='A' && LA3_0<='Z')||LA3_0=='_'||(LA3_0>='a' && LA3_0<='z')) ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop3; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ID" + + // $ANTLR start "RULE_INT" + public final void mRULE_INT() throws RecognitionException { + try { + int _type = RULE_INT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:26:10: ( ( '0' .. '9' )+ ) + // InternalIndentationAwareUiTestLanguageLexer.g:26:12: ( '0' .. '9' )+ + { + // InternalIndentationAwareUiTestLanguageLexer.g:26:12: ( '0' .. '9' )+ + int cnt4=0; + loop4: + do { + int alt4=2; + int LA4_0 = input.LA(1); + + if ( ((LA4_0>='0' && LA4_0<='9')) ) { + alt4=1; + } + + + switch (alt4) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:26:13: '0' .. '9' + { + matchRange('0','9'); + + } + break; + + default : + if ( cnt4 >= 1 ) break loop4; + EarlyExitException eee = + new EarlyExitException(4, input); + throw eee; + } + cnt4++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_INT" + + // $ANTLR start "RULE_STRING" + public final void mRULE_STRING() throws RecognitionException { + try { + int _type = RULE_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:28:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalIndentationAwareUiTestLanguageLexer.g:28:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + { + // InternalIndentationAwareUiTestLanguageLexer.g:28:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + int alt7=2; + int LA7_0 = input.LA(1); + + if ( (LA7_0=='\"') ) { + alt7=1; + } + else if ( (LA7_0=='\'') ) { + alt7=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 7, 0, input); + + throw nvae; + } + switch (alt7) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + { + match('\"'); + // InternalIndentationAwareUiTestLanguageLexer.g:28:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + loop5: + do { + int alt5=3; + int LA5_0 = input.LA(1); + + if ( (LA5_0=='\\') ) { + alt5=1; + } + else if ( ((LA5_0>='\u0000' && LA5_0<='!')||(LA5_0>='#' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) { + alt5=2; + } + + + switch (alt5) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:21: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:28: ~ ( ( '\\\\' | '\"' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop5; + } + } while (true); + + match('\"'); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + { + match('\''); + // InternalIndentationAwareUiTestLanguageLexer.g:28:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + loop6: + do { + int alt6=3; + int LA6_0 = input.LA(1); + + if ( (LA6_0=='\\') ) { + alt6=1; + } + else if ( ((LA6_0>='\u0000' && LA6_0<='&')||(LA6_0>='(' && LA6_0<='[')||(LA6_0>=']' && LA6_0<='\uFFFF')) ) { + alt6=2; + } + + + switch (alt6) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:54: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:28:61: ~ ( ( '\\\\' | '\\'' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop6; + } + } while (true); + + match('\''); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_STRING" + + // $ANTLR start "RULE_ML_COMMENT" + public final void mRULE_ML_COMMENT() throws RecognitionException { + try { + int _type = RULE_ML_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:30:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalIndentationAwareUiTestLanguageLexer.g:30:19: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); + + // InternalIndentationAwareUiTestLanguageLexer.g:30:24: ( options {greedy=false; } : . )* + loop8: + do { + int alt8=2; + int LA8_0 = input.LA(1); + + if ( (LA8_0=='*') ) { + int LA8_1 = input.LA(2); + + if ( (LA8_1=='/') ) { + alt8=2; + } + else if ( ((LA8_1>='\u0000' && LA8_1<='.')||(LA8_1>='0' && LA8_1<='\uFFFF')) ) { + alt8=1; + } + + + } + else if ( ((LA8_0>='\u0000' && LA8_0<=')')||(LA8_0>='+' && LA8_0<='\uFFFF')) ) { + alt8=1; + } + + + switch (alt8) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:30:52: . + { + matchAny(); + + } + break; + + default : + break loop8; + } + } while (true); + + match("*/"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ML_COMMENT" + + // $ANTLR start "RULE_WS" + public final void mRULE_WS() throws RecognitionException { + try { + int _type = RULE_WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:32:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalIndentationAwareUiTestLanguageLexer.g:32:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + { + // InternalIndentationAwareUiTestLanguageLexer.g:32:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + int cnt9=0; + loop9: + do { + int alt9=2; + int LA9_0 = input.LA(1); + + if ( ((LA9_0>='\t' && LA9_0<='\n')||LA9_0=='\r'||LA9_0==' ') ) { + alt9=1; + } + + + switch (alt9) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g: + { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + if ( cnt9 >= 1 ) break loop9; + EarlyExitException eee = + new EarlyExitException(9, input); + throw eee; + } + cnt9++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_WS" + + // $ANTLR start "RULE_ANY_OTHER" + public final void mRULE_ANY_OTHER() throws RecognitionException { + try { + int _type = RULE_ANY_OTHER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalIndentationAwareUiTestLanguageLexer.g:34:16: ( . ) + // InternalIndentationAwareUiTestLanguageLexer.g:34:18: . + { + matchAny(); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ANY_OTHER" + + public void mTokens() throws RecognitionException { + // InternalIndentationAwareUiTestLanguageLexer.g:1:8: ( RULE_SL_COMMENT | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt10=7; + alt10 = dfa10.predict(input); + switch (alt10) { + case 1 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:10: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 2 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:26: RULE_ID + { + mRULE_ID(); + + } + break; + case 3 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:34: RULE_INT + { + mRULE_INT(); + + } + break; + case 4 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:43: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 5 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:55: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 6 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:71: RULE_WS + { + mRULE_WS(); + + } + break; + case 7 : + // InternalIndentationAwareUiTestLanguageLexer.g:1:79: RULE_ANY_OTHER + { + mRULE_ANY_OTHER(); + + } + break; + + } + + } + + + protected DFA10 dfa10 = new DFA10(this); + static final String DFA10_eotS = + "\1\uffff\2\10\2\uffff\2\10\10\uffff"; + static final String DFA10_eofS = + "\17\uffff"; + static final String DFA10_minS = + "\1\0\1\52\1\101\2\uffff\2\0\10\uffff"; + static final String DFA10_maxS = + "\1\uffff\1\57\1\172\2\uffff\2\uffff\10\uffff"; + static final String DFA10_acceptS = + "\3\uffff\1\2\1\3\2\uffff\1\6\1\7\1\1\1\5\1\2\1\3\1\4\1\6"; + static final String DFA10_specialS = + "\1\2\4\uffff\1\0\1\1\10\uffff}>"; + static final String[] DFA10_transitionS = { + "\11\10\2\7\2\10\1\7\22\10\1\7\1\10\1\5\4\10\1\6\7\10\1\1\12\4\7\10\32\3\3\10\1\2\1\3\1\10\32\3\uff85\10", + "\1\12\4\uffff\1\11", + "\32\13\4\uffff\1\13\1\uffff\32\13", + "", + "", + "\0\15", + "\0\15", + "", + "", + "", + "", + "", + "", + "", + "" + }; + + static final short[] DFA10_eot = DFA.unpackEncodedString(DFA10_eotS); + static final short[] DFA10_eof = DFA.unpackEncodedString(DFA10_eofS); + static final char[] DFA10_min = DFA.unpackEncodedStringToUnsignedChars(DFA10_minS); + static final char[] DFA10_max = DFA.unpackEncodedStringToUnsignedChars(DFA10_maxS); + static final short[] DFA10_accept = DFA.unpackEncodedString(DFA10_acceptS); + static final short[] DFA10_special = DFA.unpackEncodedString(DFA10_specialS); + static final short[][] DFA10_transition; + + static { + int numStates = DFA10_transitionS.length; + DFA10_transition = new short[numStates][]; + for (int i=0; i='\u0000' && LA10_5<='\uFFFF')) ) {s = 13;} + + else s = 8; + + if ( s>=0 ) return s; + break; + case 1 : + int LA10_6 = input.LA(1); + + s = -1; + if ( ((LA10_6>='\u0000' && LA10_6<='\uFFFF')) ) {s = 13;} + + else s = 8; + + if ( s>=0 ) return s; + break; + case 2 : + int LA10_0 = input.LA(1); + + s = -1; + if ( (LA10_0=='/') ) {s = 1;} + + else if ( (LA10_0=='^') ) {s = 2;} + + else if ( ((LA10_0>='A' && LA10_0<='Z')||LA10_0=='_'||(LA10_0>='a' && LA10_0<='z')) ) {s = 3;} + + else if ( ((LA10_0>='0' && LA10_0<='9')) ) {s = 4;} + + else if ( (LA10_0=='\"') ) {s = 5;} + + else if ( (LA10_0=='\'') ) {s = 6;} + + else if ( ((LA10_0>='\t' && LA10_0<='\n')||LA10_0=='\r'||LA10_0==' ') ) {s = 7;} + + else if ( ((LA10_0>='\u0000' && LA10_0<='\b')||(LA10_0>='\u000B' && LA10_0<='\f')||(LA10_0>='\u000E' && LA10_0<='\u001F')||LA10_0=='!'||(LA10_0>='#' && LA10_0<='&')||(LA10_0>='(' && LA10_0<='.')||(LA10_0>=':' && LA10_0<='@')||(LA10_0>='[' && LA10_0<=']')||LA10_0=='`'||(LA10_0>='{' && LA10_0<='\uFFFF')) ) {s = 8;} + + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 10, _s, input); + error(nvae); + throw nvae; + } + } + + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens new file mode 100644 index 0000000000..eae27a90fe --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/lexer/InternalIndentationAwareUiTestLanguageLexer.tokens @@ -0,0 +1,9 @@ +RULE_ANY_OTHER=12 +RULE_DEDENT=6 +RULE_ID=7 +RULE_INDENT=5 +RULE_INT=8 +RULE_ML_COMMENT=10 +RULE_SL_COMMENT=4 +RULE_STRING=9 +RULE_WS=11 diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/AbstractIndentationAwareUiTestLanguageScopeProvider.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/AbstractIndentationAwareUiTestLanguageScopeProvider.java new file mode 100644 index 0000000000..88c56b8737 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/AbstractIndentationAwareUiTestLanguageScopeProvider.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.scoping; + +import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider; + +public abstract class AbstractIndentationAwareUiTestLanguageScopeProvider extends DelegatingScopeProvider { +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSemanticSequencer.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSemanticSequencer.java new file mode 100644 index 0000000000..31cac8d91b --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSemanticSequencer.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.serializer; + +import com.google.inject.Inject; +import java.util.Set; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Parameter; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.ChildList; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.OtherTreeNode; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.TreeNode; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; +import org.eclipse.xtext.serializer.ISerializationContext; +import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer; + +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageSemanticSequencer extends AbstractDelegatingSemanticSequencer { + + @Inject + private IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + + @Override + public void sequence(ISerializationContext context, EObject semanticObject) { + EPackage epackage = semanticObject.eClass().getEPackage(); + ParserRule rule = context.getParserRule(); + Action action = context.getAssignedAction(); + Set parameters = context.getEnabledBooleanParameters(); + if (epackage == IndentationAwareUiTestLanguagePackage.eINSTANCE) + switch (semanticObject.eClass().getClassifierID()) { + case IndentationAwareUiTestLanguagePackage.CHILD_LIST: + sequence_ChildList(context, (ChildList) semanticObject); + return; + case IndentationAwareUiTestLanguagePackage.OTHER_TREE_NODE: + sequence_OtherTreeNode(context, (OtherTreeNode) semanticObject); + return; + case IndentationAwareUiTestLanguagePackage.TREE: + sequence_Tree(context, (Tree) semanticObject); + return; + case IndentationAwareUiTestLanguagePackage.TREE_NODE: + sequence_TreeNode(context, (TreeNode) semanticObject); + return; + } + if (errorAcceptor != null) + errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); + } + + /** + * Contexts: + * ChildList returns ChildList + * + * Constraint: + * children+=OtherTreeNode+ + */ + protected void sequence_ChildList(ISerializationContext context, ChildList semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * OtherTreeNode returns OtherTreeNode + * + * Constraint: + * (name=STRING childList=ChildList?) + */ + protected void sequence_OtherTreeNode(ISerializationContext context, OtherTreeNode semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * TreeNode returns TreeNode + * + * Constraint: + * (name=ID children+=TreeNode*) + */ + protected void sequence_TreeNode(ISerializationContext context, TreeNode semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Tree returns Tree + * + * Constraint: + * (nodes+=TreeNode* moreNodes+=OtherTreeNode*) + */ + protected void sequence_Tree(ISerializationContext context, Tree semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSyntacticSequencer.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSyntacticSequencer.java new file mode 100644 index 0000000000..0311a65ba1 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/serializer/IndentationAwareUiTestLanguageSyntacticSequencer.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.serializer; + +import com.google.inject.Inject; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.ide.tests.testlanguage.services.IndentationAwareUiTestLanguageGrammarAccess; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias; +import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable; +import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; +import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; + +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageSyntacticSequencer extends AbstractSyntacticSequencer { + + protected IndentationAwareUiTestLanguageGrammarAccess grammarAccess; + protected AbstractElementAlias match_TreeNode___INDENTTerminalRuleCall_1_0_DEDENTTerminalRuleCall_1_2__q; + + @Inject + protected void init(IGrammarAccess access) { + grammarAccess = (IndentationAwareUiTestLanguageGrammarAccess) access; + match_TreeNode___INDENTTerminalRuleCall_1_0_DEDENTTerminalRuleCall_1_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()), new TokenAlias(false, false, grammarAccess.getTreeNodeAccess().getDEDENTTerminalRuleCall_1_2())); + } + + @Override + protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { + if (ruleCall.getRule() == grammarAccess.getDEDENTRule()) + return getDEDENTToken(semanticObject, ruleCall, node); + else if (ruleCall.getRule() == grammarAccess.getINDENTRule()) + return getINDENTToken(semanticObject, ruleCall, node); + return ""; + } + + /** + * Synthetic terminal rule. The concrete syntax is to be specified by clients. + * Defaults to the empty string. + */ + protected String getDEDENTToken(EObject semanticObject, RuleCall ruleCall, INode node) { return ""; } + + /** + * Synthetic terminal rule. The concrete syntax is to be specified by clients. + * Defaults to the empty string. + */ + protected String getINDENTToken(EObject semanticObject, RuleCall ruleCall, INode node) { return ""; } + + @Override + protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { + if (transition.getAmbiguousSyntaxes().isEmpty()) return; + List transitionNodes = collectNodes(fromNode, toNode); + for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { + List syntaxNodes = getNodesFor(transitionNodes, syntax); + if (match_TreeNode___INDENTTerminalRuleCall_1_0_DEDENTTerminalRuleCall_1_2__q.equals(syntax)) + emit_TreeNode___INDENTTerminalRuleCall_1_0_DEDENTTerminalRuleCall_1_2__q(semanticObject, getLastNavigableState(), syntaxNodes); + else acceptNodes(getLastNavigableState(), syntaxNodes); + } + } + + /** + * Ambiguous syntax: + * (INDENT DEDENT)? + * + * This ambiguous syntax occurs at: + * name=ID (ambiguity) (rule end) + */ + protected void emit_TreeNode___INDENTTerminalRuleCall_1_0_DEDENTTerminalRuleCall_1_2__q(EObject semanticObject, ISynNavigable transition, List nodes) { + acceptNodes(transition, nodes); + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/services/IndentationAwareUiTestLanguageGrammarAccess.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/services/IndentationAwareUiTestLanguageGrammarAccess.java new file mode 100644 index 0000000000..caf312650c --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/services/IndentationAwareUiTestLanguageGrammarAccess.java @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.services; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.List; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.Grammar; +import org.eclipse.xtext.GrammarUtil; +import org.eclipse.xtext.Group; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.TerminalRule; +import org.eclipse.xtext.common.services.TerminalsGrammarAccess; +import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder; +import org.eclipse.xtext.service.GrammarProvider; + +@Singleton +public class IndentationAwareUiTestLanguageGrammarAccess extends AbstractGrammarElementFinder { + + public class TreeElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.Tree"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Action cTreeAction_0 = (Action)cGroup.eContents().get(0); + private final Assignment cNodesAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cNodesTreeNodeParserRuleCall_1_0 = (RuleCall)cNodesAssignment_1.eContents().get(0); + private final Assignment cMoreNodesAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cMoreNodesOtherTreeNodeParserRuleCall_2_0 = (RuleCall)cMoreNodesAssignment_2.eContents().get(0); + + //Tree: + // {Tree} nodes+=TreeNode* + // moreNodes+=OtherTreeNode*; + @Override public ParserRule getRule() { return rule; } + + //{Tree} nodes+=TreeNode* moreNodes+=OtherTreeNode* + public Group getGroup() { return cGroup; } + + //{Tree} + public Action getTreeAction_0() { return cTreeAction_0; } + + //nodes+=TreeNode* + public Assignment getNodesAssignment_1() { return cNodesAssignment_1; } + + //TreeNode + public RuleCall getNodesTreeNodeParserRuleCall_1_0() { return cNodesTreeNodeParserRuleCall_1_0; } + + //moreNodes+=OtherTreeNode* + public Assignment getMoreNodesAssignment_2() { return cMoreNodesAssignment_2; } + + //OtherTreeNode + public RuleCall getMoreNodesOtherTreeNodeParserRuleCall_2_0() { return cMoreNodesOtherTreeNodeParserRuleCall_2_0; } + } + public class TreeNodeElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.TreeNode"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cNameAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final RuleCall cNameIDTerminalRuleCall_0_0 = (RuleCall)cNameAssignment_0.eContents().get(0); + private final Group cGroup_1 = (Group)cGroup.eContents().get(1); + private final RuleCall cINDENTTerminalRuleCall_1_0 = (RuleCall)cGroup_1.eContents().get(0); + private final Assignment cChildrenAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1); + private final RuleCall cChildrenTreeNodeParserRuleCall_1_1_0 = (RuleCall)cChildrenAssignment_1_1.eContents().get(0); + private final RuleCall cDEDENTTerminalRuleCall_1_2 = (RuleCall)cGroup_1.eContents().get(2); + + //TreeNode: + // name=ID (INDENT + // children+=TreeNode* + // DEDENT)?; + @Override public ParserRule getRule() { return rule; } + + //name=ID (INDENT children+=TreeNode* DEDENT)? + public Group getGroup() { return cGroup; } + + //name=ID + public Assignment getNameAssignment_0() { return cNameAssignment_0; } + + //ID + public RuleCall getNameIDTerminalRuleCall_0_0() { return cNameIDTerminalRuleCall_0_0; } + + //(INDENT children+=TreeNode* DEDENT)? + public Group getGroup_1() { return cGroup_1; } + + //INDENT + public RuleCall getINDENTTerminalRuleCall_1_0() { return cINDENTTerminalRuleCall_1_0; } + + //children+=TreeNode* + public Assignment getChildrenAssignment_1_1() { return cChildrenAssignment_1_1; } + + //TreeNode + public RuleCall getChildrenTreeNodeParserRuleCall_1_1_0() { return cChildrenTreeNodeParserRuleCall_1_1_0; } + + //DEDENT + public RuleCall getDEDENTTerminalRuleCall_1_2() { return cDEDENTTerminalRuleCall_1_2; } + } + public class OtherTreeNodeElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.OtherTreeNode"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cNameAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final RuleCall cNameSTRINGTerminalRuleCall_0_0 = (RuleCall)cNameAssignment_0.eContents().get(0); + private final Assignment cChildListAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cChildListChildListParserRuleCall_1_0 = (RuleCall)cChildListAssignment_1.eContents().get(0); + + //OtherTreeNode: + // name=STRING + // childList=ChildList?; + @Override public ParserRule getRule() { return rule; } + + //name=STRING childList=ChildList? + public Group getGroup() { return cGroup; } + + //name=STRING + public Assignment getNameAssignment_0() { return cNameAssignment_0; } + + //STRING + public RuleCall getNameSTRINGTerminalRuleCall_0_0() { return cNameSTRINGTerminalRuleCall_0_0; } + + //childList=ChildList? + public Assignment getChildListAssignment_1() { return cChildListAssignment_1; } + + //ChildList + public RuleCall getChildListChildListParserRuleCall_1_0() { return cChildListChildListParserRuleCall_1_0; } + } + public class ChildListElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.ChildList"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Action cChildListAction_0 = (Action)cGroup.eContents().get(0); + private final RuleCall cINDENTTerminalRuleCall_1 = (RuleCall)cGroup.eContents().get(1); + private final Assignment cChildrenAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cChildrenOtherTreeNodeParserRuleCall_2_0 = (RuleCall)cChildrenAssignment_2.eContents().get(0); + private final RuleCall cDEDENTTerminalRuleCall_3 = (RuleCall)cGroup.eContents().get(3); + + //ChildList: + // {ChildList} INDENT + // children+=OtherTreeNode+ + // DEDENT; + @Override public ParserRule getRule() { return rule; } + + //{ChildList} INDENT children+=OtherTreeNode+ DEDENT + public Group getGroup() { return cGroup; } + + //{ChildList} + public Action getChildListAction_0() { return cChildListAction_0; } + + //INDENT + public RuleCall getINDENTTerminalRuleCall_1() { return cINDENTTerminalRuleCall_1; } + + //children+=OtherTreeNode+ + public Assignment getChildrenAssignment_2() { return cChildrenAssignment_2; } + + //OtherTreeNode + public RuleCall getChildrenOtherTreeNodeParserRuleCall_2_0() { return cChildrenOtherTreeNodeParserRuleCall_2_0; } + + //DEDENT + public RuleCall getDEDENTTerminalRuleCall_3() { return cDEDENTTerminalRuleCall_3; } + } + + + private final TreeElements pTree; + private final TreeNodeElements pTreeNode; + private final OtherTreeNodeElements pOtherTreeNode; + private final ChildListElements pChildList; + private final TerminalRule tSL_COMMENT; + private final TerminalRule tINDENT; + private final TerminalRule tDEDENT; + + private final Grammar grammar; + + private final TerminalsGrammarAccess gaTerminals; + + @Inject + public IndentationAwareUiTestLanguageGrammarAccess(GrammarProvider grammarProvider, + TerminalsGrammarAccess gaTerminals) { + this.grammar = internalFindGrammar(grammarProvider); + this.gaTerminals = gaTerminals; + this.pTree = new TreeElements(); + this.pTreeNode = new TreeNodeElements(); + this.pOtherTreeNode = new OtherTreeNodeElements(); + this.pChildList = new ChildListElements(); + this.tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.SL_COMMENT"); + this.tINDENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.INDENT"); + this.tDEDENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage.DEDENT"); + } + + protected Grammar internalFindGrammar(GrammarProvider grammarProvider) { + Grammar grammar = grammarProvider.getGrammar(this); + while (grammar != null) { + if ("org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage".equals(grammar.getName())) { + return grammar; + } + List grammars = grammar.getUsedGrammars(); + if (!grammars.isEmpty()) { + grammar = grammars.iterator().next(); + } else { + return null; + } + } + return grammar; + } + + @Override + public Grammar getGrammar() { + return grammar; + } + + + public TerminalsGrammarAccess getTerminalsGrammarAccess() { + return gaTerminals; + } + + + //Tree: + // {Tree} nodes+=TreeNode* + // moreNodes+=OtherTreeNode*; + public TreeElements getTreeAccess() { + return pTree; + } + + public ParserRule getTreeRule() { + return getTreeAccess().getRule(); + } + + //TreeNode: + // name=ID (INDENT + // children+=TreeNode* + // DEDENT)?; + public TreeNodeElements getTreeNodeAccess() { + return pTreeNode; + } + + public ParserRule getTreeNodeRule() { + return getTreeNodeAccess().getRule(); + } + + //OtherTreeNode: + // name=STRING + // childList=ChildList?; + public OtherTreeNodeElements getOtherTreeNodeAccess() { + return pOtherTreeNode; + } + + public ParserRule getOtherTreeNodeRule() { + return getOtherTreeNodeAccess().getRule(); + } + + //ChildList: + // {ChildList} INDENT + // children+=OtherTreeNode+ + // DEDENT; + public ChildListElements getChildListAccess() { + return pChildList; + } + + public ParserRule getChildListRule() { + return getChildListAccess().getRule(); + } + + //@ Override terminal SL_COMMENT: + // '//' !('\n' | '\r')*; + public TerminalRule getSL_COMMENTRule() { + return tSL_COMMENT; + } + + //terminal INDENT: + // 'synthetic:INDENT'; + public TerminalRule getINDENTRule() { + return tINDENT; + } + + //terminal DEDENT: + // 'synthetic:DEDENT'; + public TerminalRule getDEDENTRule() { + return tDEDENT; + } + + //terminal ID: + // '^'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; + public TerminalRule getIDRule() { + return gaTerminals.getIDRule(); + } + + //terminal INT returns ecore::EInt: + // '0'..'9'+; + public TerminalRule getINTRule() { + return gaTerminals.getINTRule(); + } + + //terminal STRING: + // '"' ('\\' . | !('\\' | '"'))* '"' | + // "'" ('\\' . | !('\\' | "'"))* "'"; + public TerminalRule getSTRINGRule() { + return gaTerminals.getSTRINGRule(); + } + + //terminal ML_COMMENT: + // '/*'->'*/'; + public TerminalRule getML_COMMENTRule() { + return gaTerminals.getML_COMMENTRule(); + } + + //terminal WS: + // ' ' | '\t' | '\r' | '\n'+; + public TerminalRule getWSRule() { + return gaTerminals.getWSRule(); + } + + //terminal ANY_OTHER: + // .; + public TerminalRule getANY_OTHERRule() { + return gaTerminals.getANY_OTHERRule(); + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/tests/IndentationAwareUiTestLanguageInjectorProvider.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/tests/IndentationAwareUiTestLanguageInjectorProvider.java new file mode 100644 index 0000000000..11ba596ea5 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/tests/IndentationAwareUiTestLanguageInjectorProvider.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.tests; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageRuntimeModule; +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageStandaloneSetup; +import org.eclipse.xtext.testing.GlobalRegistries; +import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; +import org.eclipse.xtext.testing.IInjectorProvider; +import org.eclipse.xtext.testing.IRegistryConfigurator; + +public class IndentationAwareUiTestLanguageInjectorProvider implements IInjectorProvider, IRegistryConfigurator { + + protected GlobalStateMemento stateBeforeInjectorCreation; + protected GlobalStateMemento stateAfterInjectorCreation; + protected Injector injector; + + static { + GlobalRegistries.initializeDefaults(); + } + + @Override + public Injector getInjector() { + if (injector == null) { + stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + this.injector = internalCreateInjector(); + stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + } + return injector; + } + + protected Injector internalCreateInjector() { + return new IndentationAwareUiTestLanguageStandaloneSetup() { + @Override + public Injector createInjector() { + return Guice.createInjector(createRuntimeModule()); + } + }.createInjectorAndDoEMFRegistration(); + } + + protected IndentationAwareUiTestLanguageRuntimeModule createRuntimeModule() { + // make it work also with Maven/Tycho and OSGI + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672 + return new IndentationAwareUiTestLanguageRuntimeModule() { + @Override + public ClassLoader bindClassLoaderToInstance() { + return IndentationAwareUiTestLanguageInjectorProvider.class + .getClassLoader(); + } + }; + } + + @Override + public void restoreRegistry() { + stateBeforeInjectorCreation.restoreGlobalState(); + } + + @Override + public void setupRegistry() { + getInjector(); + stateAfterInjectorCreation.restoreGlobalState(); + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/AbstractIndentationAwareUiTestLanguageValidator.java b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/AbstractIndentationAwareUiTestLanguageValidator.java new file mode 100644 index 0000000000..0d23512c95 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/AbstractIndentationAwareUiTestLanguageValidator.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.validation; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.xtext.validation.AbstractDeclarativeValidator; + +public abstract class AbstractIndentationAwareUiTestLanguageValidator extends AbstractDeclarativeValidator { + + @Override + protected List getEPackages() { + List result = new ArrayList(); + result.add(org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.IndentationAwareUiTestLanguagePackage.eINSTANCE); + return result; + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2 b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2 index 7f879cc3f5..d120901202 100644 --- a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2 +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2 @@ -65,6 +65,20 @@ Workflow { generateStub = false } } + language = StandardLanguage { + name = "org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage" + fileExtensions = "indentationAwareUiTestLang" + + serializer = { + generateStub = false + } + validator = { + // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" + } + junitSupport = { + generateStub = false + } + } language = StandardLanguage { name = "org.eclipse.xtext.ide.tests.testlanguage.PartialContentAssistTestLanguage" fileExtensions = "partialcontentassisttestlang" diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtext b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtext new file mode 100644 index 0000000000..c424049e2f --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage.xtext @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +grammar org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguage with org.eclipse.xtext.common.Terminals + +generate indentationAwareUiTestLanguage "http://www.eclipse.org/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguage" + +Tree: {Tree} + nodes+=TreeNode* + moreNodes+=OtherTreeNode* +; + +TreeNode: + name=ID + (INDENT + children+=TreeNode* + DEDENT)? +; + +OtherTreeNode: + name=STRING + childList = ChildList? +; + +ChildList: {ChildList} + INDENT + children+=OtherTreeNode+ + DEDENT +; + +@Override +terminal SL_COMMENT: '//' !('\n'|'\r')*; + +terminal INDENT: 'synthetic:INDENT'; +terminal DEDENT: 'synthetic:DEDENT'; diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.xtend new file mode 100644 index 0000000000..e0fee87f3f --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.xtend @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage + + +/** + * Use this class to register components to be used at runtime / without the Equinox extension registry. + */ +class IndentationAwareUiTestLanguageRuntimeModule extends AbstractIndentationAwareUiTestLanguageRuntimeModule { +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.xtend new file mode 100644 index 0000000000..75de31391e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.xtend @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage + + +/** + * Initialization support for running Xtext languages without Equinox extension registry. + */ +class IndentationAwareUiTestLanguageStandaloneSetup extends IndentationAwareUiTestLanguageStandaloneSetupGenerated { + + def static void doSetup() { + new IndentationAwareUiTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration() + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.xtend new file mode 100644 index 0000000000..1b85277ae1 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.xtend @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.generator + +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.xtext.generator.AbstractGenerator +import org.eclipse.xtext.generator.IFileSystemAccess2 +import org.eclipse.xtext.generator.IGeneratorContext + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +class IndentationAwareUiTestLanguageGenerator extends AbstractGenerator { + + override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { +// fsa.generateFile('greetings.txt', 'People to greet: ' + +// resource.allContents +// .filter(Greeting) +// .map[name] +// .join(', ')) + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.java b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.xtend similarity index 61% rename from org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.java rename to org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.xtend index e8159da966..06786675ec 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/editor/contentassist/antlr/CustomEntryPointContentAssistTest.java +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.xtend @@ -1,15 +1,15 @@ -/** +/* * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ -package org.eclipse.xtext.ide.tests.editor.contentassist.antlr; +package org.eclipse.xtext.ide.tests.testlanguage.ide + /** - * @author Moritz Eysholdt - Initial contribution and API + * Use this class to register ide components. */ -@SuppressWarnings("all") -public class CustomEntryPointContentAssistTest { +class IndentationAwareUiTestLanguageIdeModule extends AbstractIndentationAwareUiTestLanguageIdeModule { } diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.xtend new file mode 100644 index 0000000000..05d3fdfb1b --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.xtend @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide + +import com.google.inject.Guice +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageRuntimeModule +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageStandaloneSetup +import org.eclipse.xtext.util.Modules2 + +/** + * Initialization support for running Xtext languages as language servers. + */ +class IndentationAwareUiTestLanguageIdeSetup extends IndentationAwareUiTestLanguageStandaloneSetup { + + override createInjector() { + Guice.createInjector(Modules2.mixin(new IndentationAwareUiTestLanguageRuntimeModule, new IndentationAwareUiTestLanguageIdeModule)) + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageTokenSource.java b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageTokenSource.java new file mode 100644 index 0000000000..9a64d8cb4e --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/ide/contentassist/antlr/IndentationAwareUiTestLanguageTokenSource.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr; + +import org.antlr.runtime.Token; +import org.antlr.runtime.TokenSource; +import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalIndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.parser.antlr.AbstractIndentationTokenSource; + +public class IndentationAwareUiTestLanguageTokenSource extends AbstractIndentationTokenSource { + + public IndentationAwareUiTestLanguageTokenSource(TokenSource delegate) { + super(delegate); + } + + @Override + protected boolean shouldSplitTokenImpl(Token token) { + // TODO Review assumption + return token.getType() == InternalIndentationAwareUiTestLanguageParser.RULE_WS; + } + + @Override + protected int getBeginTokenType() { + // TODO Review assumption + return InternalIndentationAwareUiTestLanguageParser.RULE_INDENT; + } + + @Override + protected int getEndTokenType() { + // TODO Review assumption + return InternalIndentationAwareUiTestLanguageParser.RULE_DEDENT; + } + + @Override + protected boolean shouldEmitPendingEndTokens() { + return false; + } +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageTokenSource.java b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageTokenSource.java new file mode 100644 index 0000000000..928456582d --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/parser/antlr/IndentationAwareUiTestLanguageTokenSource.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.parser.antlr; + +import org.antlr.runtime.Token; +import org.antlr.runtime.TokenSource; +import org.eclipse.xtext.ide.tests.testlanguage.parser.antlr.internal.InternalIndentationAwareUiTestLanguageParser; +import org.eclipse.xtext.parser.antlr.AbstractIndentationTokenSource; + +public class IndentationAwareUiTestLanguageTokenSource extends AbstractIndentationTokenSource { + + public IndentationAwareUiTestLanguageTokenSource(TokenSource delegate) { + super(delegate); + } + + @Override + protected boolean shouldSplitTokenImpl(Token token) { + // TODO Review assumption + return token.getType() == InternalIndentationAwareUiTestLanguageParser.RULE_WS; + } + + @Override + protected int getBeginTokenType() { + // TODO Review assumption + return InternalIndentationAwareUiTestLanguageParser.RULE_INDENT; + } + + @Override + protected int getEndTokenType() { + // TODO Review assumption + return InternalIndentationAwareUiTestLanguageParser.RULE_DEDENT; + } + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.xtend new file mode 100644 index 0000000000..2c9f847b48 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.xtend @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.scoping + + +/** + * This class contains custom scoping description. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping + * on how and when to use it. + */ +class IndentationAwareUiTestLanguageScopeProvider extends AbstractIndentationAwareUiTestLanguageScopeProvider { + +} diff --git a/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.xtend b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.xtend new file mode 100644 index 0000000000..0172a14c60 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/testlang-src/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.xtend @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.validation + + +/** + * This class contains custom validation rules. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation + */ +class IndentationAwareUiTestLanguageValidator extends AbstractIndentationAwareUiTestLanguageValidator { + +// public static val INVALID_NAME = 'invalidName' +// +// @Check +// def checkGreetingStartsWithCapital(Greeting greeting) { +// if (!Character.isUpperCase(greeting.name.charAt(0))) { +// warning('Name should start with a capital', +// IndentationAwareUiTestLanguagePackage.Literals.GREETING__NAME, +// INVALID_NAME) +// } +// } + +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.java new file mode 100644 index 0000000000..fe87ca84c4 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/AbstractCompletePrefixProviderTest.java @@ -0,0 +1,1798 @@ +/** + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation; + +import com.google.common.base.Objects; +import com.google.inject.Inject; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Keyword; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider; +import org.eclipse.xtext.ide.tests.testlanguage.indentationAwareUiTestLanguage.Tree; +import org.eclipse.xtext.nodemodel.ICompositeNode; +import org.eclipse.xtext.nodemodel.ILeafNode; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.testing.util.ParseHelper; +import org.eclipse.xtext.xbase.lib.Exceptions; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@SuppressWarnings("all") +public abstract class AbstractCompletePrefixProviderTest { + public abstract CompletionPrefixProvider getTestee(); + + @Inject + private ParseHelper parseHelper; + + @Test + public void testInputToParse_01() { + Assert.assertEquals("abc", this.getTestee().getInputToParse("abcdefg", 3, 7)); + } + + @Test + public void testInputToParse_02() { + Assert.assertEquals("abc", this.getTestee().getInputToParse("abc defg", 3, 7)); + } + + @Test + public void testWholeNodeModel() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild3"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild4"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild5"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild2]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild3]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild4]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child2]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild5]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:parent2]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_0_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("<|>parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_0_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("pa<|>rent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_1_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("<|>\tchild1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_1_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>child1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_1_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c<|>hild1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_2_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("<|>\t\tgrandChild1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_2_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>\tgrandChild1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_2_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>grandChild1"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_3_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_3_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>grandChild2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_2b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_1b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_0b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_2c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_1c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_0c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_2d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_1d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_4_0d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_0b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("f"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_1b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("f"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_5_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_3() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g <|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_3b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g <|>"); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_3c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g <|> "); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_6_3d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g <|> // comment"); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_7_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_7_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_2b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_2c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_3() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_3b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_3c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_4() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_4b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + public void testLastCompleteNode_8_4c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + protected void assertLastCompleteNode(final CharSequence model, final String expectation) { + final String modelAsString = model.toString(); + this.assertLastCompleteNode(modelAsString, expectation); + final String withStringLiterals = modelAsString.replaceAll("(\\w+(<\\|>\\w+)?)", "\"$1\""); + final String expectationWithLiterals = expectation.replaceAll("ID:(\\w+)", "STRING:\"$1\""); + this.assertLastCompleteNode(withStringLiterals, expectationWithLiterals); + } + + private void assertLastCompleteNode(final String model, final String expectation) { + try { + int offset = model.indexOf("<|>"); + if ((offset == (-1))) { + offset = model.length(); + } + int completionOffset = model.indexOf("<|>", offset); + if ((completionOffset == (-1))) { + completionOffset = offset; + } + final Tree tree = this.parseHelper.parse(model.replace("<|>", "")); + final ICompositeNode nodeModel = NodeModelUtils.findActualNodeFor(tree); + final INode completeNode = this.getTestee().getLastCompleteNodeByOffset(nodeModel, offset, completionOffset); + this.assertNodeModel(expectation, completeNode); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + private void assertNodeModel(final String expectation, final INode node) { + Assert.assertEquals(expectation, this.asText(node.getRootNode(), node)); + } + + private String asText(final INode node, final INode stop) { + StringConcatenation _builder = new StringConcatenation(); + { + final Function1 _function = (ILeafNode it) -> { + EObject _grammarElement = it.getGrammarElement(); + return Boolean.valueOf((!(_grammarElement instanceof Action))); + }; + final Function1 _function_1 = (ILeafNode it) -> { + boolean _isHidden = it.isHidden(); + return Boolean.valueOf((!_isHidden)); + }; + Iterable _upTo = this.upTo(IterableExtensions.filter(IterableExtensions.filter(node.getLeafNodes(), _function), _function_1), stop); + for(final ILeafNode leaf : _upTo) { + _builder.append("["); + String _kenType = this.tokenType(leaf.getGrammarElement()); + _builder.append(_kenType); + _builder.append(":"); + String _replace = leaf.getText().replace("\t", "\\t"); + _builder.append(_replace); + _builder.append("]"); + _builder.newLineIfNotEmpty(); + } + } + return _builder.toString(); + } + + private Iterable upTo(final Iterable iter, final Object element) { + abstract class __AbstractCompletePrefixProviderTest_1 implements Function1 { + boolean found; + } + + __AbstractCompletePrefixProviderTest_1 ___AbstractCompletePrefixProviderTest_1 = new __AbstractCompletePrefixProviderTest_1() { + { + found = false; + } + @Override + public Boolean apply(final T t) { + if (this.found) { + return Boolean.valueOf(false); + } + try { + return Boolean.valueOf(true); + } finally { + boolean _equals = Objects.equal(t, element); + this.found = _equals; + } + } + }; + return IterableExtensions.filter(iter, ___AbstractCompletePrefixProviderTest_1); + } + + private String tokenType(final EObject obj) { + String _switchResult = null; + boolean _matched = false; + if (obj instanceof RuleCall) { + _matched=true; + _switchResult = ((RuleCall)obj).getRule().getName(); + } + if (!_matched) { + if (obj instanceof Keyword) { + _matched=true; + _switchResult = ((Keyword)obj).getValue(); + } + } + if (!_matched) { + if (obj instanceof AbstractRule) { + _matched=true; + _switchResult = ((AbstractRule)obj).getName(); + } + } + return _switchResult; + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.java new file mode 100644 index 0000000000..2aaa261fb1 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/CompletionPrefixProviderTest.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation; + +import com.google.inject.Inject; +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider; +import org.eclipse.xtext.ide.tests.indentation.AbstractCompletePrefixProviderTest; +import org.eclipse.xtext.ide.tests.testlanguage.tests.IndentationAwareUiTestLanguageInjectorProvider; +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.junit.runner.RunWith; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner.class) +@InjectWith(IndentationAwareUiTestLanguageInjectorProvider.class) +@SuppressWarnings("all") +public class CompletionPrefixProviderTest extends AbstractCompletePrefixProviderTest { + @Inject + private CompletionPrefixProvider testee; + + @Override + public CompletionPrefixProvider getTestee() { + return this.testee; + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.java new file mode 100644 index 0000000000..b3da96adf8 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/indentation/IndentationAwareCompletionPrefixProviderTest.java @@ -0,0 +1,1258 @@ +/** + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.indentation; + +import com.google.inject.Inject; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider; +import org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider; +import org.eclipse.xtext.ide.tests.indentation.AbstractCompletePrefixProviderTest; +import org.eclipse.xtext.ide.tests.testlanguage.tests.IndentationAwareUiTestLanguageInjectorProvider; +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner.class) +@InjectWith(IndentationAwareUiTestLanguageInjectorProvider.class) +@SuppressWarnings("all") +public class IndentationAwareCompletionPrefixProviderTest extends AbstractCompletePrefixProviderTest { + @Inject + private IndentationAwareCompletionPrefixProvider testee; + + @Override + public CompletionPrefixProvider getTestee() { + return this.testee; + } + + @Test + @Override + public void testInputToParse_02() { + Assert.assertEquals("abc ", this.testee.getInputToParse("abc defg", 3, 5)); + } + + @Test + @Override + public void testLastCompleteNode_1_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild3"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild4"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild5"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_2_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild3"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("grandChild4"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild5"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_3_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_1b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild2]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_0c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_0d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_1d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_2c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_4_2d() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent1"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("grandChild1"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("parent2"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:child1]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:grandChild1]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_6_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_6_0b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("f"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_5_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_7_0() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_7_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_2b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_2c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_3() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_3b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_3c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_4() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_4b() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } + + @Test + @Override + public void testLastCompleteNode_8_4c() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("d"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("e"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("f"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("g"); + _builder.newLine(); + _builder.append("\t\t\t\t"); + _builder.append("<|>"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("h"); + _builder.newLine(); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a]"); + _builder_1.newLine(); + _builder_1.append("[ID:b]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:c]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:d]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:e]"); + _builder_1.newLine(); + _builder_1.append("[INDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:f]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[DEDENT:]"); + _builder_1.newLine(); + _builder_1.append("[ID:g]"); + _builder_1.newLine(); + this.assertLastCompleteNode(_builder, _builder_1.toString()); + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.java new file mode 100644 index 0000000000..43835299d2 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageRuntimeModule.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage; + +import org.eclipse.xtext.ide.tests.testlanguage.AbstractIndentationAwareUiTestLanguageRuntimeModule; + +/** + * Use this class to register components to be used at runtime / without the Equinox extension registry. + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageRuntimeModule extends AbstractIndentationAwareUiTestLanguageRuntimeModule { +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.java new file mode 100644 index 0000000000..463a42c9fa --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/IndentationAwareUiTestLanguageStandaloneSetup.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage; + +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageStandaloneSetupGenerated; + +/** + * Initialization support for running Xtext languages without Equinox extension registry. + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageStandaloneSetup extends IndentationAwareUiTestLanguageStandaloneSetupGenerated { + public static void doSetup() { + new IndentationAwareUiTestLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.java new file mode 100644 index 0000000000..dc414795e9 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/generator/IndentationAwareUiTestLanguageGenerator.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.generator; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.generator.AbstractGenerator; +import org.eclipse.xtext.generator.IFileSystemAccess2; +import org.eclipse.xtext.generator.IGeneratorContext; + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageGenerator extends AbstractGenerator { + @Override + public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) { + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.java new file mode 100644 index 0000000000..4b98dfe252 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeModule.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide; + +import org.eclipse.xtext.ide.tests.testlanguage.ide.AbstractIndentationAwareUiTestLanguageIdeModule; + +/** + * Use this class to register ide components. + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageIdeModule extends AbstractIndentationAwareUiTestLanguageIdeModule { +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.java new file mode 100644 index 0000000000..e07f9e9feb --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/IndentationAwareUiTestLanguageIdeSetup.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.ide; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageRuntimeModule; +import org.eclipse.xtext.ide.tests.testlanguage.IndentationAwareUiTestLanguageStandaloneSetup; +import org.eclipse.xtext.ide.tests.testlanguage.ide.IndentationAwareUiTestLanguageIdeModule; +import org.eclipse.xtext.util.Modules2; + +/** + * Initialization support for running Xtext languages as language servers. + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageIdeSetup extends IndentationAwareUiTestLanguageStandaloneSetup { + @Override + public Injector createInjector() { + IndentationAwareUiTestLanguageRuntimeModule _indentationAwareUiTestLanguageRuntimeModule = new IndentationAwareUiTestLanguageRuntimeModule(); + IndentationAwareUiTestLanguageIdeModule _indentationAwareUiTestLanguageIdeModule = new IndentationAwareUiTestLanguageIdeModule(); + return Guice.createInjector(Modules2.mixin(_indentationAwareUiTestLanguageRuntimeModule, _indentationAwareUiTestLanguageIdeModule)); + } +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.java new file mode 100644 index 0000000000..29083138b7 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/scoping/IndentationAwareUiTestLanguageScopeProvider.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.scoping; + +import org.eclipse.xtext.ide.tests.testlanguage.scoping.AbstractIndentationAwareUiTestLanguageScopeProvider; + +/** + * This class contains custom scoping description. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping + * on how and when to use it. + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageScopeProvider extends AbstractIndentationAwareUiTestLanguageScopeProvider { +} diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.java new file mode 100644 index 0000000000..adac891ae7 --- /dev/null +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/validation/IndentationAwareUiTestLanguageValidator.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.eclipse.xtext.ide.tests.testlanguage.validation; + +import org.eclipse.xtext.ide.tests.testlanguage.validation.AbstractIndentationAwareUiTestLanguageValidator; + +/** + * This class contains custom validation rules. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation + */ +@SuppressWarnings("all") +public class IndentationAwareUiTestLanguageValidator extends AbstractIndentationAwareUiTestLanguageValidator { +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java new file mode 100644 index 0000000000..a41b591c94 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package org.eclipse.xtext.ide.editor.contentassist; + +import org.eclipse.xtext.AbstractElement; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.nodemodel.BidiTreeIterator; +import org.eclipse.xtext.nodemodel.ILeafNode; +import org.eclipse.xtext.nodemodel.INode; + +/** + * Small utility to extract the parsable content of a document when + * content assist is invoked at a given location. + * + * @author Sebastian Zarnekow - Initial contribution and API + * @since 2.13 + */ +public class CompletionPrefixProvider { + + /** + * Standard languages only need to parse the text up to the last hidden token sequence + * in the document. Thus the string from start to the normalized offset is sufficient. + */ + public String getInputToParse(String completeInput, int offset, int completionOffset) { + return completeInput.substring(0, offset); + } + + /** + * Returns the last node that appears to be part of the prefix. This will be used to determine + * the current model object that'll be the most special context instance in the proposal provider. + */ + public INode getLastCompleteNodeByOffset(INode node, int offset, int completionOffset) { + BidiTreeIterator iterator = node.getRootNode().getAsTreeIterable().iterator(); + INode result = node; + while (iterator.hasNext()) { + INode candidate = iterator.next(); + if (candidate.getOffset() >= offset) { + break; + } else if ((candidate instanceof ILeafNode) && (candidate.getGrammarElement() == null + || candidate.getGrammarElement() instanceof AbstractElement + || candidate.getGrammarElement() instanceof ParserRule)) { + result = candidate; + } + } + return result; + } + +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IndentationAwareCompletionPrefixProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IndentationAwareCompletionPrefixProvider.java new file mode 100644 index 0000000000..049beb0a9c --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IndentationAwareCompletionPrefixProvider.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (http://www.itemis.de) 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.editor.contentassist; + +import java.util.LinkedList; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.AbstractElement; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.nodemodel.BidiTreeIterator; +import org.eclipse.xtext.nodemodel.ILeafNode; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.util.ITextRegion; +import org.eclipse.xtext.util.LineAndColumn; + +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import com.google.common.collect.PeekingIterator; + +/** + * A CompletionPrefixProvider specialization that is capable of handling synthetic + * BEGIN and END tokens. Their unique property of being a leafnode with a length + * zero can be exploited to match the indentation stack when invoking content assist. * + * + * @author Sebastian Zarnekow - Initial contribution and API + * @since 2.13 + */ +public class IndentationAwareCompletionPrefixProvider extends CompletionPrefixProvider { + + /** + * Returns the input to parse including the whitespace left to the cursor position since + * it may be relevant to the list of proposals for whitespace sensitive languages. + */ + @Override + public String getInputToParse(String completeInput, int offset, int completionOffset) { + int fixedOffset = getOffsetIncludingWhitespace(completeInput, offset, Math.min(completeInput.length(), completionOffset)); + return super.getInputToParse(completeInput, fixedOffset, completionOffset); + } + + protected int getOffsetIncludingWhitespace(String input, int startOffset, int max) { + int result = startOffset; + while(result < max && Character.isWhitespace(input.charAt(result))) { + result++; + } + return result; + } + + @Override + public INode getLastCompleteNodeByOffset(INode node, int offset, int completionOffset) { + INode result = getLastCompleteNodeByOffset(node, offset); + if (result.getTotalLength() == 0) { + // likely a dedent / end token - find the EObject with the respective open token + // and return the best guessed dedent token + int completionColumn = NodeModelUtils.getLineAndColumn(node, completionOffset).getColumn(); + INode bestResult = findBestEndToken(node, result, completionColumn, true); + return bestResult; + } else if (result.getTotalEndOffset() < completionOffset) { + int completionColumn = NodeModelUtils.getLineAndColumn(node, completionOffset).getColumn(); + INode bestResult = findBestEndToken(node, result, completionColumn, false); + return bestResult; + } + return result; + } + + protected INode findBestEndToken(INode root, INode candidate, int completionColumn, boolean candidateIsEndToken) { + LinkedList sameGrammarElement = Lists.newLinkedList(); + PeekingIterator iterator = createReversedLeafIterator(root, candidate, sameGrammarElement); + if (!iterator.hasNext()) { + return candidate; + } + // collect all candidates that belong to the same offset + LinkedList sameOffset = candidateIsEndToken ? collectLeafsWithSameOffset((ILeafNode)candidate, iterator) : Lists.newLinkedList(); + // continue until we find a paired leaf with length 0 that is at the correct offset + EObject grammarElement = tryGetGrammarElementAsRule(candidateIsEndToken || sameGrammarElement.isEmpty() ? candidate : sameGrammarElement.getLast()); + ILeafNode result = candidateIsEndToken ? null : (ILeafNode) candidate; + int sameOffsetSize = sameOffset.size(); + while(iterator.hasNext()) { + ILeafNode next = iterator.next(); + if (result == null || result.isHidden()) { + result = next; + } + if (next.getTotalLength() == 0) { + // potential indentation token + EObject rule = tryGetGrammarElementAsRule(next); + if (rule != grammarElement) { + LineAndColumn lineAndColumn = NodeModelUtils.getLineAndColumn(root, next.getTotalOffset()); + if (lineAndColumn.getColumn() <= completionColumn) { + return result; + } else { + if (sameOffset.isEmpty()) { + if (sameGrammarElement.isEmpty()) { + result = null; + } else { + result = sameGrammarElement.removeLast(); + } + + } else { + if (sameOffsetSize >= sameOffset.size()) { + result = sameOffset.removeLast(); + } else { + sameOffset.removeLast(); + } + } + } + } else { + sameOffset.add(next); + } + } + } + return candidate; + } + + private PeekingIterator createReversedLeafIterator(INode root, INode candidate, LinkedList sameGrammarElement) { + EObject grammarElement = null; + PeekingIterator iterator = Iterators.peekingIterator(Iterators.filter(root.getAsTreeIterable().reverse().iterator(), ILeafNode.class)); + // traverse until we find the current candidate + while(iterator.hasNext()) { + ILeafNode next = iterator.next(); + if (candidate.equals(next)) { + break; + } else if (next.getTotalLength() == 0) { + EObject otherGrammarElement = tryGetGrammarElementAsRule(next); + if (grammarElement == null) { + grammarElement = otherGrammarElement; + } + if (otherGrammarElement.equals(grammarElement)) { + sameGrammarElement.add(next); + } else { + sameGrammarElement.removeLast(); + } + } + } + return iterator; + } + + private LinkedList collectLeafsWithSameOffset(ILeafNode candidate, PeekingIterator iterator) { + LinkedList sameOffset = Lists.newLinkedList(); + sameOffset.add(candidate); + int offset = candidate.getTotalOffset(); + while(iterator.hasNext()) { + ILeafNode peek = iterator.peek(); + if (peek.getTotalOffset() == offset) { + sameOffset.add(peek); + iterator.next(); + } else { + break; + } + } + return sameOffset; + } + + protected EObject tryGetGrammarElementAsRule(INode candidate) { + EObject grammarElement = candidate.getGrammarElement(); + if (grammarElement instanceof RuleCall) { + grammarElement = ((RuleCall) grammarElement).getRule(); + } + return grammarElement; + } + + protected INode getLastCompleteNodeByOffset(INode node, int offset) { + BidiTreeIterator iterator = node.getRootNode().getAsTreeIterable().iterator(); + INode result = node; + ITextRegion candidateTextRegion = node.getTextRegion(); + while (iterator.hasNext()) { + INode candidate = iterator.next(); + ITextRegion textRegion = candidate.getTextRegion(); + if (textRegion.getOffset() >= offset && !(textRegion.getOffset() == offset && textRegion.getLength() == 0)) { + if (!candidateTextRegion.equals(textRegion) && candidate instanceof ILeafNode && textRegion.getLength() + textRegion.getOffset() >= offset) { + break; + } + } + if ((candidate instanceof ILeafNode) && + (candidate.getGrammarElement() == null || + candidate.getGrammarElement() instanceof AbstractElement || + candidate.getGrammarElement() instanceof ParserRule)) { + if (textRegion.getLength() == 0) { + if (candidateTextRegion.getOffset() + candidateTextRegion.getLength() < offset || candidateTextRegion.getLength() == 0 && candidateTextRegion.getOffset() <= offset) { + result = candidate; + candidateTextRegion = candidate.getTextRegion(); + } + } else { + result = candidate; + candidateTextRegion = candidate.getTextRegion(); + } + } + } + return result; + } +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ProposalConflictHelper.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ProposalConflictHelper.java index d3c45bd337..191b8d4a96 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ProposalConflictHelper.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ProposalConflictHelper.java @@ -52,7 +52,8 @@ public boolean existsConflict(String proposal, ContentAssistContext context) { public boolean existsConflict(INode lastCompleteNode, int offset, String proposal, ContentAssistContext context) { String lastCompleteText = lastCompleteNode.getText(); - lastCompleteText = lastCompleteText.substring(0, offset - lastCompleteNode.getTotalOffset()); + int endOffset = offset - lastCompleteNode.getTotalOffset(); + lastCompleteText = lastCompleteText.substring(0, Math.max(endOffset, 0)); if (Strings.isEmpty(lastCompleteText)) return false; return existsConflict(lastCompleteText, proposal, context); diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java index 991737b1d9..33c19abf22 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java @@ -30,11 +30,11 @@ import org.eclipse.xtext.ParserRule; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider; import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext; import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext.Builder; import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser; -import org.eclipse.xtext.nodemodel.BidiTreeIterator; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.ILeafNode; import org.eclipse.xtext.nodemodel.INode; @@ -81,6 +81,12 @@ public class ContentAssistContextFactory implements Function contextBuilderToCheck, EObject previousModel) { List newContexts = Lists.transform(contextBuilderToCheck, this); boolean wasValid = isLikelyToBeValidProposal(lastCompleteNode, newContexts); @@ -239,7 +259,7 @@ protected void handleLastCompleteNodeHasNoGrammarElement(List contextBu protected void handleLastCompleteNodeAsPartOfDatatypeNode() { String prefix = getPrefix(datatypeNode); - String completeInput = document.substring(0, datatypeNode.getOffset()); + String completeInput = getInputToParse(datatypeNode); Collection followElements = parser.getFollowElements(completeInput, false); INode lastCompleteNodeBeforeDatatype = getLastCompleteNodeByOffset(rootNode, datatypeNode.getTotalOffset()); doCreateContexts(lastCompleteNodeBeforeDatatype, datatypeNode, prefix, currentModel, followElements); @@ -274,7 +294,7 @@ protected void createContextsForLastCompleteNode(EObject previousModel, boolean } } String prefix = ""; - String completeInput = document.substring(0, completionOffset); + String completeInput = getInputToParse(document, completionOffset); Collection followElements = parser.getFollowElements(completeInput, strict); doCreateContexts(lastCompleteNode, currentNode, prefix, previousModel, followElements); } @@ -477,19 +497,6 @@ protected AbstractRule getRule(EObject currentGrammarElement) { } protected INode getLastCompleteNodeByOffset(INode node, int offsetPosition) { - BidiTreeIterator iterator = node.getRootNode().getAsTreeIterable().iterator(); - INode result = node; - while (iterator.hasNext()) { - INode candidate = iterator.next(); - if (candidate.getOffset() >= offsetPosition ) { - break; - } else if ((candidate instanceof ILeafNode) && - (candidate.getGrammarElement() == null || - candidate.getGrammarElement() instanceof AbstractElement || - candidate.getGrammarElement() instanceof ParserRule)) { - result = candidate; - } - } - return result; + return completionPrefixProvider.getLastCompleteNodeByOffset(node, offsetPosition, completionOffset); } } \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/LeafNodeFinder.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/LeafNodeFinder.java index 495f2d3b06..3ff182c6cf 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/LeafNodeFinder.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/LeafNodeFinder.java @@ -7,6 +7,8 @@ *******************************************************************************/ package org.eclipse.xtext.ide.editor.contentassist.antlr; +import java.util.Iterator; + import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.ILeafNode; import org.eclipse.xtext.nodemodel.INode; @@ -32,33 +34,54 @@ public ILeafNode searchIn(INode node) { } public ILeafNode caseCompositeNode(ICompositeNode object) { + if (matchesSearchCriteria(object)) { + return searchInChildren(object); + } + return null; + } + + /** + * @since 2.13 + */ + protected boolean matchesSearchCriteria(INode object) { if (leading) { if (object.getTotalOffset() < offset && object.getTotalLength() + object.getTotalOffset() >= offset) { - for (INode node: object.getChildren()) { - ILeafNode result = searchIn(node); - if (result != null) - return result; - } + return true; } } else { if (object.getTotalOffset() <= offset && object.getTotalLength() + object.getTotalOffset() > offset) { - for (INode node: object.getChildren()) { - ILeafNode result = searchIn(node); - if (result != null) - return result; - } + return true; } } - return null; + return object.getTotalOffset() == offset && object.getTotalLength() == 0; + } + + /** + * @since 2.13 + */ + protected ILeafNode searchInChildren(ICompositeNode object) { + Iterator leafNodes = object.getLeafNodes().iterator(); + ILeafNode result = null; + while(leafNodes.hasNext()) { + result = leafNodes.next(); + if (matchesSearchCriteria(result)) { + break; + } + } + while(leafNodes.hasNext()) { + ILeafNode next = leafNodes.next(); + if (matchesSearchCriteria(next)) { + result = next; + } else { + break; + } + } + return result; } public ILeafNode caseLeafNode(ILeafNode object) { - if (leading) { - if (object.getTotalOffset() < offset && object.getTotalLength() + object.getTotalOffset() >= offset) - return object; - } else { - if (object.getTotalOffset() <= offset && object.getTotalLength() + object.getTotalOffset() > offset) - return object; + if (matchesSearchCriteria(object)) { + return object; } return null; } diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.ecore b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.ecore index cdbba67e18..239ca9f5ab 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.ecore +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.ecore @@ -5,10 +5,21 @@ + - + + + + + + + + diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.genmodel b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.genmodel index 86f8b86ef5..f5a0208ce3 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.genmodel +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.genmodel @@ -3,16 +3,24 @@ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext" modelDirectory="/org.eclipse.xtext.tests/src-gen" modelPluginID="org.eclipse.xtext.tests" forceOverwrite="true" modelName="IndentationAwareTestLanguage" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" - complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.9" usedGenPackages="platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"> + complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.9"> + + + + + + + + diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtextbin b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtextbin index a8850c56c1..e7218dce85 100644 Binary files a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtextbin and b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtextbin differ diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/ChildList.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/ChildList.java new file mode 100644 index 0000000000..9d9101aedd --- /dev/null +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/ChildList.java @@ -0,0 +1,44 @@ +/** + * generated by Xtext + */ +package org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Child List'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList#getChildren Children}
  • + *
+ * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getChildList() + * @model + * @generated + */ +public interface ChildList extends EObject +{ + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode}. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getChildList_Children() + * @model containment="true" + * @generated + */ + EList getChildren(); + +} // ChildList diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguageFactory.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguageFactory.java index 550b2adf7e..d94477c892 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguageFactory.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguageFactory.java @@ -41,6 +41,24 @@ public interface IndentationAwareTestLanguageFactory extends EFactory */ TreeNode createTreeNode(); + /** + * Returns a new object of class 'Other Tree Node'. + * + * + * @return a new object of class 'Other Tree Node'. + * @generated + */ + OtherTreeNode createOtherTreeNode(); + + /** + * Returns a new object of class 'Child List'. + * + * + * @return a new object of class 'Child List'. + * @generated + */ + ChildList createChildList(); + /** * Returns the package supported by this factory. * diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguagePackage.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguagePackage.java index 98688ccbe8..dea9bdddb4 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguagePackage.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/IndentationAwareTestLanguagePackage.java @@ -76,6 +76,15 @@ public interface IndentationAwareTestLanguagePackage extends EPackage */ int TREE__NODES = 0; + /** + * The feature id for the 'More Nodes' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE__MORE_NODES = 1; + /** * The number of structural features of the 'Tree' class. * @@ -83,7 +92,7 @@ public interface IndentationAwareTestLanguagePackage extends EPackage * @generated * @ordered */ - int TREE_FEATURE_COUNT = 1; + int TREE_FEATURE_COUNT = 2; /** * The meta object id for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.TreeNodeImpl Tree Node}' class. @@ -122,6 +131,71 @@ public interface IndentationAwareTestLanguagePackage extends EPackage */ int TREE_NODE_FEATURE_COUNT = 2; + /** + * The meta object id for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl Other Tree Node}' class. + * + * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.IndentationAwareTestLanguagePackageImpl#getOtherTreeNode() + * @generated + */ + int OTHER_TREE_NODE = 2; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE__NAME = 0; + + /** + * The feature id for the 'Child List' containment reference. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE__CHILD_LIST = 1; + + /** + * The number of structural features of the 'Other Tree Node' class. + * + * + * @generated + * @ordered + */ + int OTHER_TREE_NODE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.ChildListImpl Child List}' class. + * + * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.ChildListImpl + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.IndentationAwareTestLanguagePackageImpl#getChildList() + * @generated + */ + int CHILD_LIST = 3; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * @generated + * @ordered + */ + int CHILD_LIST__CHILDREN = 0; + + /** + * The number of structural features of the 'Child List' class. + * + * + * @generated + * @ordered + */ + int CHILD_LIST_FEATURE_COUNT = 1; + /** * Returns the meta object for class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree Tree}'. @@ -144,6 +218,17 @@ public interface IndentationAwareTestLanguagePackage extends EPackage */ EReference getTree_Nodes(); + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree#getMoreNodes More Nodes}'. + * + * + * @return the meta object for the containment reference list 'More Nodes'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree#getMoreNodes() + * @see #getTree() + * @generated + */ + EReference getTree_MoreNodes(); + /** * Returns the meta object for class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode Tree Node}'. * @@ -176,6 +261,59 @@ public interface IndentationAwareTestLanguagePackage extends EPackage */ EReference getTreeNode_Children(); + /** + * Returns the meta object for class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode Other Tree Node}'. + * + * + * @return the meta object for class 'Other Tree Node'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode + * @generated + */ + EClass getOtherTreeNode(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getName() + * @see #getOtherTreeNode() + * @generated + */ + EAttribute getOtherTreeNode_Name(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getChildList Child List}'. + * + * + * @return the meta object for the containment reference 'Child List'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getChildList() + * @see #getOtherTreeNode() + * @generated + */ + EReference getOtherTreeNode_ChildList(); + + /** + * Returns the meta object for class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList Child List}'. + * + * + * @return the meta object for class 'Child List'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList + * @generated + */ + EClass getChildList(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList#getChildren Children}'. + * + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList#getChildren() + * @see #getChildList() + * @generated + */ + EReference getChildList_Children(); + /** * Returns the factory that creates the instances of the model. * @@ -217,6 +355,14 @@ interface Literals */ EReference TREE__NODES = eINSTANCE.getTree_Nodes(); + /** + * The meta object literal for the 'More Nodes' containment reference list feature. + * + * + * @generated + */ + EReference TREE__MORE_NODES = eINSTANCE.getTree_MoreNodes(); + /** * The meta object literal for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.TreeNodeImpl Tree Node}' class. * @@ -243,6 +389,50 @@ interface Literals */ EReference TREE_NODE__CHILDREN = eINSTANCE.getTreeNode_Children(); + /** + * The meta object literal for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl Other Tree Node}' class. + * + * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.IndentationAwareTestLanguagePackageImpl#getOtherTreeNode() + * @generated + */ + EClass OTHER_TREE_NODE = eINSTANCE.getOtherTreeNode(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute OTHER_TREE_NODE__NAME = eINSTANCE.getOtherTreeNode_Name(); + + /** + * The meta object literal for the 'Child List' containment reference feature. + * + * + * @generated + */ + EReference OTHER_TREE_NODE__CHILD_LIST = eINSTANCE.getOtherTreeNode_ChildList(); + + /** + * The meta object literal for the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.ChildListImpl Child List}' class. + * + * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.ChildListImpl + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.IndentationAwareTestLanguagePackageImpl#getChildList() + * @generated + */ + EClass CHILD_LIST = eINSTANCE.getChildList(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * @generated + */ + EReference CHILD_LIST__CHILDREN = eINSTANCE.getChildList_Children(); + } } //IndentationAwareTestLanguagePackage diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/OtherTreeNode.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/OtherTreeNode.java new file mode 100644 index 0000000000..7398a3c3fe --- /dev/null +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/OtherTreeNode.java @@ -0,0 +1,79 @@ +/** + * generated by Xtext + */ +package org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Other Tree Node'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getName Name}
  • + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getChildList Child List}
  • + *
+ * + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getOtherTreeNode() + * @model + * @generated + */ +public interface OtherTreeNode extends EObject +{ + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getOtherTreeNode_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Child List' containment reference. + * + *

+ * If the meaning of the 'Child List' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Child List' containment reference. + * @see #setChildList(ChildList) + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getOtherTreeNode_ChildList() + * @model containment="true" + * @generated + */ + ChildList getChildList(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode#getChildList Child List}' containment reference. + * + * + * @param value the new value of the 'Child List' containment reference. + * @see #getChildList() + * @generated + */ + void setChildList(ChildList value); + +} // OtherTreeNode diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/Tree.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/Tree.java index 53b4f135ef..d885e4a65d 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/Tree.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/Tree.java @@ -17,6 +17,7 @@ *

*
    *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree#getNodes Nodes}
  • + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree#getMoreNodes More Nodes}
  • *
* * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getTree() @@ -41,4 +42,20 @@ public interface Tree extends EObject */ EList getNodes(); + /** + * Returns the value of the 'More Nodes' containment reference list. + * The list contents are of type {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode}. + * + *

+ * If the meaning of the 'More Nodes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'More Nodes' containment reference list. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage#getTree_MoreNodes() + * @model containment="true" + * @generated + */ + EList getMoreNodes(); + } // Tree diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/ChildListImpl.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/ChildListImpl.java new file mode 100644 index 0000000000..5a1e60672a --- /dev/null +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/ChildListImpl.java @@ -0,0 +1,168 @@ +/** + * generated by Xtext + */ +package org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.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.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; + +/** + * + * An implementation of the model object 'Child List'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.ChildListImpl#getChildren Children}
  • + *
+ * + * @generated + */ +public class ChildListImpl extends MinimalEObjectImpl.Container implements ChildList +{ + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * @generated + */ + protected ChildListImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareTestLanguagePackage.Literals.CHILD_LIST; + } + + /** + * + * + * @generated + */ + public EList getChildren() + { + if (children == null) + { + children = new EObjectContainmentEList(OtherTreeNode.class, this, IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN); + } + return children; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN: + return ((InternalEList)getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN: + return getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN: + getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.CHILD_LIST__CHILDREN: + return children != null && !children.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ChildListImpl diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguageFactoryImpl.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguageFactoryImpl.java index f3fc53faf7..80edf05e29 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguageFactoryImpl.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguageFactoryImpl.java @@ -67,6 +67,8 @@ public EObject create(EClass eClass) { case IndentationAwareTestLanguagePackage.TREE: return createTree(); case IndentationAwareTestLanguagePackage.TREE_NODE: return createTreeNode(); + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE: return createOtherTreeNode(); + case IndentationAwareTestLanguagePackage.CHILD_LIST: return createChildList(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -94,6 +96,28 @@ public TreeNode createTreeNode() return treeNode; } + /** + * + * + * @generated + */ + public OtherTreeNode createOtherTreeNode() + { + OtherTreeNodeImpl otherTreeNode = new OtherTreeNodeImpl(); + return otherTreeNode; + } + + /** + * + * + * @generated + */ + public ChildList createChildList() + { + ChildListImpl childList = new ChildListImpl(); + return childList; + } + /** * * diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguagePackageImpl.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguagePackageImpl.java index 46691a0ee3..574d17ca0f 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguagePackageImpl.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/IndentationAwareTestLanguagePackageImpl.java @@ -7,12 +7,13 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguageFactory; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode; @@ -38,6 +39,20 @@ public class IndentationAwareTestLanguagePackageImpl extends EPackageImpl implem */ private EClass treeNodeEClass = null; + /** + * + * + * @generated + */ + private EClass otherTreeNodeEClass = null; + + /** + * + * + * @generated + */ + private EClass childListEClass = null; + /** * Creates an instance of the model Package, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package @@ -86,9 +101,6 @@ public static IndentationAwareTestLanguagePackage init() isInited = true; - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - // Create package meta-data objects theIndentationAwareTestLanguagePackage.createPackageContents(); @@ -124,6 +136,16 @@ public EReference getTree_Nodes() return (EReference)treeEClass.getEStructuralFeatures().get(0); } + /** + * + * + * @generated + */ + public EReference getTree_MoreNodes() + { + return (EReference)treeEClass.getEStructuralFeatures().get(1); + } + /** * * @@ -154,6 +176,56 @@ public EReference getTreeNode_Children() return (EReference)treeNodeEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + public EClass getOtherTreeNode() + { + return otherTreeNodeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getOtherTreeNode_Name() + { + return (EAttribute)otherTreeNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getOtherTreeNode_ChildList() + { + return (EReference)otherTreeNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getChildList() + { + return childListEClass; + } + + /** + * + * + * @generated + */ + public EReference getChildList_Children() + { + return (EReference)childListEClass.getEStructuralFeatures().get(0); + } + /** * * @@ -186,10 +258,18 @@ public void createPackageContents() // Create classes and their features treeEClass = createEClass(TREE); createEReference(treeEClass, TREE__NODES); + createEReference(treeEClass, TREE__MORE_NODES); treeNodeEClass = createEClass(TREE_NODE); createEAttribute(treeNodeEClass, TREE_NODE__NAME); createEReference(treeNodeEClass, TREE_NODE__CHILDREN); + + otherTreeNodeEClass = createEClass(OTHER_TREE_NODE); + createEAttribute(otherTreeNodeEClass, OTHER_TREE_NODE__NAME); + createEReference(otherTreeNodeEClass, OTHER_TREE_NODE__CHILD_LIST); + + childListEClass = createEClass(CHILD_LIST); + createEReference(childListEClass, CHILD_LIST__CHILDREN); } /** @@ -216,9 +296,6 @@ public void initializePackageContents() setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); - // Obtain other dependent packages - EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); - // Create type parameters // Set bounds for type parameters @@ -228,11 +305,19 @@ public void initializePackageContents() // Initialize classes and features; add operations and parameters initEClass(treeEClass, Tree.class, "Tree", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getTree_Nodes(), this.getTreeNode(), null, "nodes", null, 0, -1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTree_MoreNodes(), this.getOtherTreeNode(), null, "moreNodes", null, 0, -1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getTreeNode_Name(), theEcorePackage.getEString(), "name", null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getTreeNode_Children(), this.getTreeNode(), null, "children", null, 0, -1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(otherTreeNodeEClass, OtherTreeNode.class, "OtherTreeNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getOtherTreeNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, OtherTreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getOtherTreeNode_ChildList(), this.getChildList(), null, "childList", null, 0, 1, OtherTreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(childListEClass, ChildList.class, "ChildList", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getChildList_Children(), this.getOtherTreeNode(), null, "children", null, 0, -1, ChildList.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Create resource createResource(eNS_URI); } diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/OtherTreeNodeImpl.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/OtherTreeNodeImpl.java new file mode 100644 index 0000000000..718de9809f --- /dev/null +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/OtherTreeNodeImpl.java @@ -0,0 +1,266 @@ +/** + * generated by Xtext + */ +package org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; + +/** + * + * An implementation of the model object 'Other Tree Node'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl#getName Name}
  • + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.OtherTreeNodeImpl#getChildList Child List}
  • + *
+ * + * @generated + */ +public class OtherTreeNodeImpl extends MinimalEObjectImpl.Container implements OtherTreeNode +{ + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getChildList() Child List}' containment reference. + * + * + * @see #getChildList() + * @generated + * @ordered + */ + protected ChildList childList; + + /** + * + * + * @generated + */ + protected OtherTreeNodeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return IndentationAwareTestLanguagePackage.Literals.OTHER_TREE_NODE; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public ChildList getChildList() + { + return childList; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetChildList(ChildList newChildList, NotificationChain msgs) + { + ChildList oldChildList = childList; + childList = newChildList; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, oldChildList, newChildList); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setChildList(ChildList newChildList) + { + if (newChildList != childList) + { + NotificationChain msgs = null; + if (childList != null) + msgs = ((InternalEObject)childList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, null, msgs); + if (newChildList != null) + msgs = ((InternalEObject)newChildList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, null, msgs); + msgs = basicSetChildList(newChildList, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST, newChildList, newChildList)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return basicSetChildList(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__NAME: + return getName(); + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return getChildList(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__NAME: + setName((String)newValue); + return; + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + setChildList((ChildList)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__NAME: + setName(NAME_EDEFAULT); + return; + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + setChildList((ChildList)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE__CHILD_LIST: + return childList != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @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(); + } + +} //OtherTreeNodeImpl diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/TreeImpl.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/TreeImpl.java index f216678dd3..c7a17e06b2 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/TreeImpl.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/impl/TreeImpl.java @@ -18,6 +18,7 @@ import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode; @@ -30,6 +31,7 @@ *

*
    *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.TreeImpl#getNodes Nodes}
  • + *
  • {@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.impl.TreeImpl#getMoreNodes More Nodes}
  • *
* * @generated @@ -46,6 +48,16 @@ public class TreeImpl extends MinimalEObjectImpl.Container implements Tree */ protected EList nodes; + /** + * The cached value of the '{@link #getMoreNodes() More Nodes}' containment reference list. + * + * + * @see #getMoreNodes() + * @generated + * @ordered + */ + protected EList moreNodes; + /** * * @@ -81,6 +93,20 @@ public EList getNodes() return nodes; } + /** + * + * + * @generated + */ + public EList getMoreNodes() + { + if (moreNodes == null) + { + moreNodes = new EObjectContainmentEList(OtherTreeNode.class, this, IndentationAwareTestLanguagePackage.TREE__MORE_NODES); + } + return moreNodes; + } + /** * * @@ -93,6 +119,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, { case IndentationAwareTestLanguagePackage.TREE__NODES: return ((InternalEList)getNodes()).basicRemove(otherEnd, msgs); + case IndentationAwareTestLanguagePackage.TREE__MORE_NODES: + return ((InternalEList)getMoreNodes()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -109,6 +137,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { case IndentationAwareTestLanguagePackage.TREE__NODES: return getNodes(); + case IndentationAwareTestLanguagePackage.TREE__MORE_NODES: + return getMoreNodes(); } return super.eGet(featureID, resolve, coreType); } @@ -128,6 +158,10 @@ public void eSet(int featureID, Object newValue) getNodes().clear(); getNodes().addAll((Collection)newValue); return; + case IndentationAwareTestLanguagePackage.TREE__MORE_NODES: + getMoreNodes().clear(); + getMoreNodes().addAll((Collection)newValue); + return; } super.eSet(featureID, newValue); } @@ -145,6 +179,9 @@ public void eUnset(int featureID) case IndentationAwareTestLanguagePackage.TREE__NODES: getNodes().clear(); return; + case IndentationAwareTestLanguagePackage.TREE__MORE_NODES: + getMoreNodes().clear(); + return; } super.eUnset(featureID); } @@ -161,6 +198,8 @@ public boolean eIsSet(int featureID) { case IndentationAwareTestLanguagePackage.TREE__NODES: return nodes != null && !nodes.isEmpty(); + case IndentationAwareTestLanguagePackage.TREE__MORE_NODES: + return moreNodes != null && !moreNodes.isEmpty(); } return super.eIsSet(featureID); } diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageAdapterFactory.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageAdapterFactory.java index 1530d81ed9..bb06c8035a 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageAdapterFactory.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageAdapterFactory.java @@ -86,6 +86,16 @@ public Adapter caseTreeNode(TreeNode object) return createTreeNodeAdapter(); } @Override + public Adapter caseOtherTreeNode(OtherTreeNode object) + { + return createOtherTreeNodeAdapter(); + } + @Override + public Adapter caseChildList(ChildList object) + { + return createChildListAdapter(); + } + @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); @@ -137,6 +147,36 @@ public Adapter createTreeNodeAdapter() return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode Other Tree Node}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode + * @generated + */ + public Adapter createOtherTreeNodeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList Child List}'. + * + * 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. + * + * @return the new adapter. + * @see org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList + * @generated + */ + public Adapter createChildListAdapter() + { + return null; + } + /** * Creates a new adapter for the default case. * diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageSwitch.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageSwitch.java index 52f31064e0..4d68d61715 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageSwitch.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/indentationAwareTestLanguage/util/IndentationAwareTestLanguageSwitch.java @@ -87,6 +87,20 @@ protected T doSwitch(int classifierID, EObject theEObject) if (result == null) result = defaultCase(theEObject); return result; } + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE: + { + OtherTreeNode otherTreeNode = (OtherTreeNode)theEObject; + T result = caseOtherTreeNode(otherTreeNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IndentationAwareTestLanguagePackage.CHILD_LIST: + { + ChildList childList = (ChildList)theEObject; + T result = caseChildList(childList); + if (result == null) result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } } @@ -123,6 +137,38 @@ public T caseTreeNode(TreeNode object) return null; } + /** + * Returns the result of interpreting the object as an instance of 'Other Tree Node'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Other Tree Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseOtherTreeNode(OtherTreeNode object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Child List'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Child List'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseChildList(ChildList object) + { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'EObject'. * diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.g b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.g index d55e760b06..24cfa3c314 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.g +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.g @@ -95,6 +95,25 @@ ruleTree returns [EObject current=null] } ) )* + ( + ( + { + newCompositeNode(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + } + lv_moreNodes_2_0=ruleOtherTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + $current, + "moreNodes", + lv_moreNodes_2_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )* ) ; @@ -163,3 +182,112 @@ ruleTreeNode returns [EObject current=null] )? ) ; + +// Entry rule entryRuleOtherTreeNode +entryRuleOtherTreeNode returns [EObject current=null]: + { newCompositeNode(grammarAccess.getOtherTreeNodeRule()); } + iv_ruleOtherTreeNode=ruleOtherTreeNode + { $current=$iv_ruleOtherTreeNode.current; } + EOF; + +// Rule OtherTreeNode +ruleOtherTreeNode returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + lv_name_0_0=RULE_STRING + { + newLeafNode(lv_name_0_0, grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getOtherTreeNodeRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.STRING"); + } + ) + ) + ( + ( + { + newCompositeNode(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + } + lv_childList_1_0=ruleChildList + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getOtherTreeNodeRule()); + } + set( + $current, + "childList", + lv_childList_1_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.ChildList"); + afterParserOrEnumRuleCall(); + } + ) + )? + ) +; + +// Entry rule entryRuleChildList +entryRuleChildList returns [EObject current=null]: + { newCompositeNode(grammarAccess.getChildListRule()); } + iv_ruleChildList=ruleChildList + { $current=$iv_ruleChildList.current; } + EOF; + +// Rule ChildList +ruleChildList returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + $current = forceCreateModelElement( + grammarAccess.getChildListAccess().getChildListAction_0(), + $current); + } + ) + this_INDENT_1=RULE_INDENT + { + newLeafNode(this_INDENT_1, grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + } + ( + ( + { + newCompositeNode(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + } + lv_children_2_0=ruleOtherTreeNode + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getChildListRule()); + } + add( + $current, + "children", + lv_children_2_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + } + ) + )+ + this_DEDENT_3=RULE_DEDENT + { + newLeafNode(this_DEDENT_3, grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + } + ) +; diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.java index e0dd11990d..388aba0055 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/parser/antlr/internal/InternalIndentationAwareTestLanguageParser.java @@ -110,22 +110,24 @@ public final EObject entryRuleTree() throws RecognitionException { // $ANTLR start "ruleTree" - // InternalIndentationAwareTestLanguageParser.g:64:1: ruleTree returns [EObject current=null] : ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ) ; + // InternalIndentationAwareTestLanguageParser.g:64:1: ruleTree returns [EObject current=null] : ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) ; public final EObject ruleTree() throws RecognitionException { EObject current = null; EObject lv_nodes_1_0 = null; + EObject lv_moreNodes_2_0 = null; + enterRule(); try { - // InternalIndentationAwareTestLanguageParser.g:70:2: ( ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ) ) - // InternalIndentationAwareTestLanguageParser.g:71:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ) + // InternalIndentationAwareTestLanguageParser.g:70:2: ( ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) ) + // InternalIndentationAwareTestLanguageParser.g:71:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) { - // InternalIndentationAwareTestLanguageParser.g:71:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ) - // InternalIndentationAwareTestLanguageParser.g:72:3: () ( (lv_nodes_1_0= ruleTreeNode ) )* + // InternalIndentationAwareTestLanguageParser.g:71:2: ( () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* ) + // InternalIndentationAwareTestLanguageParser.g:72:3: () ( (lv_nodes_1_0= ruleTreeNode ) )* ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* { // InternalIndentationAwareTestLanguageParser.g:72:3: () // InternalIndentationAwareTestLanguageParser.g:73:4: @@ -187,6 +189,55 @@ public final EObject ruleTree() throws RecognitionException { } } while (true); + // InternalIndentationAwareTestLanguageParser.g:98:3: ( (lv_moreNodes_2_0= ruleOtherTreeNode ) )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0==RULE_STRING) ) { + alt2=1; + } + + + switch (alt2) { + case 1 : + // InternalIndentationAwareTestLanguageParser.g:99:4: (lv_moreNodes_2_0= ruleOtherTreeNode ) + { + // InternalIndentationAwareTestLanguageParser.g:99:4: (lv_moreNodes_2_0= ruleOtherTreeNode ) + // InternalIndentationAwareTestLanguageParser.g:100:5: lv_moreNodes_2_0= ruleOtherTreeNode + { + + newCompositeNode(grammarAccess.getTreeAccess().getMoreNodesOtherTreeNodeParserRuleCall_2_0()); + + pushFollow(FollowSets000.FOLLOW_4); + lv_moreNodes_2_0=ruleOtherTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getTreeRule()); + } + add( + current, + "moreNodes", + lv_moreNodes_2_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + break loop2; + } + } while (true); + } @@ -210,7 +261,7 @@ public final EObject ruleTree() throws RecognitionException { // $ANTLR start "entryRuleTreeNode" - // InternalIndentationAwareTestLanguageParser.g:102:1: entryRuleTreeNode returns [EObject current=null] : iv_ruleTreeNode= ruleTreeNode EOF ; + // InternalIndentationAwareTestLanguageParser.g:121:1: entryRuleTreeNode returns [EObject current=null] : iv_ruleTreeNode= ruleTreeNode EOF ; public final EObject entryRuleTreeNode() throws RecognitionException { EObject current = null; @@ -218,8 +269,8 @@ public final EObject entryRuleTreeNode() throws RecognitionException { try { - // InternalIndentationAwareTestLanguageParser.g:102:49: (iv_ruleTreeNode= ruleTreeNode EOF ) - // InternalIndentationAwareTestLanguageParser.g:103:2: iv_ruleTreeNode= ruleTreeNode EOF + // InternalIndentationAwareTestLanguageParser.g:121:49: (iv_ruleTreeNode= ruleTreeNode EOF ) + // InternalIndentationAwareTestLanguageParser.g:122:2: iv_ruleTreeNode= ruleTreeNode EOF { newCompositeNode(grammarAccess.getTreeNodeRule()); pushFollow(FollowSets000.FOLLOW_1); @@ -246,7 +297,7 @@ public final EObject entryRuleTreeNode() throws RecognitionException { // $ANTLR start "ruleTreeNode" - // InternalIndentationAwareTestLanguageParser.g:109:1: ruleTreeNode returns [EObject current=null] : ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ; + // InternalIndentationAwareTestLanguageParser.g:128:1: ruleTreeNode returns [EObject current=null] : ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ; public final EObject ruleTreeNode() throws RecognitionException { EObject current = null; @@ -260,19 +311,19 @@ public final EObject ruleTreeNode() throws RecognitionException { enterRule(); try { - // InternalIndentationAwareTestLanguageParser.g:115:2: ( ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ) - // InternalIndentationAwareTestLanguageParser.g:116:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) + // InternalIndentationAwareTestLanguageParser.g:134:2: ( ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) ) + // InternalIndentationAwareTestLanguageParser.g:135:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) { - // InternalIndentationAwareTestLanguageParser.g:116:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) - // InternalIndentationAwareTestLanguageParser.g:117:3: ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? + // InternalIndentationAwareTestLanguageParser.g:135:2: ( ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? ) + // InternalIndentationAwareTestLanguageParser.g:136:3: ( (lv_name_0_0= RULE_ID ) ) (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? { - // InternalIndentationAwareTestLanguageParser.g:117:3: ( (lv_name_0_0= RULE_ID ) ) - // InternalIndentationAwareTestLanguageParser.g:118:4: (lv_name_0_0= RULE_ID ) + // InternalIndentationAwareTestLanguageParser.g:136:3: ( (lv_name_0_0= RULE_ID ) ) + // InternalIndentationAwareTestLanguageParser.g:137:4: (lv_name_0_0= RULE_ID ) { - // InternalIndentationAwareTestLanguageParser.g:118:4: (lv_name_0_0= RULE_ID ) - // InternalIndentationAwareTestLanguageParser.g:119:5: lv_name_0_0= RULE_ID + // InternalIndentationAwareTestLanguageParser.g:137:4: (lv_name_0_0= RULE_ID ) + // InternalIndentationAwareTestLanguageParser.g:138:5: lv_name_0_0= RULE_ID { - lv_name_0_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_4); + lv_name_0_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_5); newLeafNode(lv_name_0_0, grammarAccess.getTreeNodeAccess().getNameIDTerminalRuleCall_0_0()); @@ -292,43 +343,43 @@ public final EObject ruleTreeNode() throws RecognitionException { } - // InternalIndentationAwareTestLanguageParser.g:135:3: (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? - int alt3=2; - int LA3_0 = input.LA(1); + // InternalIndentationAwareTestLanguageParser.g:154:3: (this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT )? + int alt4=2; + int LA4_0 = input.LA(1); - if ( (LA3_0==RULE_INDENT) ) { - alt3=1; + if ( (LA4_0==RULE_INDENT) ) { + alt4=1; } - switch (alt3) { + switch (alt4) { case 1 : - // InternalIndentationAwareTestLanguageParser.g:136:4: this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT + // InternalIndentationAwareTestLanguageParser.g:155:4: this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleTreeNode ) )* this_DEDENT_3= RULE_DEDENT { - this_INDENT_1=(Token)match(input,RULE_INDENT,FollowSets000.FOLLOW_5); + this_INDENT_1=(Token)match(input,RULE_INDENT,FollowSets000.FOLLOW_6); newLeafNode(this_INDENT_1, grammarAccess.getTreeNodeAccess().getINDENTTerminalRuleCall_1_0()); - // InternalIndentationAwareTestLanguageParser.g:140:4: ( (lv_children_2_0= ruleTreeNode ) )* - loop2: + // InternalIndentationAwareTestLanguageParser.g:159:4: ( (lv_children_2_0= ruleTreeNode ) )* + loop3: do { - int alt2=2; - int LA2_0 = input.LA(1); + int alt3=2; + int LA3_0 = input.LA(1); - if ( (LA2_0==RULE_ID) ) { - alt2=1; + if ( (LA3_0==RULE_ID) ) { + alt3=1; } - switch (alt2) { + switch (alt3) { case 1 : - // InternalIndentationAwareTestLanguageParser.g:141:5: (lv_children_2_0= ruleTreeNode ) + // InternalIndentationAwareTestLanguageParser.g:160:5: (lv_children_2_0= ruleTreeNode ) { - // InternalIndentationAwareTestLanguageParser.g:141:5: (lv_children_2_0= ruleTreeNode ) - // InternalIndentationAwareTestLanguageParser.g:142:6: lv_children_2_0= ruleTreeNode + // InternalIndentationAwareTestLanguageParser.g:160:5: (lv_children_2_0= ruleTreeNode ) + // InternalIndentationAwareTestLanguageParser.g:161:6: lv_children_2_0= ruleTreeNode { newCompositeNode(grammarAccess.getTreeNodeAccess().getChildrenTreeNodeParserRuleCall_1_1_0()); - pushFollow(FollowSets000.FOLLOW_5); + pushFollow(FollowSets000.FOLLOW_6); lv_children_2_0=ruleTreeNode(); state._fsp--; @@ -352,7 +403,7 @@ public final EObject ruleTreeNode() throws RecognitionException { break; default : - break loop2; + break loop3; } } while (true); @@ -387,6 +438,302 @@ public final EObject ruleTreeNode() throws RecognitionException { } // $ANTLR end "ruleTreeNode" + + // $ANTLR start "entryRuleOtherTreeNode" + // InternalIndentationAwareTestLanguageParser.g:187:1: entryRuleOtherTreeNode returns [EObject current=null] : iv_ruleOtherTreeNode= ruleOtherTreeNode EOF ; + public final EObject entryRuleOtherTreeNode() throws RecognitionException { + EObject current = null; + + EObject iv_ruleOtherTreeNode = null; + + + try { + // InternalIndentationAwareTestLanguageParser.g:187:54: (iv_ruleOtherTreeNode= ruleOtherTreeNode EOF ) + // InternalIndentationAwareTestLanguageParser.g:188:2: iv_ruleOtherTreeNode= ruleOtherTreeNode EOF + { + newCompositeNode(grammarAccess.getOtherTreeNodeRule()); + pushFollow(FollowSets000.FOLLOW_1); + iv_ruleOtherTreeNode=ruleOtherTreeNode(); + + state._fsp--; + + current =iv_ruleOtherTreeNode; + match(input,EOF,FollowSets000.FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleOtherTreeNode" + + + // $ANTLR start "ruleOtherTreeNode" + // InternalIndentationAwareTestLanguageParser.g:194:1: ruleOtherTreeNode returns [EObject current=null] : ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) ; + public final EObject ruleOtherTreeNode() throws RecognitionException { + EObject current = null; + + Token lv_name_0_0=null; + EObject lv_childList_1_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareTestLanguageParser.g:200:2: ( ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) ) + // InternalIndentationAwareTestLanguageParser.g:201:2: ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) + { + // InternalIndentationAwareTestLanguageParser.g:201:2: ( ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? ) + // InternalIndentationAwareTestLanguageParser.g:202:3: ( (lv_name_0_0= RULE_STRING ) ) ( (lv_childList_1_0= ruleChildList ) )? + { + // InternalIndentationAwareTestLanguageParser.g:202:3: ( (lv_name_0_0= RULE_STRING ) ) + // InternalIndentationAwareTestLanguageParser.g:203:4: (lv_name_0_0= RULE_STRING ) + { + // InternalIndentationAwareTestLanguageParser.g:203:4: (lv_name_0_0= RULE_STRING ) + // InternalIndentationAwareTestLanguageParser.g:204:5: lv_name_0_0= RULE_STRING + { + lv_name_0_0=(Token)match(input,RULE_STRING,FollowSets000.FOLLOW_5); + + newLeafNode(lv_name_0_0, grammarAccess.getOtherTreeNodeAccess().getNameSTRINGTerminalRuleCall_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getOtherTreeNodeRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_0_0, + "org.eclipse.xtext.common.Terminals.STRING"); + + + } + + + } + + // InternalIndentationAwareTestLanguageParser.g:220:3: ( (lv_childList_1_0= ruleChildList ) )? + int alt5=2; + int LA5_0 = input.LA(1); + + if ( (LA5_0==RULE_INDENT) ) { + alt5=1; + } + switch (alt5) { + case 1 : + // InternalIndentationAwareTestLanguageParser.g:221:4: (lv_childList_1_0= ruleChildList ) + { + // InternalIndentationAwareTestLanguageParser.g:221:4: (lv_childList_1_0= ruleChildList ) + // InternalIndentationAwareTestLanguageParser.g:222:5: lv_childList_1_0= ruleChildList + { + + newCompositeNode(grammarAccess.getOtherTreeNodeAccess().getChildListChildListParserRuleCall_1_0()); + + pushFollow(FollowSets000.FOLLOW_2); + lv_childList_1_0=ruleChildList(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getOtherTreeNodeRule()); + } + set( + current, + "childList", + lv_childList_1_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.ChildList"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleOtherTreeNode" + + + // $ANTLR start "entryRuleChildList" + // InternalIndentationAwareTestLanguageParser.g:243:1: entryRuleChildList returns [EObject current=null] : iv_ruleChildList= ruleChildList EOF ; + public final EObject entryRuleChildList() throws RecognitionException { + EObject current = null; + + EObject iv_ruleChildList = null; + + + try { + // InternalIndentationAwareTestLanguageParser.g:243:50: (iv_ruleChildList= ruleChildList EOF ) + // InternalIndentationAwareTestLanguageParser.g:244:2: iv_ruleChildList= ruleChildList EOF + { + newCompositeNode(grammarAccess.getChildListRule()); + pushFollow(FollowSets000.FOLLOW_1); + iv_ruleChildList=ruleChildList(); + + state._fsp--; + + current =iv_ruleChildList; + match(input,EOF,FollowSets000.FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleChildList" + + + // $ANTLR start "ruleChildList" + // InternalIndentationAwareTestLanguageParser.g:250:1: ruleChildList returns [EObject current=null] : ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) ; + public final EObject ruleChildList() throws RecognitionException { + EObject current = null; + + Token this_INDENT_1=null; + Token this_DEDENT_3=null; + EObject lv_children_2_0 = null; + + + + enterRule(); + + try { + // InternalIndentationAwareTestLanguageParser.g:256:2: ( ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) ) + // InternalIndentationAwareTestLanguageParser.g:257:2: ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) + { + // InternalIndentationAwareTestLanguageParser.g:257:2: ( () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT ) + // InternalIndentationAwareTestLanguageParser.g:258:3: () this_INDENT_1= RULE_INDENT ( (lv_children_2_0= ruleOtherTreeNode ) )+ this_DEDENT_3= RULE_DEDENT + { + // InternalIndentationAwareTestLanguageParser.g:258:3: () + // InternalIndentationAwareTestLanguageParser.g:259:4: + { + + current = forceCreateModelElement( + grammarAccess.getChildListAccess().getChildListAction_0(), + current); + + + } + + this_INDENT_1=(Token)match(input,RULE_INDENT,FollowSets000.FOLLOW_7); + + newLeafNode(this_INDENT_1, grammarAccess.getChildListAccess().getINDENTTerminalRuleCall_1()); + + // InternalIndentationAwareTestLanguageParser.g:269:3: ( (lv_children_2_0= ruleOtherTreeNode ) )+ + int cnt6=0; + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==RULE_STRING) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // InternalIndentationAwareTestLanguageParser.g:270:4: (lv_children_2_0= ruleOtherTreeNode ) + { + // InternalIndentationAwareTestLanguageParser.g:270:4: (lv_children_2_0= ruleOtherTreeNode ) + // InternalIndentationAwareTestLanguageParser.g:271:5: lv_children_2_0= ruleOtherTreeNode + { + + newCompositeNode(grammarAccess.getChildListAccess().getChildrenOtherTreeNodeParserRuleCall_2_0()); + + pushFollow(FollowSets000.FOLLOW_8); + lv_children_2_0=ruleOtherTreeNode(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getChildListRule()); + } + add( + current, + "children", + lv_children_2_0, + "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.OtherTreeNode"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + if ( cnt6 >= 1 ) break loop6; + EarlyExitException eee = + new EarlyExitException(6, input); + throw eee; + } + cnt6++; + } while (true); + + this_DEDENT_3=(Token)match(input,RULE_DEDENT,FollowSets000.FOLLOW_2); + + newLeafNode(this_DEDENT_3, grammarAccess.getChildListAccess().getDEDENTTerminalRuleCall_3()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleChildList" + // Delegated rules @@ -396,9 +743,12 @@ public final EObject ruleTreeNode() throws RecognitionException { private static class FollowSets000 { public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000082L}); - public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000022L}); - public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x00000000000000C0L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000282L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000202L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000022L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x00000000000002C0L}); + public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000000200L}); + public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000000240L}); } diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/serializer/AbstractIndentationAwareTestLanguageSemanticSequencer.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/serializer/AbstractIndentationAwareTestLanguageSemanticSequencer.java index f71f23bf9a..7e878d1608 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/serializer/AbstractIndentationAwareTestLanguageSemanticSequencer.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/serializer/AbstractIndentationAwareTestLanguageSemanticSequencer.java @@ -10,7 +10,9 @@ import org.eclipse.xtext.Action; import org.eclipse.xtext.Parameter; import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.IndentationAwareTestLanguagePackage; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode; import org.eclipse.xtext.parser.indentation.services.IndentationAwareTestLanguageGrammarAccess; @@ -31,6 +33,12 @@ public void sequence(ISerializationContext context, EObject semanticObject) { Set parameters = context.getEnabledBooleanParameters(); if (epackage == IndentationAwareTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { + case IndentationAwareTestLanguagePackage.CHILD_LIST: + sequence_ChildList(context, (ChildList) semanticObject); + return; + case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE: + sequence_OtherTreeNode(context, (OtherTreeNode) semanticObject); + return; case IndentationAwareTestLanguagePackage.TREE: sequence_Tree(context, (Tree) semanticObject); return; @@ -42,6 +50,30 @@ public void sequence(ISerializationContext context, EObject semanticObject) { errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); } + /** + * Contexts: + * ChildList returns ChildList + * + * Constraint: + * children+=OtherTreeNode+ + */ + protected void sequence_ChildList(ISerializationContext context, ChildList semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * OtherTreeNode returns OtherTreeNode + * + * Constraint: + * (name=STRING childList=ChildList?) + */ + protected void sequence_OtherTreeNode(ISerializationContext context, OtherTreeNode semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + /** * Contexts: * TreeNode returns TreeNode @@ -59,7 +91,7 @@ protected void sequence_TreeNode(ISerializationContext context, TreeNode semanti * Tree returns Tree * * Constraint: - * nodes+=TreeNode* + * (nodes+=TreeNode* moreNodes+=OtherTreeNode*) */ protected void sequence_Tree(ISerializationContext context, Tree semanticObject) { genericSequencer.createSequence(context, semanticObject); diff --git a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/services/IndentationAwareTestLanguageGrammarAccess.java b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/services/IndentationAwareTestLanguageGrammarAccess.java index b521331d88..9c8138deee 100644 --- a/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/services/IndentationAwareTestLanguageGrammarAccess.java +++ b/org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/indentation/services/IndentationAwareTestLanguageGrammarAccess.java @@ -27,12 +27,15 @@ public class TreeElements extends AbstractParserRuleElementFinder { private final Action cTreeAction_0 = (Action)cGroup.eContents().get(0); private final Assignment cNodesAssignment_1 = (Assignment)cGroup.eContents().get(1); private final RuleCall cNodesTreeNodeParserRuleCall_1_0 = (RuleCall)cNodesAssignment_1.eContents().get(0); + private final Assignment cMoreNodesAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cMoreNodesOtherTreeNodeParserRuleCall_2_0 = (RuleCall)cMoreNodesAssignment_2.eContents().get(0); //Tree: - // {Tree} nodes+=TreeNode*; + // {Tree} nodes+=TreeNode* + // moreNodes+=OtherTreeNode*; @Override public ParserRule getRule() { return rule; } - //{Tree} nodes+=TreeNode* + //{Tree} nodes+=TreeNode* moreNodes+=OtherTreeNode* public Group getGroup() { return cGroup; } //{Tree} @@ -43,6 +46,12 @@ public class TreeElements extends AbstractParserRuleElementFinder { //TreeNode public RuleCall getNodesTreeNodeParserRuleCall_1_0() { return cNodesTreeNodeParserRuleCall_1_0; } + + //moreNodes+=OtherTreeNode* + public Assignment getMoreNodesAssignment_2() { return cMoreNodesAssignment_2; } + + //OtherTreeNode + public RuleCall getMoreNodesOtherTreeNodeParserRuleCall_2_0() { return cMoreNodesOtherTreeNodeParserRuleCall_2_0; } } public class TreeNodeElements extends AbstractParserRuleElementFinder { private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.TreeNode"); @@ -85,10 +94,73 @@ public class TreeNodeElements extends AbstractParserRuleElementFinder { //DEDENT public RuleCall getDEDENTTerminalRuleCall_1_2() { return cDEDENTTerminalRuleCall_1_2; } } + public class OtherTreeNodeElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.OtherTreeNode"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cNameAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final RuleCall cNameSTRINGTerminalRuleCall_0_0 = (RuleCall)cNameAssignment_0.eContents().get(0); + private final Assignment cChildListAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cChildListChildListParserRuleCall_1_0 = (RuleCall)cChildListAssignment_1.eContents().get(0); + + //OtherTreeNode: + // name=STRING + // childList=ChildList?; + @Override public ParserRule getRule() { return rule; } + + //name=STRING childList=ChildList? + public Group getGroup() { return cGroup; } + + //name=STRING + public Assignment getNameAssignment_0() { return cNameAssignment_0; } + + //STRING + public RuleCall getNameSTRINGTerminalRuleCall_0_0() { return cNameSTRINGTerminalRuleCall_0_0; } + + //childList=ChildList? + public Assignment getChildListAssignment_1() { return cChildListAssignment_1; } + + //ChildList + public RuleCall getChildListChildListParserRuleCall_1_0() { return cChildListChildListParserRuleCall_1_0; } + } + public class ChildListElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.ChildList"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Action cChildListAction_0 = (Action)cGroup.eContents().get(0); + private final RuleCall cINDENTTerminalRuleCall_1 = (RuleCall)cGroup.eContents().get(1); + private final Assignment cChildrenAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cChildrenOtherTreeNodeParserRuleCall_2_0 = (RuleCall)cChildrenAssignment_2.eContents().get(0); + private final RuleCall cDEDENTTerminalRuleCall_3 = (RuleCall)cGroup.eContents().get(3); + + //ChildList: + // {ChildList} INDENT + // children+=OtherTreeNode+ + // DEDENT; + @Override public ParserRule getRule() { return rule; } + + //{ChildList} INDENT children+=OtherTreeNode+ DEDENT + public Group getGroup() { return cGroup; } + + //{ChildList} + public Action getChildListAction_0() { return cChildListAction_0; } + + //INDENT + public RuleCall getINDENTTerminalRuleCall_1() { return cINDENTTerminalRuleCall_1; } + + //children+=OtherTreeNode+ + public Assignment getChildrenAssignment_2() { return cChildrenAssignment_2; } + + //OtherTreeNode + public RuleCall getChildrenOtherTreeNodeParserRuleCall_2_0() { return cChildrenOtherTreeNodeParserRuleCall_2_0; } + + //DEDENT + public RuleCall getDEDENTTerminalRuleCall_3() { return cDEDENTTerminalRuleCall_3; } + } private final TreeElements pTree; private final TreeNodeElements pTreeNode; + private final OtherTreeNodeElements pOtherTreeNode; + private final ChildListElements pChildList; private final TerminalRule tSL_COMMENT; private final TerminalRule tINDENT; private final TerminalRule tDEDENT; @@ -104,6 +176,8 @@ public IndentationAwareTestLanguageGrammarAccess(GrammarProvider grammarProvider this.gaTerminals = gaTerminals; this.pTree = new TreeElements(); this.pTreeNode = new TreeNodeElements(); + this.pOtherTreeNode = new OtherTreeNodeElements(); + this.pChildList = new ChildListElements(); this.tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.SL_COMMENT"); this.tINDENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.INDENT"); this.tDEDENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.indentation.IndentationAwareTestLanguage.DEDENT"); @@ -137,7 +211,8 @@ public TerminalsGrammarAccess getTerminalsGrammarAccess() { //Tree: - // {Tree} nodes+=TreeNode*; + // {Tree} nodes+=TreeNode* + // moreNodes+=OtherTreeNode*; public TreeElements getTreeAccess() { return pTree; } @@ -158,6 +233,29 @@ public ParserRule getTreeNodeRule() { return getTreeNodeAccess().getRule(); } + //OtherTreeNode: + // name=STRING + // childList=ChildList?; + public OtherTreeNodeElements getOtherTreeNodeAccess() { + return pOtherTreeNode; + } + + public ParserRule getOtherTreeNodeRule() { + return getOtherTreeNodeAccess().getRule(); + } + + //ChildList: + // {ChildList} INDENT + // children+=OtherTreeNode+ + // DEDENT; + public ChildListElements getChildListAccess() { + return pChildList; + } + + public ParserRule getChildListRule() { + return getChildListAccess().getRule(); + } + //@ Override terminal SL_COMMENT: // '//' !('\n' | '\r')*; public TerminalRule getSL_COMMENTRule() { diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.xtend index 88ce41df0f..391c770ebd 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.xtend +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.xtend @@ -10,6 +10,7 @@ package org.eclipse.xtext.parser.indentation import com.google.inject.Inject import org.eclipse.xtend2.lib.StringConcatenation import org.eclipse.xtext.nodemodel.impl.InvariantChecker +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider @@ -66,6 +67,71 @@ class IndentationAwareLanguageTest { assertEquals('second', tree.nodes.last.name) } + @Test + def void testIgnoreEmptyLines_1() { + val tree = ''' + first + + second + '''.parse + assertNotNull(tree) + assertEquals(2, tree.nodes.size) + assertEquals('first', tree.nodes.head.name) + assertEquals(0, tree.nodes.head.children.size) + assertEquals('second', tree.nodes.last.name) + } + + @Test + def void testIgnoreEmptyLines_2() { + val tree = ''' + "first" + + "second" + '''.parse + assertNotNull(tree) + assertEquals(2, tree.moreNodes.size) + assertEquals('first', tree.moreNodes.head.name) + assertNull(tree.moreNodes.head.childList) + assertEquals('second', tree.moreNodes.last.name) + } + + @Test + def void testIgnoreEmptyLines_3() { + val tree = 'first\n\t'.parse + assertNotNull(tree) + assertEquals(1, tree.nodes.size) + assertEquals('first', tree.nodes.head.name) + assertEquals(0, tree.nodes.head.children.size) + } + + @Test + def void testIgnoreEmptyLines_4() { + val tree = '"first"\n\t'.parse + assertNotNull(tree) + assertEquals(1, tree.moreNodes.size) + assertEquals('first', tree.moreNodes.head.name) + assertNull(tree.moreNodes.head.childList) + } + + @Test + def void testIgnoreEmptyLines_5() { + val tree = 'first\n\t\tabc\n\t'.parse + assertNotNull(tree) + assertEquals(1, tree.nodes.size) + assertEquals('first', tree.nodes.head.name) + assertEquals(1, tree.nodes.head.children.size) + } + + @Test + def void testIgnoreEmptyLines_6() { + val tree = '"first"\n\t\t"abc"\n\t'.parse + assertNotNull(tree) + assertEquals(1, tree.moreNodes.size) + assertEquals('first', tree.moreNodes.head.name) + assertNotNull(tree.moreNodes.head.childList) + assertEquals(1, tree.moreNodes.head.childList.children.size) + } + @Test def void testParentChild() { val tree = ''' @@ -214,6 +280,52 @@ class IndentationAwareLanguageTest { '''.toString.assertEquals(tree.asText) } + @Test + def void testTree_06() { + val tree = ''' + "a" + "b" + '''.parseAndValidate + ''' + a + b + '''.toString.assertEquals(tree.asText) + } + + @Test + def void testTree_07() { + val tree = ''' + "a" + + "b" + + '''.parseAndValidate + ''' + a + b + '''.toString.assertEquals(tree.asText) + } + + @Test + def void testTree_08() { + val tree = ''' + "a" + "1" + "2" + "b" + "3" + '''.parseAndValidate + ''' + a + > + 1 + 2 + b + > + 3 + '''.toString.assertEquals(tree.asText) + } + private def parseAndValidate(CharSequence s) { val result = s.parse result.assertNoIssues @@ -227,6 +339,9 @@ class IndentationAwareLanguageTest { «FOR node: tree.nodes» «node.asText» «ENDFOR» + «FOR node: tree.moreNodes» + «node.asText» + «ENDFOR» ''' private def StringConcatenation asText(TreeNode treeNode) ''' @@ -236,4 +351,14 @@ class IndentationAwareLanguageTest { «ENDFOR» ''' + private def StringConcatenation asText(OtherTreeNode treeNode) ''' + «treeNode.name» + «IF treeNode.childList !== null» + > + «FOR node: treeNode.childList.children» + «node.asText» + «ENDFOR» + «ENDIF» + ''' + } \ No newline at end of file diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend similarity index 80% rename from org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.xtend rename to org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend index 282f9f730b..20adbc5153 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.xtend +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.xtend @@ -12,12 +12,17 @@ import org.eclipse.xtext.testing.smoketest.XtextSmokeTestRunner import org.eclipse.xtext.testing.smoketest.processors.PartialParsingProcessor import org.junit.runner.RunWith import org.junit.runners.Suite.SuiteClasses +import org.junit.runners.Suite /** * @author Sebastian Zarnekow - Initial contribution and API */ @RunWith(XtextSmokeTestRunner) @ProcessedBy(value = PartialParsingProcessor, processInParallel = true) -@SuiteClasses(IndentationAwareLanguageTest) -class IndentationAwarePartialParsingTest { +class IndentationAwarePartialParsingTests extends IndentationAwareLanguageSuite { +} + +@RunWith(Suite) +@SuiteClasses(IndentationAwareLanguageTest, NodeModelTest) +class IndentationAwareLanguageSuite { } \ No newline at end of file diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtext b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtext index 714639201a..5317082da7 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtext +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/IndentationAwareTestLanguage.xtext @@ -11,6 +11,7 @@ generate indentationAwareTestLanguage "http://www.eclipse.org/2015/tmf/xtext/ind Tree: {Tree} nodes+=TreeNode* + moreNodes+=OtherTreeNode* ; TreeNode: @@ -20,6 +21,17 @@ TreeNode: DEDENT)? ; +OtherTreeNode: + name=STRING + childList = ChildList? +; + +ChildList: {ChildList} + INDENT + children+=OtherTreeNode+ + DEDENT +; + @Override terminal SL_COMMENT: '//' !('\n'|'\r')*; diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/NodeModelTest.xtend b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/NodeModelTest.xtend new file mode 100644 index 0000000000..fe52f64aeb --- /dev/null +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parser/indentation/NodeModelTest.xtend @@ -0,0 +1,424 @@ +/******************************************************************************* + * Copyright (c) 2017 itemis AG (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.parser.indentation + +import com.google.inject.Inject +import org.eclipse.emf.ecore.EObject +import org.eclipse.xtext.AbstractRule +import org.eclipse.xtext.Action +import org.eclipse.xtext.Keyword +import org.eclipse.xtext.RuleCall +import org.eclipse.xtext.nodemodel.INode +import org.eclipse.xtext.nodemodel.impl.InvariantChecker +import org.eclipse.xtext.nodemodel.util.NodeModelUtils +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree +import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider +import org.eclipse.xtext.testing.InjectWith +import org.eclipse.xtext.testing.XtextRunner +import org.eclipse.xtext.testing.util.ParseHelper +import org.junit.Test +import org.junit.runner.RunWith + +import static extension org.junit.Assert.* + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner) +@InjectWith(IndentationAwareTestLanguageInjectorProvider) +class NodeModelTest { + + @Inject ParseHelper parseHelper + + @Inject + extension InvariantChecker invariantChecker + + @Test + def void testEmptyTree() { + val tree = ''.rootNode + ''.assertEquals(tree.asText) + } + + @Test + def void testSingleRootNode() { + val tree = 'root'.rootNode + ''' + [ID:root] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testTwoRootNodes() { + val tree = ''' + first + second + '''.rootNode + ''' + [ID:first][-WS: + ][ID:second][-WS: + ] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testParentChild() { + val tree = ''' + parent + child + '''.rootNode + ''' + [ID:parent][-WS: + \t][INDENT:][ID:child][-WS: + ][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testParentChildWithEof() { + val tree = ''' + parent + child + '''.toString.trim.rootNode + ''' + [ID:parent][-WS: + \t][INDENT:][ID:child][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testParentChildren() { + val tree = ''' + parent + child + child + '''.rootNode + ''' + [ID:parent][-WS: + \t][INDENT:][ID:child][-WS: + \t][ID:child][-WS: + ][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testTree_01() { + val tree = ''' + a + b + c + d + '''.rootNode + ''' + [ID:a][-WS: + \t][INDENT:][ID:b][-WS: + \t ][INDENT:][ID:c][-WS: + ][DEDENT:][-WS:\t][ID:d][-WS: + ][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testWeirdTree() { + val tree = ''' + root + s4 + s8 + s6 + '''.rootNode + ''' + [ID:root][-WS: + ][INDENT:][ID:s4][-WS: + ][INDENT:][ID:s8][-WS: + ][DEDENT:][-WS: ][INDENT:][ID:s6][-WS: + ][DEDENT:][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testWeirdTreeEof() { + val tree = ''' + root + s4 + s8 + s6 + '''.toString.trim.rootNode + ''' + [ID:root][-WS: + ][INDENT:][ID:s4][-WS: + ][INDENT:][ID:s8][-WS: + ][DEDENT:][-WS: ][INDENT:][ID:s6][DEDENT:][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_1() { + val tree = ''' + first + + second + '''.rootNode + ''' + [ID:first][-WS: + \t + ][ID:second][-WS: + ] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_2() { + val tree = ''' + "first" + + "second" + '''.rootNode + ''' + [STRING:"first"][-WS: + \t + ][STRING:"second"][-WS: + ] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_3() { + val tree = 'first\n\t'.rootNode + ''' + [ID:first][-WS: + \t] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_4() { + // first + // abc + // + val tree = 'first\n\t\tabc\n\t'.rootNode + ''' + [ID:first][-WS: + \t\t][INDENT:][ID:abc][-WS: + ][DEDENT:][-WS:\t] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_5() { + // first + // abc + // + // + val tree = 'first\n\t\tabc\n\n'.rootNode + ''' + [ID:first][-WS: + \t\t][INDENT:][ID:abc][-WS: + ][DEDENT:][-WS: + ] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_6() { + // first + // abc + // + // + val tree = 'first\n\t\tabc\n\t\n'.rootNode + ''' + [ID:first][-WS: + \t\t][INDENT:][ID:abc][-WS: + ][DEDENT:][-WS:\t + ] + '''.toString.trim.assertEquals(tree.asText) + } + + @Test + def void testIgnoreEmptyLines_7() { + // a + // b + // + val tree = 'a\n\tb\n\t '.rootNode + ''' + [ID:a][-WS: + \t][INDENT:][ID:b][-WS: + \t ][DEDENT:] + '''.toString.trim.assertEquals(tree.asText) + } + +// @Test +// def void testTree_02() { +// val tree = ''' +// a +// b +// c +// d +// e +// f +// g +// h +// '''.parseAndValidate +// ''' +// a +// b +// c +// d +// e +// f +// g +// h +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_03() { +// val tree = ''' +// a +// b // single tab +// c // 8 spaces eq 1 tab +// d +// '''.parseAndValidate +// ''' +// a +// b +// c +// d +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_04() { +// val tree = ''' +// level0_1 +// level1_1 +// level1_2 +// level2_1 +// level2_2 +// level1_3 +// level2_3 +// level2_4 +// level3_1 +// level3_2 +// level2_5 +// level1_4 +// level2_6 +// level0_2 +// level1_5 +// level2_7 +// level3_8 +// level4_9 +// '''.parseAndValidate +// ''' +// level0_1 +// level1_1 +// level1_2 +// level2_1 +// level2_2 +// level1_3 +// level2_3 +// level2_4 +// level3_1 +// level3_2 +// level2_5 +// level1_4 +// level2_6 +// level0_2 +// level1_5 +// level2_7 +// level3_8 +// level4_9 +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_05() { +// val tree = ''' +// a +// x +// b // two tabs +// c // tab and 8 spaces (eq 2 tabs) +// y +// '''.parseAndValidate +// ''' +// a +// x +// b +// c +// y +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_06() { +// val tree = ''' +// "a" +// "b" +// '''.parseAndValidate +// ''' +// a +// b +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_07() { +// val tree = ''' +// "a" +// +// "b" +// +// '''.parseAndValidate +// ''' +// a +// > +// b +// > +// '''.toString.assertEquals(tree.asText) +// } +// +// @Test +// def void testTree_08() { +// val tree = ''' +// "a" +// "1" +// "2" +// "b" +// "3" +// '''.parseAndValidate +// ''' +// a +// > +// 1 +// 2 +// b +// > +// 3 +// '''.toString.assertEquals(tree.asText) +// } + + private def getRootNode(CharSequence seq) { + val model = parseHelper.parse(seq); + val result = NodeModelUtils.getNode(model).rootNode + result.checkInvariant + return result + } + + private def String asText(INode node) { + node.leafNodes.filter[!(grammarElement instanceof Action)].join('[', '][', ']') [ + (if (isHidden) '-' else '') + grammarElement.tokenType + ':' + text.replace('\t', '\\t') + ] + } + + private def String tokenType(EObject obj) { + switch(obj) { + RuleCall: obj.rule.name + Keyword: obj.value + AbstractRule: obj.name + } + } + +} \ No newline at end of file diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java new file mode 100644 index 0000000000..9cc68973ec --- /dev/null +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageSuite.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2015 itemis AG (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.parser.indentation; + +import org.eclipse.xtext.parser.indentation.IndentationAwareLanguageTest; +import org.eclipse.xtext.parser.indentation.NodeModelTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ IndentationAwareLanguageTest.class, NodeModelTest.class }) +@SuppressWarnings("all") +public class IndentationAwareLanguageSuite { +} diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java index e9f814eda3..430fbdf1bc 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwareLanguageTest.java @@ -13,6 +13,8 @@ import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.impl.InvariantChecker; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode; import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider; @@ -88,6 +90,101 @@ public void testTwoRootNodes() { } } + @Test + public void testIgnoreEmptyLines_1() { + try { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("first"); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("second"); + _builder.newLine(); + final Tree tree = this.parseHelper.parse(_builder); + Assert.assertNotNull(tree); + Assert.assertEquals(2, tree.getNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getNodes()).getName()); + Assert.assertEquals(0, IterableExtensions.head(tree.getNodes()).getChildren().size()); + Assert.assertEquals("second", IterableExtensions.last(tree.getNodes()).getName()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + @Test + public void testIgnoreEmptyLines_2() { + try { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("\"first\""); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\"second\""); + _builder.newLine(); + final Tree tree = this.parseHelper.parse(_builder); + Assert.assertNotNull(tree); + Assert.assertEquals(2, tree.getMoreNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getMoreNodes()).getName()); + Assert.assertNull(IterableExtensions.head(tree.getMoreNodes()).getChildList()); + Assert.assertEquals("second", IterableExtensions.last(tree.getMoreNodes()).getName()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + @Test + public void testIgnoreEmptyLines_3() { + try { + final Tree tree = this.parseHelper.parse("first\n\t"); + Assert.assertNotNull(tree); + Assert.assertEquals(1, tree.getNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getNodes()).getName()); + Assert.assertEquals(0, IterableExtensions.head(tree.getNodes()).getChildren().size()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + @Test + public void testIgnoreEmptyLines_4() { + try { + final Tree tree = this.parseHelper.parse("\"first\"\n\t"); + Assert.assertNotNull(tree); + Assert.assertEquals(1, tree.getMoreNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getMoreNodes()).getName()); + Assert.assertNull(IterableExtensions.head(tree.getMoreNodes()).getChildList()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + @Test + public void testIgnoreEmptyLines_5() { + try { + final Tree tree = this.parseHelper.parse("first\n\t\tabc\n\t"); + Assert.assertNotNull(tree); + Assert.assertEquals(1, tree.getNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getNodes()).getName()); + Assert.assertEquals(1, IterableExtensions.head(tree.getNodes()).getChildren().size()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + @Test + public void testIgnoreEmptyLines_6() { + try { + final Tree tree = this.parseHelper.parse("\"first\"\n\t\t\"abc\"\n\t"); + Assert.assertNotNull(tree); + Assert.assertEquals(1, tree.getMoreNodes().size()); + Assert.assertEquals("first", IterableExtensions.head(tree.getMoreNodes()).getName()); + Assert.assertNotNull(IterableExtensions.head(tree.getMoreNodes()).getChildList()); + Assert.assertEquals(1, IterableExtensions.head(tree.getMoreNodes()).getChildList().getChildren().size()); + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + @Test public void testParentChild() { try { @@ -400,6 +497,82 @@ public void testTree_05() { Assert.assertEquals(_builder_1.toString(), this.asText(tree)); } + @Test + public void testTree_06() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("\"a\""); + _builder.newLine(); + _builder.append("\"b\""); + _builder.newLine(); + final Tree tree = this.parseAndValidate(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("a"); + _builder_1.newLine(); + _builder_1.append("b"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); + } + + @Test + public void testTree_07() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("\"a\""); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\"b\""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.newLine(); + final Tree tree = this.parseAndValidate(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("a"); + _builder_1.newLine(); + _builder_1.append("b"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); + } + + @Test + public void testTree_08() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("\"a\""); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\"1\""); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\"2\""); + _builder.newLine(); + _builder.append("\"b\""); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("\"3\""); + _builder.newLine(); + final Tree tree = this.parseAndValidate(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("a"); + _builder_1.newLine(); + _builder_1.append("\t"); + _builder_1.append(">"); + _builder_1.newLine(); + _builder_1.append("\t\t"); + _builder_1.append("1"); + _builder_1.newLine(); + _builder_1.append("\t\t"); + _builder_1.append("2"); + _builder_1.newLine(); + _builder_1.append("b"); + _builder_1.newLine(); + _builder_1.append("\t"); + _builder_1.append(">"); + _builder_1.newLine(); + _builder_1.append("\t\t"); + _builder_1.append("3"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString(), this.asText(tree)); + } + private Tree parseAndValidate(final CharSequence s) { try { final Tree result = this.parseHelper.parse(s); @@ -424,6 +597,14 @@ private String asText(final Tree tree) { _builder.newLineIfNotEmpty(); } } + { + EList _moreNodes = tree.getMoreNodes(); + for(final OtherTreeNode node_1 : _moreNodes) { + StringConcatenation _asText_1 = this.asText(node_1); + _builder.append(_asText_1); + _builder.newLineIfNotEmpty(); + } + } return _builder.toString(); } @@ -443,4 +624,31 @@ private StringConcatenation asText(final TreeNode treeNode) { } return _builder; } + + private StringConcatenation asText(final OtherTreeNode treeNode) { + StringConcatenation _builder = new StringConcatenation(); + String _name = treeNode.getName(); + _builder.append(_name); + _builder.newLineIfNotEmpty(); + { + ChildList _childList = treeNode.getChildList(); + boolean _tripleNotEquals = (_childList != null); + if (_tripleNotEquals) { + _builder.append("\t"); + _builder.append(">"); + _builder.newLine(); + { + EList _children = treeNode.getChildList().getChildren(); + for(final OtherTreeNode node : _children) { + _builder.append("\t"); + _builder.append("\t"); + StringConcatenation _asText = this.asText(node); + _builder.append(_asText, "\t\t"); + _builder.newLineIfNotEmpty(); + } + } + } + } + return _builder; + } } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java similarity index 85% rename from org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.java rename to org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java index e96da7d426..0cba9828c1 100644 --- a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTest.java +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/IndentationAwarePartialParsingTests.java @@ -7,19 +7,17 @@ */ package org.eclipse.xtext.parser.indentation; -import org.eclipse.xtext.parser.indentation.IndentationAwareLanguageTest; +import org.eclipse.xtext.parser.indentation.IndentationAwareLanguageSuite; import org.eclipse.xtext.testing.smoketest.ProcessedBy; import org.eclipse.xtext.testing.smoketest.XtextSmokeTestRunner; import org.eclipse.xtext.testing.smoketest.processors.PartialParsingProcessor; import org.junit.runner.RunWith; -import org.junit.runners.Suite; /** * @author Sebastian Zarnekow - Initial contribution and API */ @RunWith(XtextSmokeTestRunner.class) @ProcessedBy(value = PartialParsingProcessor.class, processInParallel = true) -@Suite.SuiteClasses(IndentationAwareLanguageTest.class) @SuppressWarnings("all") -public class IndentationAwarePartialParsingTest { +public class IndentationAwarePartialParsingTests extends IndentationAwareLanguageSuite { } diff --git a/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/NodeModelTest.java b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/NodeModelTest.java new file mode 100644 index 0000000000..5d32dbdfef --- /dev/null +++ b/org.eclipse.xtext.tests/xtend-gen/org/eclipse/xtext/parser/indentation/NodeModelTest.java @@ -0,0 +1,396 @@ +/** + * Copyright (c) 2017 itemis AG (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.parser.indentation; + +import com.google.inject.Inject; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Keyword; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.nodemodel.ICompositeNode; +import org.eclipse.xtext.nodemodel.ILeafNode; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.nodemodel.impl.InvariantChecker; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree; +import org.eclipse.xtext.parser.indentation.tests.IndentationAwareTestLanguageInjectorProvider; +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.eclipse.xtext.testing.util.ParseHelper; +import org.eclipse.xtext.xbase.lib.Exceptions; +import org.eclipse.xtext.xbase.lib.Extension; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +@RunWith(XtextRunner.class) +@InjectWith(IndentationAwareTestLanguageInjectorProvider.class) +@SuppressWarnings("all") +public class NodeModelTest { + @Inject + private ParseHelper parseHelper; + + @Inject + @Extension + private InvariantChecker invariantChecker; + + @Test + public void testEmptyTree() { + final ICompositeNode tree = this.getRootNode(""); + Assert.assertEquals("", this.asText(tree)); + } + + @Test + public void testSingleRootNode() { + final ICompositeNode tree = this.getRootNode("root"); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:root]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + @Test + public void testTwoRootNodes() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("first"); + _builder.newLine(); + _builder.append("second"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:first][-WS:"); + _builder_1.newLine(); + _builder_1.append("][ID:second][-WS:"); + _builder_1.newLine(); + _builder_1.append("]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testParentChild() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t][INDENT:][ID:child][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testParentChildWithEof() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder.toString().trim()); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t][INDENT:][ID:child][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testParentChildren() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("parent"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("child"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:parent][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t][INDENT:][ID:child][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t][ID:child][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testTree_01() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("a"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("b"); + _builder.newLine(); + _builder.append("\t "); + _builder.append("c"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("d"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:a][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t][INDENT:][ID:b][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t ][INDENT:][ID:c][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:][-WS:\\t][ID:d][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testWeirdTree() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("root"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s4"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s8"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s6"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:root][-WS:"); + _builder_1.newLine(); + _builder_1.append(" "); + _builder_1.append("][INDENT:][ID:s4][-WS:"); + _builder_1.newLine(); + _builder_1.append(" "); + _builder_1.append("][INDENT:][ID:s8][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:][-WS: ][INDENT:][ID:s6][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testWeirdTreeEof() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("root"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s4"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s8"); + _builder.newLine(); + _builder.append(" "); + _builder.append("s6"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder.toString().trim()); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:root][-WS:"); + _builder_1.newLine(); + _builder_1.append(" "); + _builder_1.append("][INDENT:][ID:s4][-WS:"); + _builder_1.newLine(); + _builder_1.append(" "); + _builder_1.append("][INDENT:][ID:s8][-WS:"); + _builder_1.newLine(); + _builder_1.append("][DEDENT:][-WS: ][INDENT:][ID:s6][DEDENT:][DEDENT:]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_1() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("first"); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("second"); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[ID:first][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t"); + _builder_1.newLine(); + _builder_1.append("][ID:second][-WS:"); + _builder_1.newLine(); + _builder_1.append("]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_2() { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("\"first\""); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\"second\""); + _builder.newLine(); + final ICompositeNode tree = this.getRootNode(_builder); + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("[STRING:\"first\"][-WS:"); + _builder_1.newLine(); + _builder_1.append("\\t"); + _builder_1.newLine(); + _builder_1.append("][STRING:\"second\"][-WS:"); + _builder_1.newLine(); + _builder_1.append("]"); + _builder_1.newLine(); + Assert.assertEquals(_builder_1.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_3() { + final ICompositeNode tree = this.getRootNode("first\n\t"); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:first][-WS:"); + _builder.newLine(); + _builder.append("\\t]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_4() { + final ICompositeNode tree = this.getRootNode("first\n\t\tabc\n\t"); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:first][-WS:"); + _builder.newLine(); + _builder.append("\\t\\t][INDENT:][ID:abc][-WS:"); + _builder.newLine(); + _builder.append("][DEDENT:][-WS:\\t]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_5() { + final ICompositeNode tree = this.getRootNode("first\n\t\tabc\n\n"); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:first][-WS:"); + _builder.newLine(); + _builder.append("\\t\\t][INDENT:][ID:abc][-WS:"); + _builder.newLine(); + _builder.append("][DEDENT:][-WS:"); + _builder.newLine(); + _builder.append("]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_6() { + final ICompositeNode tree = this.getRootNode("first\n\t\tabc\n\t\n"); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:first][-WS:"); + _builder.newLine(); + _builder.append("\\t\\t][INDENT:][ID:abc][-WS:"); + _builder.newLine(); + _builder.append("][DEDENT:][-WS:\\t"); + _builder.newLine(); + _builder.append("]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + @Test + public void testIgnoreEmptyLines_7() { + final ICompositeNode tree = this.getRootNode("a\n\tb\n\t "); + StringConcatenation _builder = new StringConcatenation(); + _builder.append("[ID:a][-WS:"); + _builder.newLine(); + _builder.append("\\t][INDENT:][ID:b][-WS:"); + _builder.newLine(); + _builder.append("\\t ][DEDENT:]"); + _builder.newLine(); + Assert.assertEquals(_builder.toString().trim(), this.asText(tree)); + } + + private ICompositeNode getRootNode(final CharSequence seq) { + try { + final Tree model = this.parseHelper.parse(seq); + final ICompositeNode result = NodeModelUtils.getNode(model).getRootNode(); + this.invariantChecker.checkInvariant(result); + return result; + } catch (Throwable _e) { + throw Exceptions.sneakyThrow(_e); + } + } + + private String asText(final INode node) { + final Function1 _function = (ILeafNode it) -> { + EObject _grammarElement = it.getGrammarElement(); + return Boolean.valueOf((!(_grammarElement instanceof Action))); + }; + final Function1 _function_1 = (ILeafNode it) -> { + String _xifexpression = null; + boolean _isHidden = it.isHidden(); + if (_isHidden) { + _xifexpression = "-"; + } else { + _xifexpression = ""; + } + String _kenType = this.tokenType(it.getGrammarElement()); + String _plus = (_xifexpression + _kenType); + String _plus_1 = (_plus + ":"); + String _replace = it.getText().replace("\t", "\\t"); + return (_plus_1 + _replace); + }; + return IterableExtensions.join(IterableExtensions.filter(node.getLeafNodes(), _function), "[", "][", "]", _function_1); + } + + private String tokenType(final EObject obj) { + String _switchResult = null; + boolean _matched = false; + if (obj instanceof RuleCall) { + _matched=true; + _switchResult = ((RuleCall)obj).getRule().getName(); + } + if (!_matched) { + if (obj instanceof Keyword) { + _matched=true; + _switchResult = ((Keyword)obj).getValue(); + } + } + if (!_matched) { + if (obj instanceof AbstractRule) { + _matched=true; + _switchResult = ((AbstractRule)obj).getName(); + } + } + return _switchResult; + } +} diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.xtend b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.xtend index 3574fc3a79..ecf4f99b63 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.xtend +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.xtend @@ -87,7 +87,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { if (combinedGrammar.isSet) combinedGrammar.get else - !options.backtrackLexer && !options.ignoreCase && !grammar.allTerminalRules.exists[isSyntheticTerminalRule] + !options.backtrackLexer && !options.ignoreCase && !hasSyntheticTerminalRule } override protected doGenerate() { @@ -104,7 +104,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { generateProductionParser().writeTo(projectConfig.runtime.srcGen) generateAntlrTokenFileProvider().writeTo(projectConfig.runtime.srcGen) generateContentAssistParser().writeTo(projectConfig.genericIde.srcGen) - if (grammar.allTerminalRules.exists[ isSyntheticTerminalRule ]) { + if (hasSyntheticTerminalRule()) { generateProductionTokenSource().writeTo(projectConfig.runtime.src) generateContentAssistTokenSource().writeTo(projectConfig.genericIde.src) } @@ -113,6 +113,10 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { addUiBindingsAndImports() } + protected def boolean hasSyntheticTerminalRule() { + grammar.allTerminalRules.exists[ isSyntheticTerminalRule ] + } + def void setLookaheadThreshold(String lookaheadThreshold) { this.lookaheadThreshold = Integer.parseInt(lookaheadThreshold) } @@ -195,7 +199,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { tokenStream.setInitialHiddenTokens(«FOR hidden : grammar.initialHiddenTokens SEPARATOR ", "»"«hidden»"«ENDFOR»); } - «IF grammar.allTerminalRules.exists[isSyntheticTerminalRule]» + «IF hasSyntheticTerminalRule» @Override protected «TokenSource» createLexer(«CharStream» stream) { return new «grammar.tokenSourceClass»(super.createLexer(stream)); @@ -319,7 +323,7 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { return result; } - «IF grammar.allTerminalRules.exists[isSyntheticTerminalRule]» + «IF hasSyntheticTerminalRule» @Override protected «TokenSource» createLexer(«CharStream» stream) { return new «grammar.tokenSourceClass»(super.createLexer(stream)); @@ -503,6 +507,12 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { "org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory".typeRef ) } + if (hasSyntheticTerminalRule) { + ideBindings.addTypeToType( + "org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider".typeRef, + "org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider".typeRef + ) + } ideBindings.contributeTo(language.ideGenModule) } @@ -553,6 +563,13 @@ class XtextAntlrGeneratorFragment2 extends AbstractAntlrGeneratorFragment2 { .addConfiguredBinding("ContentAssistLexerProvider", ''' binder.bind(«caLexerClass».class).toProvider(«LexerProvider».create(«caLexerClass».class)); ''') + + if (hasSyntheticTerminalRule) { + uiBindings.addTypeToType( + "org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider".typeRef, + "org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider".typeRef + ) + } uiBindings.contributeTo(language.eclipsePluginGenModule) } diff --git a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java index 3b37281462..5754519862 100644 --- a/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java +++ b/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/parser/antlr/XtextAntlrGeneratorFragment2.java @@ -133,9 +133,7 @@ protected boolean isCombinedGrammar() { if (_isSet) { _xifexpression = this.combinedGrammar.get(); } else { - _xifexpression = (((!this.getOptions().isBacktrackLexer()) && (!this.getOptions().isIgnoreCase())) && (!IterableExtensions.exists(GrammarUtil.allTerminalRules(this.getGrammar()), ((Function1) (TerminalRule it) -> { - return Boolean.valueOf(this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); - })))); + _xifexpression = (((!this.getOptions().isBacktrackLexer()) && (!this.getOptions().isIgnoreCase())) && (!this.hasSyntheticTerminalRule())); } return _xifexpression; } @@ -160,11 +158,8 @@ protected void doGenerate() { this.generateProductionParser().writeTo(this.getProjectConfig().getRuntime().getSrcGen()); this.generateAntlrTokenFileProvider().writeTo(this.getProjectConfig().getRuntime().getSrcGen()); this.generateContentAssistParser().writeTo(this.getProjectConfig().getGenericIde().getSrcGen()); - final Function1 _function = (TerminalRule it) -> { - return Boolean.valueOf(this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); - }; - boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(this.getGrammar()), _function); - if (_exists) { + boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule(); + if (_hasSyntheticTerminalRule) { this.generateProductionTokenSource().writeTo(this.getProjectConfig().getRuntime().getSrc()); this.generateContentAssistTokenSource().writeTo(this.getProjectConfig().getGenericIde().getSrc()); } @@ -173,6 +168,13 @@ protected void doGenerate() { this.addUiBindingsAndImports(); } + protected boolean hasSyntheticTerminalRule() { + final Function1 _function = (TerminalRule it) -> { + return Boolean.valueOf(this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); + }; + return IterableExtensions.exists(GrammarUtil.allTerminalRules(this.getGrammar()), _function); + } + public void setLookaheadThreshold(final String lookaheadThreshold) { this.lookaheadThreshold = Integer.parseInt(lookaheadThreshold); } @@ -315,11 +317,8 @@ protected void appendTo(StringConcatenationClient.TargetStringConcatenation _bui _builder.append("\t"); _builder.newLine(); { - final Function1 _function = (TerminalRule it) -> { - return Boolean.valueOf(XtextAntlrGeneratorFragment2.this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); - }; - boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function); - if (_exists) { + boolean _hasSyntheticTerminalRule = XtextAntlrGeneratorFragment2.this.hasSyntheticTerminalRule(); + if (_hasSyntheticTerminalRule) { _builder.append("\t"); _builder.append("@Override"); _builder.newLine(); @@ -726,11 +725,8 @@ protected void appendTo(StringConcatenationClient.TargetStringConcatenation _bui _builder.newLine(); _builder.newLine(); { - final Function1 _function = (TerminalRule it) -> { - return Boolean.valueOf(XtextAntlrGeneratorFragment2.this._syntheticTerminalDetector.isSyntheticTerminalRule(it)); - }; - boolean _exists = IterableExtensions.exists(GrammarUtil.allTerminalRules(XtextAntlrGeneratorFragment2.this.getGrammar()), _function); - if (_exists) { + boolean _hasSyntheticTerminalRule = XtextAntlrGeneratorFragment2.this.hasSyntheticTerminalRule(); + if (_hasSyntheticTerminalRule) { _builder.append("\t"); _builder.append("@Override"); _builder.newLine(); @@ -1245,6 +1241,12 @@ protected void appendTo(StringConcatenationClient.TargetStringConcatenation _bui TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory"), TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory")); } + boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule(); + if (_hasSyntheticTerminalRule) { + ideBindings.addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider"), + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider")); + } ideBindings.contributeTo(this.getLanguage().getIdeGenModule()); } @@ -1358,6 +1360,12 @@ protected void appendTo(StringConcatenationClient.TargetStringConcatenation _bui } }; final GuiceModuleAccess.BindingFactory uiBindings = _addTypeToType_1.addConfiguredBinding("ContentAssistLexerProvider", _client_3); + boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule(); + if (_hasSyntheticTerminalRule) { + uiBindings.addTypeToType( + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider"), + TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider")); + } uiBindings.contributeTo(this.getLanguage().getEclipsePluginGenModule()); } diff --git a/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java b/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java index 8b7175c7cc..7797a1890e 100644 --- a/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java +++ b/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java @@ -16,6 +16,11 @@ import org.eclipse.xtext.parser.antlr.ITokenAcceptor; /** + * Abstract implementation of a token source, that splits according to indentation levels + * after newlines. + * Blank lines are ignored. At the end of file token, all pending indentations will be handled + * and dedentation tokens will be issued accordingly if {@link #shouldEmitPendingEndTokens()} returns true. + * * @author Sebastian Zarnekow - Initial contribution and API * @since 2.8 */ @@ -27,6 +32,7 @@ protected AbstractIndentationTokenSource(TokenSource delegate) { protected Stack indentationStack = new Stack(); + // make sure we never face an empty indentation stack. { indentationStack.push(0); } @@ -47,19 +53,26 @@ protected boolean shouldSplitToken(Token token) { */ protected abstract boolean shouldSplitTokenImpl(Token token); + /** + * @since 2.13 + */ + protected void doSplitEofToken(Token token, ITokenAcceptor result) { + if (shouldEmitPendingEndTokens()) { + while(indentationStack.size() > 1) { + indentationStack.pop(); + result.accept(createEndToken(nextOffset)); + } + } + result.accept(token); + } + @Override protected void doSplitToken(Token token, ITokenAcceptor result) { if (token.getType() == Token.EOF) { - if (shouldEmitPendingEndTokens()) { - while(indentationStack.size() > 1) { - indentationStack.pop(); - result.accept(createEndToken(nextOffset)); - } - } - result.accept(token); - return; + doSplitEofToken(token, result); + } else { + doSplitTokenImpl(token, result); } - doSplitTokenImpl(token, result); } protected boolean shouldEmitPendingEndTokens() { @@ -78,36 +91,80 @@ public Token nextToken() { } /** - * The token was previously determined as potentially to-be-splitted. + * The token was previously determined as potentially to-be-splitted thus we + * emit additional indentation or dedenting tokens. */ protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { + // no change of indentation level detected simply process the token result.accept(token); } else if (indentation > currentIndentation) { + // indentation level increased splitIntoBeginToken(token, indentation, result); } else if (indentation < currentIndentation) { - while(indentation < currentIndentation) { - indentationStack.pop(); - currentIndentation = indentationStack.peek(); - result.accept(createEndToken(nextOffset)); + // indentation level decreased + int charCount = computeIndentationRelevantCharCount(text); + if (charCount > 0) { + // emit whitespace including newline + splitWithText(token, text.substring(0, charCount), result); } - if (indentation > currentIndentation) { - splitIntoBeginToken(token, indentation, result); - return; + // emit end tokens at the beginning of the line + decreaseIndentation(indentation, result); + if (charCount != text.length()) { + handleRemainingText(token, text.substring(charCount), indentation, result); } - result.accept(token); } else { throw new IllegalStateException(String.valueOf(indentation)); } } + /** + * @since 2.13 + */ + protected void handleRemainingText(Token token, String text, int indentation, ITokenAcceptor result) { + CommonToken trailingToken = createToken((CommonToken) token, text, null, null, nextOffset, null, null); + if (indentation > currentIndentation) { + splitIntoBeginToken(trailingToken, indentation, result); + } else { + // emit pending whitespace + result.accept(trailingToken); + } + } + + protected void decreaseIndentation(int indentation, ITokenAcceptor result) { + while(indentation < currentIndentation) { + indentationStack.pop(); + currentIndentation = indentationStack.peek(); + result.accept(createEndToken(nextOffset)); + } + } + + protected void splitWithText(Token token, String text, ITokenAcceptor result) { + CommonToken leadingToken = createToken((CommonToken) token, text, null, null, nextOffset, nextOffset + text.length() - 1, null); + result.accept(leadingToken); + nextOffset += text.length(); + } + private void splitIntoBeginToken(Token token, int indentation, ITokenAcceptor result) { result.accept(token); - indentationStack.push(indentation); - currentIndentation = indentation; - result.accept(createBeginToken(((CommonToken) token).getStopIndex() + 1)); + if (shouldEmitPendingEndTokens()) { + Token nextToken = getDelegate().nextToken(); + if (shouldSplitToken(nextToken)) { + nextOffset = ((CommonToken) token).getStopIndex() + 1; + doSplitToken(nextToken, result); + } else { + indentationStack.push(indentation); + currentIndentation = indentation; + result.accept(createBeginToken(((CommonToken) token).getStopIndex() + 1)); + result.accept(nextToken); + } + } else { + indentationStack.push(indentation); + currentIndentation = indentation; + result.accept(createBeginToken(((CommonToken) token).getStopIndex() + 1)); + } } protected Token createEndToken(int offset) { @@ -130,7 +187,26 @@ protected Token createBeginToken(int offset) { result.setStopIndex(offset-1); return result; } - + + protected int computeIndentationRelevantCharCount(String text) { + int result = 0; + while(result < text.length()) { + char c = text.charAt(result); + if (c == '\n') { + result++; + if (result < text.length()) { + c = text.charAt(result); + if (c == '\r') { + result++; + } + } + return result; + } + result++; + } + return -1; + } + protected int computeIndentation(String text) { int result = 0; for(int i = text.length() - 1; i>=0; i--) {