| author | szarnekow | 2009-03-05 06:03:49 (EST) |
|---|---|---|
| committer | sefftinge | 2009-03-05 06:03:49 (EST) |
| commit | 0724b0d238671701272fc4244e74346cacfa7179 (patch) (side-by-side diff) | |
| tree | b5e2479d57b5b25207e18d89ea13a187a68c5ce1 | |
| parent | 9560896ac244c89693221a178daa90c6d0f2999c (diff) | |
| download | org.eclipse.xtext-0724b0d238671701272fc4244e74346cacfa7179.zip org.eclipse.xtext-0724b0d238671701272fc4244e74346cacfa7179.tar.gz org.eclipse.xtext-0724b0d238671701272fc4244e74346cacfa7179.tar.bz2 | |
Tests to document the current structure of the parseTree, when actions have been executed
34 files changed, 981 insertions, 1650 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/actions/ParserTest.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/actions/ParserTest.java new file mode 100644 index 0000000..7de7928 --- a/dev/null +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/actions/ParserTest.java @@ -0,0 +1,150 @@ +/******************************************************************************* + * Copyright (c) 2009 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.actions; + +import org.eclipse.xtext.junit.AbstractXtextTests; +import org.eclipse.xtext.parser.IParser; +import org.eclipse.xtext.parser.ParserTestHelper; +import org.eclipse.xtext.parsetree.AbstractNode; +import org.eclipse.xtext.parsetree.CompositeNode; +import org.eclipse.xtext.parsetree.LeafNode; +import org.eclipse.xtext.parsetree.NodeAdapter; +import org.eclipse.xtext.parsetree.NodeUtil; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.testlanguages.ActionTestLanguageStandaloneSetup; +import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage; +import org.eclipse.xtext.testlanguages.actionLang.Model; +import org.eclipse.xtext.testlanguages.actionLang.Parent; +import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +public abstract class ParserTest extends AbstractXtextTests { + + private ActionTestLanguageGrammarAccess grammarAccess; + private ParserTestHelper helper; + + @Override + protected void setUp() throws Exception { + super.setUp(); + with(ActionTestLanguageStandaloneSetup.class); + grammarAccess = get(ActionTestLanguageGrammarAccess.class); + helper = new ParserTestHelper(getResourceFactory(), getParser(), get(Keys.RESOURCE_SET_KEY)); + } + + @Override + protected void tearDown() throws Exception { + grammarAccess = null; + super.tearDown(); + } + + public static class Antlr extends ParserTest { + @Override + protected IParser getParser() { + return getAntlrParser(); + } + } + + public static class Packrat extends ParserTest { + @Override + protected IParser getParser() { + return getPackratParser(); + } + } + + /** + * Model: '<code>myID</code>' + * The following parse tree is expected: + * <pre> + * CompositeNode (GrammarElement: Rule[Model], Element: null) + * | + * CompositeNode (GrammarElement: RuleCall[Child], Element: Child[myID]) + * | + * LeafNode (GrammarElement: RuleCall[ID], Element: null) + * </pre> + */ + public void testParseWithoutActionCall() throws Exception { + XtextResource resource = helper.getResourceFromString("myID"); + assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty()); + Model model = (Model) resource.getContents().get(0); + assertNotNull("model", model); + assertEquals(model.eClass().getName(), ActionLangPackage.Literals.CHILD, model.eClass()); + NodeAdapter adapter = NodeUtil.getNodeAdapter(model); + assertNotNull("adapter", adapter); + CompositeNode node = adapter.getParserNode(); + assertNotNull("node", node); + assertEquals("node.grammarElement", grammarAccess.prModel().ele0ParserRuleCallChild(), node.getGrammarElement()); + assertEquals(node.getChildren().toString(), 1, node.getChildren().size()); + AbstractNode childNode = node.getChildren().get(0); + assertTrue(childNode.toString(), childNode instanceof LeafNode); + assertEquals("childNode.grammarElement", grammarAccess.prChild().ele0TerminalRuleCallID(), childNode.getGrammarElement()); + assertNull("childNode.element", childNode.getElement()); + + CompositeNode rootNode = resource.getParseResult().getRootNode(); + assertNotNull("rootNode", rootNode); + assertEquals("rootNode.grammarElement", grammarAccess.prModel().getRule(), rootNode.getGrammarElement()); + assertEquals(rootNode.getChildren().toString(), 1, rootNode.getChildren().size()); + assertEquals("node is child of rootNode", rootNode, node.getParent()); + assertNull("rootNode.element", rootNode.getElement()); + } + + /** + * Model: '<code>myID otherID</code>' + * The following parse tree is expected: + * <pre> + * CompositeNode (GrammarElement: Action, Element: Parent[left: Child[myID], right: Child[otherID]]) + * |________________________________________________________________________, + * CompositeNode (GrammarElement: Rule[Model], Element: null) CompositeNode (GrammarElement: RuleCall[Child], Element: Child[otherID]) + * | |________________, + * CompositeNode (GrammarElement: RuleCall[Child], Element: Child[myID]) LeafNode (WS) LeafNode (GrammarElement: RuleCall[ID], Element: null) + * | + * LeafNode (GrammarElement: RuleCall[ID], Element: null) + * </pre> + */ + public void testParseWithActionCall() throws Exception { + XtextResource resource = helper.getResourceFromString("myID otherID"); + assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty()); + Model model = (Model) resource.getContents().get(0); + assertNotNull("model", model); + assertEquals(model.eClass().getName(), ActionLangPackage.Literals.PARENT, model.eClass()); + NodeAdapter adapter = NodeUtil.getNodeAdapter(model); + assertNotNull("adapter", adapter); + CompositeNode node = adapter.getParserNode(); + assertNotNull("node", node); + assertEquals("node.grammarElement", grammarAccess.prModel().ele10ActionParentleft(), node.getGrammarElement()); + assertEquals(node.getChildren().toString(), 2, node.getChildren().size()); + CompositeNode firstChildNode = (CompositeNode) node.getChildren().get(0); + assertEquals("firstChildNode.grammarElement", grammarAccess.prModel().getRule(), firstChildNode.getGrammarElement()); + assertNull("firstChildNode.element", firstChildNode.getElement()); + assertEquals(firstChildNode.getChildren().toString(), 1, firstChildNode.getChildren().size()); + + AbstractNode childNode = firstChildNode.getChildren().get(0); + assertTrue(childNode.toString(), childNode instanceof CompositeNode); + assertEquals("childNode.grammarElement", grammarAccess.prModel().ele0ParserRuleCallChild(), childNode.getGrammarElement()); + assertEquals("childNode.element", ((Parent)model).getLeft(), childNode.getElement()); + assertEquals(((CompositeNode) childNode).getChildren().toString(), 1, ((CompositeNode) childNode).getChildren().size()); + assertEquals("childNode.children[0].grammarElement", grammarAccess.prChild().ele0TerminalRuleCallID(), + ((CompositeNode) childNode).getChildren().get(0).getGrammarElement()); + + CompositeNode secondChildNode = (CompositeNode) node.getChildren().get(1); + assertEquals("childNode.grammarElement", grammarAccess.prModel().ele110ParserRuleCallChild(), secondChildNode.getGrammarElement()); + assertEquals("childNode.element", ((Parent)model).getRight(), secondChildNode.getElement()); + + AbstractNode otherChildNode = secondChildNode.getChildren().get(1); + assertTrue(otherChildNode.toString(), otherChildNode instanceof LeafNode); + assertEquals("otherChildNode.grammarElement", grammarAccess.prChild().ele0TerminalRuleCallID(), otherChildNode.getGrammarElement()); + + CompositeNode rootNode = resource.getParseResult().getRootNode(); + assertNotNull("rootNode", rootNode); + assertEquals("rootNode.grammarElement", grammarAccess.prModel().ele10ActionParentleft(), rootNode.getGrammarElement()); + assertEquals(node, rootNode); + } + + +} diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.ecore index 105a133..606a30a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.ecore +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.ecore @@ -1,16 +1,13 @@ <?xml version="1.0" encoding="ASCII"?> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="actionLang" nsURI="http://www.eclipse.org/2008/tmf/xtext/ActionLang" nsPrefix="actionLang"> - <eClassifiers xsi:type="ecore:EClass" name="Model"> - <eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1" eType="//Type" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Type"/> - <eClassifiers xsi:type="ecore:EClass" name="Item" eSuperTypes="//Type"> - <eStructuralFeatures xsi:type="ecore:EReference" name="items" upperBound="-1" eType="//Type" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Thing" eSuperTypes="//Type"> - <eStructuralFeatures xsi:type="ecore:EReference" name="content" eType="//Type" containment="true"/> + <eClassifiers xsi:type="ecore:EClass" name="Model"/> + <eClassifiers xsi:type="ecore:EClass" name="Child" eSuperTypes="//Model"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Parent" eSuperTypes="//Model"> + <eStructuralFeatures xsi:type="ecore:EReference" name="left" eType="//Child" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="right" eType="//Child" containment="true"/> + </eClassifiers> </ecore:EPackage> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.genmodel b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.genmodel index 1bdf531..1d44167 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.genmodel +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.genmodel @@ -4,26 +4,20 @@ <ecorePackage href="ActionTestLanguage.ecore#/"/> <genClasses> <ecoreClass href="ActionTestLanguage.ecore#//Model"/> - <genFeatures property="None" children="true" createChild="true"> - <ecoreFeature xsi:type="ecore:EReference" href="ActionTestLanguage.ecore#//Model/children"/> - </genFeatures> - </genClasses> - <genClasses> - <ecoreClass href="ActionTestLanguage.ecore#//Type"/> </genClasses> <genClasses> - <ecoreClass href="ActionTestLanguage.ecore#//Item"/> - <genFeatures property="None" children="true" createChild="true"> - <ecoreFeature xsi:type="ecore:EReference" href="ActionTestLanguage.ecore#//Item/items"/> + <ecoreClass href="ActionTestLanguage.ecore#//Child"/> + <genFeatures createChild="false"> + <ecoreFeature xsi:type="ecore:EAttribute" href="ActionTestLanguage.ecore#//Child/name"/> </genFeatures> </genClasses> <genClasses> - <ecoreClass href="ActionTestLanguage.ecore#//Thing"/> + <ecoreClass href="ActionTestLanguage.ecore#//Parent"/> <genFeatures property="None" children="true" createChild="true"> - <ecoreFeature xsi:type="ecore:EReference" href="ActionTestLanguage.ecore#//Thing/content"/> + <ecoreFeature xsi:type="ecore:EReference" href="ActionTestLanguage.ecore#//Parent/left"/> </genFeatures> - <genFeatures createChild="false"> - <ecoreFeature xsi:type="ecore:EAttribute" href="ActionTestLanguage.ecore#//Thing/name"/> + <genFeatures property="None" children="true" createChild="true"> + <ecoreFeature xsi:type="ecore:EReference" href="ActionTestLanguage.ecore#//Parent/right"/> </genFeatures> </genClasses> </genPackages> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.xmi b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.xmi index a4fa3d4..f170cff 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.xmi +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ActionTestLanguage.xmi @@ -8,41 +8,26 @@ <type metamodel="/0/@metamodelDeclarations.0"> <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Model"/> </type> - <alternatives xsi:type="xtext:Assignment" cardinality="*" feature="children" operator="+="> - <terminal xsi:type="xtext:RuleCall" rule="/0/@rules.1"/> - </alternatives> - </rules> - <rules xsi:type="xtext:ParserRule" name="Element"> - <type metamodel="/0/@metamodelDeclarations.0"> - <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Type"/> - </type> <alternatives xsi:type="xtext:Group"> - <tokens xsi:type="xtext:RuleCall" rule="/0/@rules.2"/> - <tokens xsi:type="xtext:Group"> - <tokens xsi:type="xtext:Action" feature="items" operator="+="> + <tokens xsi:type="xtext:RuleCall" rule="/0/@rules.1"/> + <tokens xsi:type="xtext:Group" cardinality="?"> + <tokens xsi:type="xtext:Action" feature="left" operator="="> <type metamodel="/0/@metamodelDeclarations.0"> - <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Item"/> + <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Parent"/> </type> </tokens> - <tokens xsi:type="xtext:Assignment" feature="items" operator="+="> - <terminal xsi:type="xtext:RuleCall" rule="/0/@rules.2"/> + <tokens xsi:type="xtext:Assignment" feature="right" operator="="> + <terminal xsi:type="xtext:RuleCall" rule="/0/@rules.1"/> </tokens> </tokens> </alternatives> </rules> - <rules xsi:type="xtext:ParserRule" name="Item"> + <rules xsi:type="xtext:ParserRule" name="Child"> <type metamodel="/0/@metamodelDeclarations.0"> - <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Type"/> + <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Child"/> </type> - <alternatives xsi:type="xtext:Group"> - <tokens xsi:type="xtext:Action" feature="content" operator="="> - <type metamodel="/0/@metamodelDeclarations.0"> - <classifier xsi:type="ecore:EClass" href="http://www.eclipse.org/2008/tmf/xtext/ActionLang#//Thing"/> - </type> - </tokens> - <tokens xsi:type="xtext:Assignment" feature="name" operator="="> - <terminal xsi:type="xtext:RuleCall" rule="/1/@rules.0"/> - </tokens> + <alternatives xsi:type="xtext:Assignment" feature="name" operator="="> + <terminal xsi:type="xtext:RuleCall" rule="/1/@rules.0"/> </alternatives> </rules> </xtext:Grammar> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangFactory.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangFactory.java index 65ceb52..39c71e1 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangFactory.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangFactory.java @@ -35,31 +35,22 @@ public interface ActionLangFactory extends EFactory Model createModel(); /** - * Returns a new object of class '<em>Type</em>'. + * Returns a new object of class '<em>Child</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return a new object of class '<em>Type</em>'. + * @return a new object of class '<em>Child</em>'. * @generated */ - Type createType(); + Child createChild(); /** - * Returns a new object of class '<em>Item</em>'. + * Returns a new object of class '<em>Parent</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return a new object of class '<em>Item</em>'. + * @return a new object of class '<em>Parent</em>'. * @generated */ - Item createItem(); - - /** - * Returns a new object of class '<em>Thing</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Thing</em>'. - * @generated - */ - Thing createThing(); + Parent createParent(); /** * Returns the package supported by this factory. diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangPackage.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangPackage.java index f38deb1..02096b8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangPackage.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/ActionLangPackage.java @@ -70,106 +70,78 @@ public interface ActionLangPackage extends EPackage int MODEL = 0; /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__CHILDREN = 0; - - /** * The number of structural features of the '<em>Model</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int MODEL_FEATURE_COUNT = 1; + int MODEL_FEATURE_COUNT = 0; /** - * The meta object id for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.TypeImpl <em>Type</em>}' class. + * The meta object id for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ChildImpl <em>Child</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.TypeImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getType() + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ChildImpl + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getChild() * @generated */ - int TYPE = 1; + int CHILD = 1; /** - * The number of structural features of the '<em>Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TYPE_FEATURE_COUNT = 0; - - /** - * The meta object id for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ItemImpl <em>Item</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ItemImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getItem() - * @generated - */ - int ITEM = 2; - - /** - * The feature id for the '<em><b>Items</b></em>' containment reference list. + * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int ITEM__ITEMS = TYPE_FEATURE_COUNT + 0; + int CHILD__NAME = MODEL_FEATURE_COUNT + 0; /** - * The number of structural features of the '<em>Item</em>' class. + * The number of structural features of the '<em>Child</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int ITEM_FEATURE_COUNT = TYPE_FEATURE_COUNT + 1; + int CHILD_FEATURE_COUNT = MODEL_FEATURE_COUNT + 1; /** - * The meta object id for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl <em>Thing</em>}' class. + * The meta object id for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl <em>Parent</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getThing() + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getParent() * @generated */ - int THING = 3; + int PARENT = 2; /** - * The feature id for the '<em><b>Content</b></em>' containment reference. + * The feature id for the '<em><b>Left</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int THING__CONTENT = TYPE_FEATURE_COUNT + 0; + int PARENT__LEFT = MODEL_FEATURE_COUNT + 0; /** - * The feature id for the '<em><b>Name</b></em>' attribute. + * The feature id for the '<em><b>Right</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int THING__NAME = TYPE_FEATURE_COUNT + 1; + int PARENT__RIGHT = MODEL_FEATURE_COUNT + 1; /** - * The number of structural features of the '<em>Thing</em>' class. + * The number of structural features of the '<em>Parent</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int THING_FEATURE_COUNT = TYPE_FEATURE_COUNT + 2; + int PARENT_FEATURE_COUNT = MODEL_FEATURE_COUNT + 2; /** @@ -183,78 +155,57 @@ public interface ActionLangPackage extends EPackage EClass getModel(); /** - * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.testlanguages.actionLang.Model#getChildren <em>Children</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Children</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Model#getChildren() - * @see #getModel() - * @generated - */ - EReference getModel_Children(); - - /** - * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.actionLang.Type <em>Type</em>}'. + * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.actionLang.Child <em>Child</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for class '<em>Type</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Type + * @return the meta object for class '<em>Child</em>'. + * @see org.eclipse.xtext.testlanguages.actionLang.Child * @generated */ - EClass getType(); + EClass getChild(); /** - * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.actionLang.Item <em>Item</em>}'. + * Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.actionLang.Child#getName <em>Name</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for class '<em>Item</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Item - * @generated - */ - EClass getItem(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.xtext.testlanguages.actionLang.Item#getItems <em>Items</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Items</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Item#getItems() - * @see #getItem() + * @return the meta object for the attribute '<em>Name</em>'. + * @see org.eclipse.xtext.testlanguages.actionLang.Child#getName() + * @see #getChild() * @generated */ - EReference getItem_Items(); + EAttribute getChild_Name(); /** - * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.actionLang.Thing <em>Thing</em>}'. + * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.actionLang.Parent <em>Parent</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for class '<em>Thing</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Thing + * @return the meta object for class '<em>Parent</em>'. + * @see org.eclipse.xtext.testlanguages.actionLang.Parent * @generated */ - EClass getThing(); + EClass getParent(); /** - * Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getContent <em>Content</em>}'. + * Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getLeft <em>Left</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Content</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Thing#getContent() - * @see #getThing() + * @return the meta object for the containment reference '<em>Left</em>'. + * @see org.eclipse.xtext.testlanguages.actionLang.Parent#getLeft() + * @see #getParent() * @generated */ - EReference getThing_Content(); + EReference getParent_Left(); /** - * Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getName <em>Name</em>}'. + * Returns the meta object for the containment reference '{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getRight <em>Right</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.eclipse.xtext.testlanguages.actionLang.Thing#getName() - * @see #getThing() + * @return the meta object for the containment reference '<em>Right</em>'. + * @see org.eclipse.xtext.testlanguages.actionLang.Parent#getRight() + * @see #getParent() * @generated */ - EAttribute getThing_Name(); + EReference getParent_Right(); /** * Returns the factory that creates the instances of the model. @@ -290,66 +241,48 @@ public interface ActionLangPackage extends EPackage EClass MODEL = eINSTANCE.getModel(); /** - * The meta object literal for the '<em><b>Children</b></em>' containment reference list feature. + * The meta object literal for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ChildImpl <em>Child</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ChildImpl + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getChild() * @generated */ - EReference MODEL__CHILDREN = eINSTANCE.getModel_Children(); + EClass CHILD = eINSTANCE.getChild(); /** - * The meta object literal for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.TypeImpl <em>Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.TypeImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getType() - * @generated - */ - EClass TYPE = eINSTANCE.getType(); - - /** - * The meta object literal for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ItemImpl <em>Item</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ItemImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getItem() - * @generated - */ - EClass ITEM = eINSTANCE.getItem(); - - /** - * The meta object literal for the '<em><b>Items</b></em>' containment reference list feature. + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - EReference ITEM__ITEMS = eINSTANCE.getItem_Items(); + EAttribute CHILD__NAME = eINSTANCE.getChild_Name(); /** - * The meta object literal for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl <em>Thing</em>}' class. + * The meta object literal for the '{@link org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl <em>Parent</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl - * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getThing() + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl + * @see org.eclipse.xtext.testlanguages.actionLang.impl.ActionLangPackageImpl#getParent() * @generated */ - EClass THING = eINSTANCE.getThing(); + EClass PARENT = eINSTANCE.getParent(); /** - * The meta object literal for the '<em><b>Content</b></em>' containment reference feature. + * The meta object literal for the '<em><b>Left</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - EReference THING__CONTENT = eINSTANCE.getThing_Content(); + EReference PARENT__LEFT = eINSTANCE.getParent_Left(); /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * The meta object literal for the '<em><b>Right</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - EAttribute THING__NAME = eINSTANCE.getThing_Name(); + EReference PARENT__RIGHT = eINSTANCE.getParent_Right(); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Child.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Child.java new file mode 100644 index 0000000..4912d7d --- a/dev/null +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Child.java @@ -0,0 +1,53 @@ +/** + * <copyright> + * </copyright> + * + */ +package org.eclipse.xtext.testlanguages.actionLang; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Child</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Child#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getChild() + * @model + * @generated + */ +public interface Child extends Model +{ + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getChild_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.testlanguages.actionLang.Child#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Child diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Item.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Item.java deleted file mode 100644 index 6bc91b4..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Item.java +++ b/dev/null @@ -1,44 +0,0 @@ -/** - * <copyright> - * </copyright> - * - */ -package org.eclipse.xtext.testlanguages.actionLang; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Item</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Item#getItems <em>Items</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getItem() - * @model - * @generated - */ -public interface Item extends Type -{ - /** - * Returns the value of the '<em><b>Items</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.xtext.testlanguages.actionLang.Type}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Items</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Items</em>' containment reference list. - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getItem_Items() - * @model containment="true" - * @generated - */ - EList<Type> getItems(); - -} // Item diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Model.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Model.java index 6376671..8167a0c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Model.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Model.java @@ -5,8 +5,6 @@ */ package org.eclipse.xtext.testlanguages.actionLang; -import org.eclipse.emf.common.util.EList; - import org.eclipse.emf.ecore.EObject; /** @@ -14,12 +12,6 @@ import org.eclipse.emf.ecore.EObject; * A representation of the model object '<em><b>Model</b></em>'. * <!-- end-user-doc --> * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Model#getChildren <em>Children</em>}</li> - * </ul> - * </p> * * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getModel() * @model @@ -27,20 +19,4 @@ import org.eclipse.emf.ecore.EObject; */ public interface Model extends EObject { - /** - * Returns the value of the '<em><b>Children</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.xtext.testlanguages.actionLang.Type}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Children</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Children</em>' containment reference list. - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getModel_Children() - * @model containment="true" - * @generated - */ - EList<Type> getChildren(); - } // Model diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Parent.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Parent.java new file mode 100644 index 0000000..8be76cb --- a/dev/null +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Parent.java @@ -0,0 +1,80 @@ +/** + * <copyright> + * </copyright> + * + */ +package org.eclipse.xtext.testlanguages.actionLang; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Parent</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getLeft <em>Left</em>}</li> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getRight <em>Right</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getParent() + * @model + * @generated + */ +public interface Parent extends Model +{ + /** + * Returns the value of the '<em><b>Left</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Left</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Left</em>' containment reference. + * @see #setLeft(Child) + * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getParent_Left() + * @model containment="true" + * @generated + */ + Child getLeft(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getLeft <em>Left</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Left</em>' containment reference. + * @see #getLeft() + * @generated + */ + void setLeft(Child value); + + /** + * Returns the value of the '<em><b>Right</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Right</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Right</em>' containment reference. + * @see #setRight(Child) + * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getParent_Right() + * @model containment="true" + * @generated + */ + Child getRight(); + + /** + * Sets the value of the '{@link org.eclipse.xtext.testlanguages.actionLang.Parent#getRight <em>Right</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Right</em>' containment reference. + * @see #getRight() + * @generated + */ + void setRight(Child value); + +} // Parent diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Thing.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Thing.java deleted file mode 100644 index 854f9f3..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Thing.java +++ b/dev/null @@ -1,80 +0,0 @@ -/** - * <copyright> - * </copyright> - * - */ -package org.eclipse.xtext.testlanguages.actionLang; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Thing</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getContent <em>Content</em>}</li> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getThing() - * @model - * @generated - */ -public interface Thing extends Type -{ - /** - * Returns the value of the '<em><b>Content</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Content</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Content</em>' containment reference. - * @see #setContent(Type) - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getThing_Content() - * @model containment="true" - * @generated - */ - Type getContent(); - - /** - * Sets the value of the '{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getContent <em>Content</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Content</em>' containment reference. - * @see #getContent() - * @generated - */ - void setContent(Type value); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getThing_Name() - * @model - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.xtext.testlanguages.actionLang.Thing#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - -} // Thing diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Type.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Type.java deleted file mode 100644 index 99edfbb..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/Type.java +++ b/dev/null @@ -1,22 +0,0 @@ -/** - * <copyright> - * </copyright> - * - */ -package org.eclipse.xtext.testlanguages.actionLang; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Type</b></em>'. - * <!-- end-user-doc --> - * - * - * @see org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage#getType() - * @model - * @generated - */ -public interface Type extends EObject -{ -} // Type diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangFactoryImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangFactoryImpl.java index 016cbc4..95b2026 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangFactoryImpl.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangFactoryImpl.java @@ -68,9 +68,8 @@ public class ActionLangFactoryImpl extends EFactoryImpl implements ActionLangFac switch (eClass.getClassifierID()) { case ActionLangPackage.MODEL: return createModel(); - case ActionLangPackage.TYPE: return createType(); - case ActionLangPackage.ITEM: return createItem(); - case ActionLangPackage.THING: return createThing(); + case ActionLangPackage.CHILD: return createChild(); + case ActionLangPackage.PARENT: return createParent(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -92,10 +91,10 @@ public class ActionLangFactoryImpl extends EFactoryImpl implements ActionLangFac * <!-- end-user-doc --> * @generated */ - public Type createType() + public Child createChild() { - TypeImpl type = new TypeImpl(); - return type; + ChildImpl child = new ChildImpl(); + return child; } /** @@ -103,21 +102,10 @@ public class ActionLangFactoryImpl extends EFactoryImpl implements ActionLangFac * <!-- end-user-doc --> * @generated */ - public Item createItem() + public Parent createParent() { - ItemImpl item = new ItemImpl(); - return item; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Thing createThing() - { - ThingImpl thing = new ThingImpl(); - return thing; + ParentImpl parent = new ParentImpl(); + return parent; } /** diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangPackageImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangPackageImpl.java index 1bb26c4..2be6b2c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangPackageImpl.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ActionLangPackageImpl.java @@ -14,10 +14,9 @@ import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.xtext.testlanguages.actionLang.ActionLangFactory; import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage; -import org.eclipse.xtext.testlanguages.actionLang.Item; +import org.eclipse.xtext.testlanguages.actionLang.Child; import org.eclipse.xtext.testlanguages.actionLang.Model; -import org.eclipse.xtext.testlanguages.actionLang.Thing; -import org.eclipse.xtext.testlanguages.actionLang.Type; +import org.eclipse.xtext.testlanguages.actionLang.Parent; /** * <!-- begin-user-doc --> @@ -39,21 +38,14 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - private EClass typeEClass = null; + private EClass childEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - private EClass itemEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass thingEClass = null; + private EClass parentEClass = null; /** * Creates an instance of the model <b>Package</b>, registered with @@ -140,29 +132,9 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - public EReference getModel_Children() - { - return (EReference)modelEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getType() - { - return typeEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getItem() + public EClass getChild() { - return itemEClass; + return childEClass; } /** @@ -170,9 +142,9 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - public EReference getItem_Items() + public EAttribute getChild_Name() { - return (EReference)itemEClass.getEStructuralFeatures().get(0); + return (EAttribute)childEClass.getEStructuralFeatures().get(0); } /** @@ -180,9 +152,9 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - public EClass getThing() + public EClass getParent() { - return thingEClass; + return parentEClass; } /** @@ -190,9 +162,9 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - public EReference getThing_Content() + public EReference getParent_Left() { - return (EReference)thingEClass.getEStructuralFeatures().get(0); + return (EReference)parentEClass.getEStructuralFeatures().get(0); } /** @@ -200,9 +172,9 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac * <!-- end-user-doc --> * @generated */ - public EAttribute getThing_Name() + public EReference getParent_Right() { - return (EAttribute)thingEClass.getEStructuralFeatures().get(1); + return (EReference)parentEClass.getEStructuralFeatures().get(1); } /** @@ -236,16 +208,13 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac // Create classes and their features modelEClass = createEClass(MODEL); - createEReference(modelEClass, MODEL__CHILDREN); - - typeEClass = createEClass(TYPE); - itemEClass = createEClass(ITEM); - createEReference(itemEClass, ITEM__ITEMS); + childEClass = createEClass(CHILD); + createEAttribute(childEClass, CHILD__NAME); - thingEClass = createEClass(THING); - createEReference(thingEClass, THING__CONTENT); - createEAttribute(thingEClass, THING__NAME); + parentEClass = createEClass(PARENT); + createEReference(parentEClass, PARENT__LEFT); + createEReference(parentEClass, PARENT__RIGHT); } /** @@ -277,21 +246,18 @@ public class ActionLangPackageImpl extends EPackageImpl implements ActionLangPac // Set bounds for type parameters // Add supertypes to classes - itemEClass.getESuperTypes().add(this.getType()); - thingEClass.getESuperTypes().add(this.getType()); + childEClass.getESuperTypes().add(this.getModel()); + parentEClass.getESuperTypes().add(this.getModel()); // Initialize classes and features; add operations and parameters initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getModel_Children(), this.getType(), null, "children", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(typeEClass, Type.class, "Type", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEClass(itemEClass, Item.class, "Item", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getItem_Items(), this.getType(), null, "items", null, 0, -1, Item.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(childEClass, Child.class, "Child", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getChild_Name(), ecorePackage.getEString(), "name", null, 0, 1, Child.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEClass(thingEClass, Thing.class, "Thing", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getThing_Content(), this.getType(), null, "content", null, 0, 1, Thing.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getThing_Name(), ecorePackage.getEString(), "name", null, 0, 1, Thing.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(parentEClass, Parent.class, "Parent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getParent_Left(), this.getChild(), null, "left", null, 0, 1, Parent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getParent_Right(), this.getChild(), null, "right", null, 0, 1, Parent.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/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ItemImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ChildImpl.java index baf152b..175ca14 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ItemImpl.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ChildImpl.java @@ -5,53 +5,56 @@ */ package org.eclipse.xtext.testlanguages.actionLang.impl; -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage; -import org.eclipse.xtext.testlanguages.actionLang.Item; -import org.eclipse.xtext.testlanguages.actionLang.Type; +import org.eclipse.xtext.testlanguages.actionLang.Child; /** * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Item</b></em>'. + * An implementation of the model object '<em><b>Child</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ItemImpl#getItems <em>Items</em>}</li> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ChildImpl#getName <em>Name</em>}</li> * </ul> * </p> * * @generated */ -public class ItemImpl extends TypeImpl implements Item +public class ChildImpl extends ModelImpl implements Child { /** - * The cached value of the '{@link #getItems() <em>Items</em>}' containment reference list. + * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getItems() + * @see #getName() * @generated * @ordered */ - protected EList<Type> items; + protected static final String NAME_EDEFAULT = null; /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * @see #getName() * @generated + * @ordered */ - protected ItemImpl() + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ChildImpl() { super(); } @@ -64,7 +67,7 @@ public class ItemImpl extends TypeImpl implements Item @Override protected EClass eStaticClass() { - return ActionLangPackage.Literals.ITEM; + return ActionLangPackage.Literals.CHILD; } /** @@ -72,13 +75,9 @@ public class ItemImpl extends TypeImpl implements Item * <!-- end-user-doc --> * @generated */ - public EList<Type> getItems() + public String getName() { - if (items == null) - { - items = new EObjectContainmentEList<Type>(Type.class, this, ActionLangPackage.ITEM__ITEMS); - } - return items; + return name; } /** @@ -86,15 +85,12 @@ public class ItemImpl extends TypeImpl implements Item * <!-- end-user-doc --> * @generated */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + public void setName(String newName) { - switch (featureID) - { - case ActionLangPackage.ITEM__ITEMS: - return ((InternalEList<?>)getItems()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ActionLangPackage.CHILD__NAME, oldName, name)); } /** @@ -107,8 +103,8 @@ public class ItemImpl extends TypeImpl implements Item { switch (featureID) { - case ActionLangPackage.ITEM__ITEMS: - return getItems(); + case ActionLangPackage.CHILD__NAME: + return getName(); } return super.eGet(featureID, resolve, coreType); } @@ -118,15 +114,13 @@ public class ItemImpl extends TypeImpl implements Item * <!-- end-user-doc --> * @generated */ - @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case ActionLangPackage.ITEM__ITEMS: - getItems().clear(); - getItems().addAll((Collection<? extends Type>)newValue); + case ActionLangPackage.CHILD__NAME: + setName((String)newValue); return; } super.eSet(featureID, newValue); @@ -142,8 +136,8 @@ public class ItemImpl extends TypeImpl implements Item { switch (featureID) { - case ActionLangPackage.ITEM__ITEMS: - getItems().clear(); + case ActionLangPackage.CHILD__NAME: + setName(NAME_EDEFAULT); return; } super.eUnset(featureID); @@ -159,10 +153,27 @@ public class ItemImpl extends TypeImpl implements Item { switch (featureID) { - case ActionLangPackage.ITEM__ITEMS: - return items != null && !items.isEmpty(); + case ActionLangPackage.CHILD__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); } return super.eIsSet(featureID); } -} //ItemImpl + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ChildImpl diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ModelImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ModelImpl.java index d7c62c7..7a32eb3 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ModelImpl.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ModelImpl.java @@ -5,33 +5,18 @@ */ package org.eclipse.xtext.testlanguages.actionLang.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.testlanguages.actionLang.ActionLangPackage; import org.eclipse.xtext.testlanguages.actionLang.Model; -import org.eclipse.xtext.testlanguages.actionLang.Type; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Model</b></em>'. * <!-- end-user-doc --> * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ModelImpl#getChildren <em>Children</em>}</li> - * </ul> * </p> * * @generated @@ -39,16 +24,6 @@ import org.eclipse.xtext.testlanguages.actionLang.Type; public class ModelImpl extends MinimalEObjectImpl.Container implements Model { /** - * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChildren() - * @generated - * @ordered - */ - protected EList<Type> children; - - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -69,102 +44,4 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model return ActionLangPackage.Literals.MODEL; } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Type> getChildren() - { - if (children == null) - { - children = new EObjectContainmentEList<Type>(Type.class, this, ActionLangPackage.MODEL__CHILDREN); - } - return children; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case ActionLangPackage.MODEL__CHILDREN: - return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ActionLangPackage.MODEL__CHILDREN: - return getChildren(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ActionLangPackage.MODEL__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection<? extends Type>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ActionLangPackage.MODEL__CHILDREN: - getChildren().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ActionLangPackage.MODEL__CHILDREN: - return children != null && !children.isEmpty(); - } - return super.eIsSet(featureID); - } - } //ModelImpl diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ThingImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ParentImpl.java index b2819e5..b19eb59 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ThingImpl.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/ParentImpl.java @@ -14,61 +14,51 @@ import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage; -import org.eclipse.xtext.testlanguages.actionLang.Thing; -import org.eclipse.xtext.testlanguages.actionLang.Type; +import org.eclipse.xtext.testlanguages.actionLang.Child; +import org.eclipse.xtext.testlanguages.actionLang.Parent; /** * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Thing</b></em>'. + * An implementation of the model object '<em><b>Parent</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl#getContent <em>Content</em>}</li> - * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ThingImpl#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl#getLeft <em>Left</em>}</li> + * <li>{@link org.eclipse.xtext.testlanguages.actionLang.impl.ParentImpl#getRight <em>Right</em>}</li> * </ul> * </p> * * @generated */ -public class ThingImpl extends TypeImpl implements Thing +public class ParentImpl extends ModelImpl implements Parent { /** - * The cached value of the '{@link #getContent() <em>Content</em>}' containment reference. + * The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getContent() + * @see #getLeft() * @generated * @ordered */ - protected Type content; + protected Child left; /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * The cached value of the '{@link #getRight() <em>Right</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getName() + * @see #getRight() * @generated * @ordered */ - protected static final String NAME_EDEFAULT = null; + protected Child right; /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getName() * @generated - * @ordered */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ThingImpl() + protected ParentImpl() { super(); } @@ -81,7 +71,7 @@ public class ThingImpl extends TypeImpl implements Thing @Override protected EClass eStaticClass() { - return ActionLangPackage.Literals.THING; + return ActionLangPackage.Literals.PARENT; } /** @@ -89,9 +79,9 @@ public class ThingImpl extends TypeImpl implements Thing * <!-- end-user-doc --> * @generated */ - public Type getContent() + public Child getLeft() { - return content; + return left; } /** @@ -99,13 +89,13 @@ public class ThingImpl extends TypeImpl implements Thing * <!-- end-user-doc --> * @generated */ - public NotificationChain basicSetContent(Type newContent, NotificationChain msgs) + public NotificationChain basicSetLeft(Child newLeft, NotificationChain msgs) { - Type oldContent = content; - content = newContent; + Child oldLeft = left; + left = newLeft; if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActionLangPackage.THING__CONTENT, oldContent, newContent); + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActionLangPackage.PARENT__LEFT, oldLeft, newLeft); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; @@ -116,20 +106,20 @@ public class ThingImpl extends TypeImpl implements Thing * <!-- end-user-doc --> * @generated */ - public void setContent(Type newContent) + public void setLeft(Child newLeft) { - if (newContent != content) + if (newLeft != left) { NotificationChain msgs = null; - if (content != null) - msgs = ((InternalEObject)content).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.THING__CONTENT, null, msgs); - if (newContent != null) - msgs = ((InternalEObject)newContent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.THING__CONTENT, null, msgs); - msgs = basicSetContent(newContent, msgs); + if (left != null) + msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.PARENT__LEFT, null, msgs); + if (newLeft != null) + msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.PARENT__LEFT, null, msgs); + msgs = basicSetLeft(newLeft, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ActionLangPackage.THING__CONTENT, newContent, newContent)); + eNotify(new ENotificationImpl(this, Notification.SET, ActionLangPackage.PARENT__LEFT, newLeft, newLeft)); } /** @@ -137,9 +127,9 @@ public class ThingImpl extends TypeImpl implements Thing * <!-- end-user-doc --> * @generated */ - public String getName() + public Child getRight() { - return name; + return right; } /** @@ -147,12 +137,37 @@ public class ThingImpl extends TypeImpl implements Thing * <!-- end-user-doc --> * @generated */ - public void setName(String newName) + public NotificationChain basicSetRight(Child newRight, NotificationChain msgs) { - String oldName = name; - name = newName; + Child oldRight = right; + right = newRight; if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ActionLangPackage.THING__NAME, oldName, name)); + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActionLangPackage.PARENT__RIGHT, oldRight, newRight); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setRight(Child newRight) + { + if (newRight != right) + { + NotificationChain msgs = null; + if (right != null) + msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.PARENT__RIGHT, null, msgs); + if (newRight != null) + msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActionLangPackage.PARENT__RIGHT, null, msgs); + msgs = basicSetRight(newRight, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ActionLangPackage.PARENT__RIGHT, newRight, newRight)); } /** @@ -165,8 +180,10 @@ public class ThingImpl extends TypeImpl implements Thing { switch (featureID) { - case ActionLangPackage.THING__CONTENT: - return basicSetContent(null, msgs); + case ActionLangPackage.PARENT__LEFT: + return basicSetLeft(null, msgs); + case ActionLangPackage.PARENT__RIGHT: + return basicSetRight(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -181,10 +198,10 @@ public class ThingImpl extends TypeImpl implements Thing { switch (featureID) { - case ActionLangPackage.THING__CONTENT: - return getContent(); - case ActionLangPackage.THING__NAME: - return getName(); + case ActionLangPackage.PARENT__LEFT: + return getLeft(); + case ActionLangPackage.PARENT__RIGHT: + return getRight(); } return super.eGet(featureID, resolve, coreType); } @@ -199,11 +216,11 @@ public class ThingImpl extends TypeImpl implements Thing { switch (featureID) { - case ActionLangPackage.THING__CONTENT: - setContent((Type)newValue); + case ActionLangPackage.PARENT__LEFT: + setLeft((Child)newValue); return; - case ActionLangPackage.THING__NAME: - setName((String)newValue); + case ActionLangPackage.PARENT__RIGHT: + setRight((Child)newValue); return; } super.eSet(featureID, newValue); @@ -219,11 +236,11 @@ public class ThingImpl extends TypeImpl implements Thing { switch (featureID) { - case ActionLangPackage.THING__CONTENT: - setContent((Type)null); + case ActionLangPackage.PARENT__LEFT: + setLeft((Child)null); return; - case ActionLangPackage.THING__NAME: - setName(NAME_EDEFAULT); + case ActionLangPackage.PARENT__RIGHT: + setRight((Child)null); return; } super.eUnset(featureID); @@ -239,29 +256,12 @@ public class ThingImpl extends TypeImpl implements Thing { switch (featureID) { - case ActionLangPackage.THING__CONTENT: - return content != null; - case ActionLangPackage.THING__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case ActionLangPackage.PARENT__LEFT: + return left != null; + case ActionLangPackage.PARENT__RIGHT: + return right != null; } return super.eIsSet(featureID); } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} //ThingImpl +} //ParentImpl diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/TypeImpl.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/TypeImpl.java deleted file mode 100644 index 3db61e0..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/impl/TypeImpl.java +++ b/dev/null @@ -1,47 +0,0 @@ -/** - * <copyright> - * </copyright> - * - */ -package org.eclipse.xtext.testlanguages.actionLang.impl; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; - -import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage; -import org.eclipse.xtext.testlanguages.actionLang.Type; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Type</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class TypeImpl extends MinimalEObjectImpl.Container implements Type -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TypeImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ActionLangPackage.Literals.TYPE; - } - -} //TypeImpl diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangAdapterFactory.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangAdapterFactory.java index b638c94..b5a59fb 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangAdapterFactory.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangAdapterFactory.java @@ -83,19 +83,14 @@ public class ActionLangAdapterFactory extends AdapterFactoryImpl return createModelAdapter(); } @Override - public Adapter caseType(Type object) + public Adapter caseChild(Child object) { - return createTypeAdapter(); + return createChildAdapter(); } @Override - public Adapter caseItem(Item object) + public Adapter caseParent(Parent object) { - return createItemAdapter(); - } - @Override - public Adapter caseThing(Thing object) - { - return createThingAdapter(); + return createParentAdapter(); } @Override public Adapter defaultCase(EObject object) @@ -135,46 +130,31 @@ public class ActionLangAdapterFactory extends AdapterFactoryImpl } /** - * Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.actionLang.Type <em>Type</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.xtext.testlanguages.actionLang.Type - * @generated - */ - public Adapter createTypeAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.actionLang.Item <em>Item</em>}'. + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.actionLang.Child <em>Child</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. - * @see org.eclipse.xtext.testlanguages.actionLang.Item + * @see org.eclipse.xtext.testlanguages.actionLang.Child * @generated */ - public Adapter createItemAdapter() + public Adapter createChildAdapter() { return null; } /** - * Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.actionLang.Thing <em>Thing</em>}'. + * Creates a new adapter for an object of class '{@link org.eclipse.xtext.testlanguages.actionLang.Parent <em>Parent</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. - * @see org.eclipse.xtext.testlanguages.actionLang.Thing + * @see org.eclipse.xtext.testlanguages.actionLang.Parent * @generated */ - public Adapter createThingAdapter() + public Adapter createParentAdapter() { return null; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangSwitch.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangSwitch.java index 8d96e21..0299174 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangSwitch.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/actionLang/util/ActionLangSwitch.java @@ -102,26 +102,19 @@ public class ActionLangSwitch<T> if (result == null) result = defaultCase(theEObject); return result; } - case ActionLangPackage.TYPE: + case ActionLangPackage.CHILD: { - Type type = (Type)theEObject; - T result = caseType(type); + Child child = (Child)theEObject; + T result = caseChild(child); + if (result == null) result = caseModel(child); if (result == null) result = defaultCase(theEObject); return result; } - case ActionLangPackage.ITEM: + case ActionLangPackage.PARENT: { - Item item = (Item)theEObject; - T result = caseItem(item); - if (result == null) result = caseType(item); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ActionLangPackage.THING: - { - Thing thing = (Thing)theEObject; - T result = caseThing(thing); - if (result == null) result = caseType(thing); + Parent parent = (Parent)theEObject; + T result = caseParent(parent); + if (result == null) result = caseModel(parent); if (result == null) result = defaultCase(theEObject); return result; } @@ -146,49 +139,33 @@ public class ActionLangSwitch<T> } /** - * Returns the result of interpreting the object as an instance of '<em>Type</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Type</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseType(Type object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Item</em>'. + * Returns the result of interpreting the object as an instance of '<em>Child</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Item</em>'. + * @return the result of interpreting the object as an instance of '<em>Child</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseItem(Item object) + public T caseChild(Child object) { return null; } /** - * Returns the result of interpreting the object as an instance of '<em>Thing</em>'. + * Returns the result of interpreting the object as an instance of '<em>Parent</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Thing</em>'. + * @return the result of interpreting the object as an instance of '<em>Parent</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseThing(Thing object) + public T caseParent(Parent object) { return null; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parseTreeConstruction/ActionTestLanguageParsetreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parseTreeConstruction/ActionTestLanguageParsetreeConstructor.java index ae83804..dc8aa1f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parseTreeConstruction/ActionTestLanguageParsetreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parseTreeConstruction/ActionTestLanguageParsetreeConstructor.java @@ -22,9 +22,8 @@ public class ActionTestLanguageParsetreeConstructor extends AbstractParseTreeCon protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - if(inst.isInstanceOf(grammarAccess.prModel().getRule().getType().getClassifier()) && (s = new Model_Assignment_children(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; - if(inst.isInstanceOf(grammarAccess.prElement().getRule().getType().getClassifier()) && (s = new Element_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; - if(inst.isInstanceOf(grammarAccess.prItem().getRule().getType().getClassifier()) && (s = new Item_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf(grammarAccess.prModel().getRule().getType().getClassifier()) && (s = new Model_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf(grammarAccess.prChild().getRule().getType().getClassifier()) && (s = new Child_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -37,67 +36,24 @@ public class ActionTestLanguageParsetreeConstructor extends AbstractParseTreeCon // not supported -protected class Model_Assignment_children extends AssignmentToken { +protected class Model_Group extends GroupToken { - public Model_Assignment_children(IInstanceDescription curr, AbstractToken pred) { - super(curr, pred, IS_MANY, !IS_REQUIRED); - } - - @Override - public Assignment getGrammarElement() { - return grammarAccess.prModel().eleAssignmentChildren(); - } - - @Override - protected Solution createSolution() { - if((value = current.getConsumable("children",!IS_REQUIRED)) == null) return null; - IInstanceDescription obj = current.cloneAndConsume("children"); - - if(value instanceof EObject) { // xtext::RuleCall - IInstanceDescription param = getDescr((EObject)value); - if(param.isInstanceOf(grammarAccess.prElement().getRule().getType().getClassifier())) { - Solution s = new Element_Group(param, this).firstSolution(); - while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); - if(s != null) { - type = AssignmentType.PRC; - return new Solution(obj,s.getPredecessor()); - } - } - } - - return null; - } -} - -/************ end Rule Model ****************/ - - -/************ begin Rule Element **************** - * - * not supported - * - **/ - - -// not supported -protected class Element_Group extends GroupToken { - - public Element_Group(IInstanceDescription curr, AbstractToken pred) { + public Model_Group(IInstanceDescription curr, AbstractToken pred) { super(curr, pred, !IS_MANY, IS_REQUIRED); } @Override public Group getGrammarElement() { - return grammarAccess.prElement().eleGroup(); + return grammarAccess.prModel().eleGroup(); } @Override protected Solution createSolution() { - Solution s1 = new Element_1_Group(current, this).firstSolution(); + Solution s1 = new Model_1_Group(current, this).firstSolution(); while(s1 != null) { - Solution s2 = new Element_0_RuleCall_Item(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + Solution s2 = new Model_0_RuleCall_Child(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 != null) { last = s2.getPredecessor(); return s2; @@ -110,44 +66,44 @@ protected class Element_Group extends GroupToken { } // not supported -protected class Element_0_RuleCall_Item extends RuleCallToken { +protected class Model_0_RuleCall_Child extends RuleCallToken { - public Element_0_RuleCall_Item(IInstanceDescription curr, AbstractToken pred) { + public Model_0_RuleCall_Child(IInstanceDescription curr, AbstractToken pred) { super(curr, pred, !IS_MANY, IS_REQUIRED); } @Override public RuleCall getGrammarElement() { - return grammarAccess.prElement().ele0ParserRuleCallItem(); + return grammarAccess.prModel().ele0ParserRuleCallChild(); } @Override protected Solution createSolution() { - if(checkForRecursion(Item_Group.class, current)) return null; - if(!current.isInstanceOf(grammarAccess.prItem().getRule().getType().getClassifier())) return null; - return new Item_Group(current, this).firstSolution(); + if(checkForRecursion(Child_Assignment_name.class, current)) return null; + if(!current.isInstanceOf(grammarAccess.prChild().getRule().getType().getClassifier())) return null; + return new Child_Assignment_name(current, this).firstSolution(); } } // not supported -protected class Element_1_Group extends GroupToken { +protected class Model_1_Group extends GroupToken { - public Element_1_Group(IInstanceDescription curr, AbstractToken pred) { - super(curr, pred, !IS_MANY, IS_REQUIRED); + public Model_1_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, !IS_REQUIRED); } @Override public Group getGrammarElement() { - return grammarAccess.prElement().ele1Group(); + return grammarAccess.prModel().ele1Group(); } @Override protected Solution createSolution() { - Solution s1 = new Element_1_1_Assignment_items(current, this).firstSolution(); + Solution s1 = new Model_1_1_Assignment_right(current, this).firstSolution(); while(s1 != null) { - Solution s2 = new Element_1_0_Action_Item_items(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + Solution s2 = new Model_1_0_Action_Parent_left(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 != null) { last = s2.getPredecessor(); return s2; @@ -160,48 +116,48 @@ protected class Element_1_Group extends GroupToken { } // not supported -protected class Element_1_0_Action_Item_items extends ActionToken { +protected class Model_1_0_Action_Parent_left extends ActionToken { - public Element_1_0_Action_Item_items(IInstanceDescription curr, AbstractToken pred) { + public Model_1_0_Action_Parent_left(IInstanceDescription curr, AbstractToken pred) { super(curr, pred, !IS_MANY, IS_REQUIRED); } @Override public Action getGrammarElement() { - return grammarAccess.prElement().ele10ActionItemitems(); + return grammarAccess.prModel().ele10ActionParentleft(); } @Override protected Solution createSolution() { - if(!current.isInstanceOf(grammarAccess.prElement().ele10ActionItemitems().getType().getClassifier())) return null; - Object val = current.getConsumable("items", false); + if(!current.isInstanceOf(grammarAccess.prModel().ele10ActionParentleft().getType().getClassifier())) return null; + Object val = current.getConsumable("left", false); if(val == null) return null; - if(!current.isConsumedWithLastConsumtion("items")) return null; + if(!current.isConsumedWithLastConsumtion("left")) return null; return new Solution(getDescr((EObject)val)); } } // not supported -protected class Element_1_1_Assignment_items extends AssignmentToken { +protected class Model_1_1_Assignment_right extends AssignmentToken { - public Element_1_1_Assignment_items(IInstanceDescription curr, AbstractToken pred) { + public Model_1_1_Assignment_right(IInstanceDescription curr, AbstractToken pred) { super(curr, pred, !IS_MANY, IS_REQUIRED); } @Override public Assignment getGrammarElement() { - return grammarAccess.prElement().ele11AssignmentItems(); + return grammarAccess.prModel().ele11AssignmentRight(); } @Override protected Solution createSolution() { - if((value = current.getConsumable("items",IS_REQUIRED)) == null) return null; - IInstanceDescription obj = current.cloneAndConsume("items"); + if((value = current.getConsumable("right",!IS_REQUIRED)) == null) return null; + IInstanceDescription obj = current.cloneAndConsume("right"); if(value instanceof EObject) { // xtext::RuleCall IInstanceDescription param = getDescr((EObject)value); - if(param.isInstanceOf(grammarAccess.prItem().getRule().getType().getClassifier())) { - Solution s = new Item_Group(param, this).firstSolution(); + if(param.isInstanceOf(grammarAccess.prChild().getRule().getType().getClassifier())) { + Solution s = new Child_Assignment_name(param, this).firstSolution(); while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; @@ -216,10 +172,10 @@ protected class Element_1_1_Assignment_items extends AssignmentToken { -/************ end Rule Element ****************/ +/************ end Rule Model ****************/ -/************ begin Rule Item **************** +/************ begin Rule Child **************** * * not supported * @@ -227,67 +183,15 @@ protected class Element_1_1_Assignment_items extends AssignmentToken { // not supported -protected class Item_Group extends GroupToken { - - public Item_Group(IInstanceDescription curr, AbstractToken pred) { - super(curr, pred, !IS_MANY, IS_REQUIRED); - } - - @Override - public Group getGrammarElement() { - return grammarAccess.prItem().eleGroup(); - } - - - - @Override - protected Solution createSolution() { - Solution s1 = new Item_1_Assignment_name(current, this).firstSolution(); - while(s1 != null) { - Solution s2 = new Item_0_Action_Thing_content(s1.getCurrent(), s1.getPredecessor()).firstSolution(); - if(s2 != null) { - last = s2.getPredecessor(); - return s2; - } else { - s1 = s1.getPredecessor().nextSolution(this,s1); - } - } - return null; - } -} - -// not supported -protected class Item_0_Action_Thing_content extends ActionToken { - - public Item_0_Action_Thing_content(IInstanceDescription curr, AbstractToken pred) { - super(curr, pred, !IS_MANY, IS_REQUIRED); - } +protected class Child_Assignment_name extends AssignmentToken { - @Override - public Action getGrammarElement() { - return grammarAccess.prItem().ele0ActionThingcontent(); - } - - @Override - protected Solution createSolution() { - if(!current.isInstanceOf(grammarAccess.prItem().ele0ActionThingcontent().getType().getClassifier())) return null; - Object val = current.getConsumable("content", false); - if(val == null) return null; - if(!current.isConsumedWithLastConsumtion("content")) return null; - return new Solution(getDescr((EObject)val)); - } -} - -// not supported -protected class Item_1_Assignment_name extends AssignmentToken { - - public Item_1_Assignment_name(IInstanceDescription curr, AbstractToken pred) { + public Child_Assignment_name(IInstanceDescription curr, AbstractToken pred) { super(curr, pred, !IS_MANY, IS_REQUIRED); } @Override public Assignment getGrammarElement() { - return grammarAccess.prItem().ele1AssignmentName(); + return grammarAccess.prChild().eleAssignmentName(); } @Override @@ -296,14 +200,13 @@ protected class Item_1_Assignment_name extends AssignmentToken { IInstanceDescription obj = current.cloneAndConsume("name"); if(Boolean.TRUE.booleanValue()) { // xtext::RuleCall FIXME: check if value is valid for lexer rule type = AssignmentType.LRC; - element = grammarAccess.prItem().ele10TerminalRuleCallID(); + element = grammarAccess.prChild().ele0TerminalRuleCallID(); return new Solution(obj); } return null; } } - -/************ end Rule Item ****************/ +/************ end Rule Child ****************/ } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g index 6789714..733b0e9 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g @@ -80,72 +80,30 @@ ruleModel returns [EObject current=null] @after { resetLookahead(); lastConsumedNode = currentNode; }: -( - - - { - currentNode=createCompositeNode(grammarAccess.prModel().ele0ParserRuleCallElement(), currentNode); - } - lv_children_0=ruleElement - { - if ($current==null) { - $current = factory.create(grammarAccess.prModel().getRule().getType().getClassifier()); - associateNodeWithAstElement(currentNode.getParent(), $current); - } - - try { - add($current, "children", lv_children_0, "Element", currentNode); - } catch (ValueConverterException vce) { - handleValueConverterException(vce); - } - currentNode = currentNode.getParent(); - } - -)*; - - - - - -// Entry rule entryRuleElement -entryRuleElement returns [EObject current=null] : - { currentNode = createCompositeNode(grammarAccess.prElement().getRule(), currentNode); } - iv_ruleElement=ruleElement - { $current=$iv_ruleElement.current; } - EOF -; - -// Rule Element -ruleElement returns [EObject current=null] - @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); - } - @after { resetLookahead(); - lastConsumedNode = currentNode; - }: ( { - currentNode=createCompositeNode(grammarAccess.prElement().ele0ParserRuleCallItem(), currentNode); + currentNode=createCompositeNode(grammarAccess.prModel().ele0ParserRuleCallChild(), currentNode); } - this_Item_0=ruleItem + this_Child_0=ruleChild { - $current = $this_Item_0.current; + $current = $this_Child_0.current; currentNode = currentNode.getParent(); } { - createLeafNode(grammarAccess.prElement().ele0ParserRuleCallItem(), null); + createLeafNode(grammarAccess.prModel().ele0ParserRuleCallChild(), null); } (( { - temp=factory.create(grammarAccess.prElement().ele10ActionItemitems().getType().getClassifier()); + temp=factory.create(grammarAccess.prModel().ele10ActionParentleft().getType().getClassifier()); try { - factory.add(temp, "items", $current, null /*ParserRule*/, currentNode); + factory.set(temp, "left", $current, null /*ParserRule*/, currentNode); } catch(ValueConverterException vce) { handleValueConverterException(vce); } $current = temp; temp = null; - CompositeNode newNode = createCompositeNode(grammarAccess.prElement().ele10ActionItemitems(), currentNode.getParent()); + CompositeNode newNode = createCompositeNode(grammarAccess.prModel().ele10ActionParentleft(), currentNode.getParent()); newNode.getChildren().add(currentNode); moveLookaheadInfo(currentNode, newNode); currentNode = newNode; @@ -155,81 +113,65 @@ ruleElement returns [EObject current=null] { - currentNode=createCompositeNode(grammarAccess.prElement().ele110ParserRuleCallItem(), currentNode); + currentNode=createCompositeNode(grammarAccess.prModel().ele110ParserRuleCallChild(), currentNode); } - lv_items_2=ruleItem + lv_right_2=ruleChild { if ($current==null) { - $current = factory.create(grammarAccess.prElement().getRule().getType().getClassifier()); + $current = factory.create(grammarAccess.prModel().getRule().getType().getClassifier()); associateNodeWithAstElement(currentNode.getParent(), $current); } try { - add($current, "items", lv_items_2, "Item", currentNode); + set($current, "right", lv_right_2, "Child", currentNode); } catch (ValueConverterException vce) { handleValueConverterException(vce); } currentNode = currentNode.getParent(); } -))); +))?); -// Entry rule entryRuleItem -entryRuleItem returns [EObject current=null] : - { currentNode = createCompositeNode(grammarAccess.prItem().getRule(), currentNode); } - iv_ruleItem=ruleItem - { $current=$iv_ruleItem.current; } +// Entry rule entryRuleChild +entryRuleChild returns [EObject current=null] : + { currentNode = createCompositeNode(grammarAccess.prChild().getRule(), currentNode); } + iv_ruleChild=ruleChild + { $current=$iv_ruleChild.current; } EOF ; -// Rule Item -ruleItem returns [EObject current=null] +// Rule Child +ruleChild returns [EObject current=null] @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); } @after { resetLookahead(); lastConsumedNode = currentNode; }: -(( - { - temp=factory.create(grammarAccess.prItem().ele0ActionThingcontent().getType().getClassifier()); - try { - factory.set(temp, "content", $current, null /*ParserRule*/, currentNode); - } catch(ValueConverterException vce) { - handleValueConverterException(vce); - } - $current = temp; - temp = null; - CompositeNode newNode = createCompositeNode(grammarAccess.prItem().ele0ActionThingcontent(), currentNode.getParent()); - newNode.getChildren().add(currentNode); - moveLookaheadInfo(currentNode, newNode); - currentNode = newNode; - associateNodeWithAstElement(currentNode, $current); - } -)( +( - lv_name_1= RULE_ID + lv_name_0= RULE_ID { - createLeafNode(grammarAccess.prItem().ele10TerminalRuleCallID(), "name"); + createLeafNode(grammarAccess.prChild().ele0TerminalRuleCallID(), "name"); } { if ($current==null) { - $current = factory.create(grammarAccess.prItem().getRule().getType().getClassifier()); + $current = factory.create(grammarAccess.prChild().getRule().getType().getClassifier()); associateNodeWithAstElement(currentNode, $current); } try { - set($current, "name", lv_name_1, "ID", lastConsumedNode); + set($current, "name", lv_name_0, "ID", lastConsumedNode); } catch (ValueConverterException vce) { handleValueConverterException(vce); } } -)); +); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageLexer.java index 95efd8d..671fc8e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageLexer.java @@ -30,10 +30,10 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_ID() throws RecognitionException { try { int _type = RULE_ID; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:237:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:237:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:179:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:179:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:237:11: ( '^' )? + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:179:11: ( '^' )? int alt1=2; int LA1_0 = input.LA(1); @@ -42,7 +42,7 @@ public class InternalActionTestLanguageLexer extends Lexer { } switch (alt1) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:237:11: '^' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:179:11: '^' { match('^'); @@ -61,7 +61,7 @@ public class InternalActionTestLanguageLexer extends Lexer { recover(mse); throw mse; } - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:237:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:179:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* loop2: do { int alt2=2; @@ -109,10 +109,10 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_INT() throws RecognitionException { try { int _type = RULE_INT; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:239:10: ( ( '0' .. '9' )+ ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:239:12: ( '0' .. '9' )+ + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:181:10: ( ( '0' .. '9' )+ ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:181:12: ( '0' .. '9' )+ { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:239:12: ( '0' .. '9' )+ + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:181:12: ( '0' .. '9' )+ int cnt3=0; loop3: do { @@ -126,7 +126,7 @@ public class InternalActionTestLanguageLexer extends Lexer { switch (alt3) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:239:13: '0' .. '9' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:181:13: '0' .. '9' { matchRange('0','9'); @@ -156,10 +156,10 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_STRING() throws RecognitionException { try { int _type = RULE_STRING; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:13: ( ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:13: ( ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) int alt6=2; int LA6_0 = input.LA(1); @@ -171,16 +171,16 @@ public class InternalActionTestLanguageLexer extends Lexer { } else { NoViableAltException nvae = - new NoViableAltException("241:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )", 6, 0, input); + new NoViableAltException("183:15: ( '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )", 6, 0, input); throw nvae; } switch (alt6) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:16: '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:16: '\\\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* '\\\"' { match('\"'); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:21: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:21: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\\"' ) ) )* loop4: do { int alt4=3; @@ -196,7 +196,7 @@ public class InternalActionTestLanguageLexer extends Lexer { switch (alt4) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:22: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:22: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) { match('\\'); if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) { @@ -213,7 +213,7 @@ public class InternalActionTestLanguageLexer extends Lexer { } break; case 2 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:64: ~ ( ( '\\\\' | '\\\"' ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:64: ~ ( ( '\\\\' | '\\\"' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) { input.consume(); @@ -239,10 +239,10 @@ public class InternalActionTestLanguageLexer extends Lexer { } break; case 2 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:86: '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:86: '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' { match('\''); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:91: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:91: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* loop5: do { int alt5=3; @@ -258,7 +258,7 @@ public class InternalActionTestLanguageLexer extends Lexer { switch (alt5) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:92: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:92: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) { match('\\'); if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) { @@ -275,7 +275,7 @@ public class InternalActionTestLanguageLexer extends Lexer { } break; case 2 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:241:134: ~ ( ( '\\\\' | '\\'' ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:134: ~ ( ( '\\\\' | '\\'' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) { input.consume(); @@ -317,12 +317,12 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_ML_COMMENT() throws RecognitionException { try { int _type = RULE_ML_COMMENT; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:243:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:243:19: '/*' ( options {greedy=false; } : . )* '*/' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:185:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:185:19: '/*' ( options {greedy=false; } : . )* '*/' { match("/*"); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:243:24: ( options {greedy=false; } : . )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:185:24: ( options {greedy=false; } : . )* loop7: do { int alt7=2; @@ -347,7 +347,7 @@ public class InternalActionTestLanguageLexer extends Lexer { switch (alt7) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:243:52: . + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:185:52: . { matchAny(); @@ -375,12 +375,12 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_SL_COMMENT() throws RecognitionException { try { int _type = RULE_SL_COMMENT; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? { match("//"); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:24: (~ ( ( '\\n' | '\\r' ) ) )* + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:24: (~ ( ( '\\n' | '\\r' ) ) )* loop8: do { int alt8=2; @@ -393,7 +393,7 @@ public class InternalActionTestLanguageLexer extends Lexer { switch (alt8) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:24: ~ ( ( '\\n' | '\\r' ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187: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)<='\uFFFE') ) { input.consume(); @@ -414,7 +414,7 @@ public class InternalActionTestLanguageLexer extends Lexer { } } while (true); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:40: ( ( '\\r' )? '\\n' )? + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:40: ( ( '\\r' )? '\\n' )? int alt10=2; int LA10_0 = input.LA(1); @@ -423,9 +423,9 @@ public class InternalActionTestLanguageLexer extends Lexer { } switch (alt10) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:41: ( '\\r' )? '\\n' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:41: ( '\\r' )? '\\n' { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:41: ( '\\r' )? + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:41: ( '\\r' )? int alt9=2; int LA9_0 = input.LA(1); @@ -434,7 +434,7 @@ public class InternalActionTestLanguageLexer extends Lexer { } switch (alt9) { case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:245:41: '\\r' + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:187:41: '\\r' { match('\r'); @@ -464,10 +464,10 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_WS() throws RecognitionException { try { int _type = RULE_WS; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:247:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:247:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:189:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:189:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:247:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:189:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ int cnt11=0; loop11: do { @@ -520,8 +520,8 @@ public class InternalActionTestLanguageLexer extends Lexer { public final void mRULE_ANY_OTHER() throws RecognitionException { try { int _type = RULE_ANY_OTHER; - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:249:16: ( . ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:249:18: . + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:191:16: ( . ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:191:18: . { matchAny(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageParser.java index 859e4c6..592e45f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguageParser.java @@ -100,200 +100,99 @@ public class InternalActionTestLanguageParser extends AbstractInternalAntlrParse // $ANTLR start ruleModel - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:77:1: ruleModel returns [EObject current=null] : (lv_children_0= ruleElement )* ; + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:77:1: ruleModel returns [EObject current=null] : (this_Child_0= ruleChild ( () (lv_right_2= ruleChild ) )? ) ; public final EObject ruleModel() throws RecognitionException { EObject current = null; - EObject lv_children_0 = null; + EObject this_Child_0 = null; - - EObject temp=null; setCurrentLookahead(); resetLookahead(); - - try { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:82:6: ( (lv_children_0= ruleElement )* ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:83:1: (lv_children_0= ruleElement )* - { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:83:1: (lv_children_0= ruleElement )* - loop1: - do { - int alt1=2; - int LA1_0 = input.LA(1); - - if ( (LA1_0==RULE_ID) ) { - alt1=1; - } - - - switch (alt1) { - case 1 : - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:86:6: lv_children_0= ruleElement - { - - currentNode=createCompositeNode(grammarAccess.prModel().ele0ParserRuleCallElement(), currentNode); - - pushFollow(FOLLOW_ruleElement_in_ruleModel139); - lv_children_0=ruleElement(); - _fsp--; - - - if (current==null) { - current = factory.create(grammarAccess.prModel().getRule().getType().getClassifier()); - associateNodeWithAstElement(currentNode.getParent(), current); - } - - try { - add(current, "children", lv_children_0, "Element", currentNode); - } catch (ValueConverterException vce) { - handleValueConverterException(vce); - } - currentNode = currentNode.getParent(); - - - } - break; - - default : - break loop1; - } - } while (true); - - - } - - resetLookahead(); - lastConsumedNode = currentNode; - - } - - catch (RecognitionException re) { - recover(input,re); - appendSkippedTokens(); - } - finally { - } - return current; - } - // $ANTLR end ruleModel - - - // $ANTLR start entryRuleElement - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:111:1: entryRuleElement returns [EObject current=null] : iv_ruleElement= ruleElement EOF ; - public final EObject entryRuleElement() throws RecognitionException { - EObject current = null; - - EObject iv_ruleElement = null; - - - try { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:111:49: (iv_ruleElement= ruleElement EOF ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:112:2: iv_ruleElement= ruleElement EOF - { - currentNode = createCompositeNode(grammarAccess.prElement().getRule(), currentNode); - pushFollow(FOLLOW_ruleElement_in_entryRuleElement176); - iv_ruleElement=ruleElement(); - _fsp--; - - current =iv_ruleElement; - match(input,EOF,FOLLOW_EOF_in_entryRuleElement186); - - } - - } - - catch (RecognitionException re) { - recover(input,re); - appendSkippedTokens(); - } - finally { - } - return current; - } - // $ANTLR end entryRuleElement - - - // $ANTLR start ruleElement - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:119:1: ruleElement returns [EObject current=null] : (this_Item_0= ruleItem ( () (lv_items_2= ruleItem ) ) ) ; - public final EObject ruleElement() throws RecognitionException { - EObject current = null; - - EObject this_Item_0 = null; - - EObject lv_items_2 = null; + EObject lv_right_2 = null; EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:124:6: ( (this_Item_0= ruleItem ( () (lv_items_2= ruleItem ) ) ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:125:1: (this_Item_0= ruleItem ( () (lv_items_2= ruleItem ) ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:82:6: ( (this_Child_0= ruleChild ( () (lv_right_2= ruleChild ) )? ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:83:1: (this_Child_0= ruleChild ( () (lv_right_2= ruleChild ) )? ) { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:125:1: (this_Item_0= ruleItem ( () (lv_items_2= ruleItem ) ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:126:5: this_Item_0= ruleItem ( () (lv_items_2= ruleItem ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:83:1: (this_Child_0= ruleChild ( () (lv_right_2= ruleChild ) )? ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:84:5: this_Child_0= ruleChild ( () (lv_right_2= ruleChild ) )? { - currentNode=createCompositeNode(grammarAccess.prElement().ele0ParserRuleCallItem(), currentNode); + currentNode=createCompositeNode(grammarAccess.prModel().ele0ParserRuleCallChild(), currentNode); - pushFollow(FOLLOW_ruleItem_in_ruleElement233); - this_Item_0=ruleItem(); + pushFollow(FOLLOW_ruleChild_in_ruleModel128); + this_Child_0=ruleChild(); _fsp--; - current = this_Item_0; + current = this_Child_0; currentNode = currentNode.getParent(); - createLeafNode(grammarAccess.prElement().ele0ParserRuleCallItem(), null); - - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:138:1: ( () (lv_items_2= ruleItem ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:138:2: () (lv_items_2= ruleItem ) - { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:138:2: () - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:139:5: - { - - temp=factory.create(grammarAccess.prElement().ele10ActionItemitems().getType().getClassifier()); - try { - factory.add(temp, "items", current, null /*ParserRule*/, currentNode); - } catch(ValueConverterException vce) { - handleValueConverterException(vce); - } - current = temp; - temp = null; - CompositeNode newNode = createCompositeNode(grammarAccess.prElement().ele10ActionItemitems(), currentNode.getParent()); - newNode.getChildren().add(currentNode); - moveLookaheadInfo(currentNode, newNode); - currentNode = newNode; - associateNodeWithAstElement(currentNode, current); + createLeafNode(grammarAccess.prModel().ele0ParserRuleCallChild(), null); + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:96:1: ( () (lv_right_2= ruleChild ) )? + int alt1=2; + int LA1_0 = input.LA(1); + if ( (LA1_0==RULE_ID) ) { + alt1=1; } + switch (alt1) { + case 1 : + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:96:2: () (lv_right_2= ruleChild ) + { + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:96:2: () + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:97:5: + { + + temp=factory.create(grammarAccess.prModel().ele10ActionParentleft().getType().getClassifier()); + try { + factory.set(temp, "left", current, null /*ParserRule*/, currentNode); + } catch(ValueConverterException vce) { + handleValueConverterException(vce); + } + current = temp; + temp = null; + CompositeNode newNode = createCompositeNode(grammarAccess.prModel().ele10ActionParentleft(), currentNode.getParent()); + newNode.getChildren().add(currentNode); + moveLookaheadInfo(currentNode, newNode); + currentNode = newNode; + associateNodeWithAstElement(currentNode, current); + - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:154:2: (lv_items_2= ruleItem ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:157:6: lv_items_2= ruleItem - { - - currentNode=createCompositeNode(grammarAccess.prElement().ele110ParserRuleCallItem(), currentNode); - - pushFollow(FOLLOW_ruleItem_in_ruleElement283); - lv_items_2=ruleItem(); - _fsp--; + } + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:112:2: (lv_right_2= ruleChild ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:115:6: lv_right_2= ruleChild + { + + currentNode=createCompositeNode(grammarAccess.prModel().ele110ParserRuleCallChild(), currentNode); + + pushFollow(FOLLOW_ruleChild_in_ruleModel178); + lv_right_2=ruleChild(); + _fsp--; + + + if (current==null) { + current = factory.create(grammarAccess.prModel().getRule().getType().getClassifier()); + associateNodeWithAstElement(currentNode.getParent(), current); + } + + try { + set(current, "right", lv_right_2, "Child", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + - if (current==null) { - current = factory.create(grammarAccess.prElement().getRule().getType().getClassifier()); - associateNodeWithAstElement(currentNode.getParent(), current); - } - - try { - add(current, "items", lv_items_2, "Item", currentNode); - } catch (ValueConverterException vce) { - handleValueConverterException(vce); - } - currentNode = currentNode.getParent(); - + } - } + } + break; } @@ -316,28 +215,28 @@ public class InternalActionTestLanguageParser extends AbstractInternalAntlrParse } return current; } - // $ANTLR end ruleElement + // $ANTLR end ruleModel - // $ANTLR start entryRuleItem - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:182:1: entryRuleItem returns [EObject current=null] : iv_ruleItem= ruleItem EOF ; - public final EObject entryRuleItem() throws RecognitionException { + // $ANTLR start entryRuleChild + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:140:1: entryRuleChild returns [EObject current=null] : iv_ruleChild= ruleChild EOF ; + public final EObject entryRuleChild() throws RecognitionException { EObject current = null; - EObject iv_ruleItem = null; + EObject iv_ruleChild = null; try { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:182:46: (iv_ruleItem= ruleItem EOF ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:183:2: iv_ruleItem= ruleItem EOF + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:140:47: (iv_ruleChild= ruleChild EOF ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:141:2: iv_ruleChild= ruleChild EOF { - currentNode = createCompositeNode(grammarAccess.prItem().getRule(), currentNode); - pushFollow(FOLLOW_ruleItem_in_entryRuleItem321); - iv_ruleItem=ruleItem(); + currentNode = createCompositeNode(grammarAccess.prChild().getRule(), currentNode); + pushFollow(FOLLOW_ruleChild_in_entryRuleChild217); + iv_ruleChild=ruleChild(); _fsp--; - current =iv_ruleItem; - match(input,EOF,FOLLOW_EOF_in_entryRuleItem331); + current =iv_ruleChild; + match(input,EOF,FOLLOW_EOF_in_entryRuleChild227); } @@ -351,62 +250,38 @@ public class InternalActionTestLanguageParser extends AbstractInternalAntlrParse } return current; } - // $ANTLR end entryRuleItem + // $ANTLR end entryRuleChild - // $ANTLR start ruleItem - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:190:1: ruleItem returns [EObject current=null] : ( () (lv_name_1= RULE_ID ) ) ; - public final EObject ruleItem() throws RecognitionException { + // $ANTLR start ruleChild + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:148:1: ruleChild returns [EObject current=null] : (lv_name_0= RULE_ID ) ; + public final EObject ruleChild() throws RecognitionException { EObject current = null; - Token lv_name_1=null; + Token lv_name_0=null; EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:195:6: ( ( () (lv_name_1= RULE_ID ) ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:196:1: ( () (lv_name_1= RULE_ID ) ) - { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:196:1: ( () (lv_name_1= RULE_ID ) ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:196:2: () (lv_name_1= RULE_ID ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:153:6: ( (lv_name_0= RULE_ID ) ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:154:1: (lv_name_0= RULE_ID ) { - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:196:2: () - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:197:5: + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:154:1: (lv_name_0= RULE_ID ) + // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:156:6: lv_name_0= RULE_ID { - - temp=factory.create(grammarAccess.prItem().ele0ActionThingcontent().getType().getClassifier()); - try { - factory.set(temp, "content", current, null /*ParserRule*/, currentNode); - } catch(ValueConverterException vce) { - handleValueConverterException(vce); - } - current = temp; - temp = null; - CompositeNode newNode = createCompositeNode(grammarAccess.prItem().ele0ActionThingcontent(), currentNode.getParent()); - newNode.getChildren().add(currentNode); - moveLookaheadInfo(currentNode, newNode); - currentNode = newNode; - associateNodeWithAstElement(currentNode, current); - - - } + lv_name_0=(Token)input.LT(1); + match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleChild273); - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:212:2: (lv_name_1= RULE_ID ) - // ../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g:214:6: lv_name_1= RULE_ID - { - lv_name_1=(Token)input.LT(1); - match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleItem387); - - createLeafNode(grammarAccess.prItem().ele10TerminalRuleCallID(), "name"); + createLeafNode(grammarAccess.prChild().ele0TerminalRuleCallID(), "name"); if (current==null) { - current = factory.create(grammarAccess.prItem().getRule().getType().getClassifier()); + current = factory.create(grammarAccess.prChild().getRule().getType().getClassifier()); associateNodeWithAstElement(currentNode, current); } try { - set(current, "name", lv_name_1, "ID", lastConsumedNode); + set(current, "name", lv_name_0, "ID", lastConsumedNode); } catch (ValueConverterException vce) { handleValueConverterException(vce); } @@ -417,9 +292,6 @@ public class InternalActionTestLanguageParser extends AbstractInternalAntlrParse } - - } - resetLookahead(); lastConsumedNode = currentNode; @@ -433,20 +305,17 @@ public class InternalActionTestLanguageParser extends AbstractInternalAntlrParse } return current; } - // $ANTLR end ruleItem + // $ANTLR end ruleChild public static final BitSet FOLLOW_ruleModel_in_entryRuleModel71 = new BitSet(new long[]{0x0000000000000000L}); public static final BitSet FOLLOW_EOF_in_entryRuleModel81 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleElement_in_ruleModel139 = new BitSet(new long[]{0x0000000000000012L}); - public static final BitSet FOLLOW_ruleElement_in_entryRuleElement176 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleElement186 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleItem_in_ruleElement233 = new BitSet(new long[]{0x0000000000000010L}); - public static final BitSet FOLLOW_ruleItem_in_ruleElement283 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleItem_in_entryRuleItem321 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleItem331 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_RULE_ID_in_ruleItem387 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleChild_in_ruleModel128 = new BitSet(new long[]{0x0000000000000012L}); + public static final BitSet FOLLOW_ruleChild_in_ruleModel178 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleChild_in_entryRuleChild217 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleChild227 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_ID_in_ruleChild273 = new BitSet(new long[]{0x0000000000000002L}); }
\ No newline at end of file diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage__.g b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage__.g index 95cf1f9..f5756cb 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage__.g +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage__.g @@ -7,25 +7,25 @@ package org.eclipse.xtext.testlanguages.parser.antlr.internal; import org.eclipse.xtext.parser.antlr.Lexer; } -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 237 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 179 RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 239 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 181 RULE_INT : ('0'..'9')+; -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 241 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 183 RULE_STRING : ('\"' ('\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')|~(('\\'|'\"')))* '\"'|'\'' ('\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')|~(('\\'|'\'')))* '\''); -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 243 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 185 RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 245 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 187 RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 247 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 189 RULE_WS : (' '|'\t'|'\r'|'\n')+; -// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 249 +// $ANTLR src "../org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/antlr/internal/InternalActionTestLanguage.g" 191 RULE_ANY_OTHER : .; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageDelimiters.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageDelimiters.java index 79562f1..f14dd0c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageDelimiters.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageDelimiters.java @@ -11,6 +11,6 @@ public final class ActionTestLanguageDelimiters { throw new UnsupportedOperationException("Utility classes may not be initialized"); } - public static final ISequenceMatcher ruleCall$20$Delimiter = ISequenceMatcher.Factory.nullMatcher(); + public static final ISequenceMatcher ruleCall$13$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageParserConfiguration.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageParserConfiguration.java index 059b593..cdec56e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageParserConfiguration.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/ActionTestLanguageParserConfiguration.java @@ -10,8 +10,7 @@ import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess; import org.eclipse.xtext.common.parser.packrat.TerminalsParserConfiguration; import org.eclipse.xtext.testlanguages.parser.packrat.consumers.ActionTestLanguageModelConsumer; -import org.eclipse.xtext.testlanguages.parser.packrat.consumers.ActionTestLanguageElementConsumer; -import org.eclipse.xtext.testlanguages.parser.packrat.consumers.ActionTestLanguageItemConsumer; +import org.eclipse.xtext.testlanguages.parser.packrat.consumers.ActionTestLanguageChildConsumer; import org.eclipse.xtext.common.parser.packrat.consumers.TerminalsIDConsumer; import org.eclipse.xtext.common.parser.packrat.consumers.TerminalsINTConsumer; import org.eclipse.xtext.common.parser.packrat.consumers.TerminalsSTRINGConsumer; @@ -24,8 +23,7 @@ public class ActionTestLanguageParserConfiguration extends AbstractParserConfigu private final TerminalsParserConfiguration terminalsConfiguration; private ActionTestLanguageModelConsumer modelConsumer; - private ActionTestLanguageElementConsumer elementConsumer; - private ActionTestLanguageItemConsumer itemConsumer; + private ActionTestLanguageChildConsumer childConsumer; private ActionTestLanguageGrammarAccess grammarAccess; @@ -44,10 +42,7 @@ public class ActionTestLanguageParserConfiguration extends AbstractParserConfigu modelConsumer = new ActionTestLanguageModelConsumer( this, null ); - elementConsumer = new ActionTestLanguageElementConsumer( - this, null - ); - itemConsumer = new ActionTestLanguageItemConsumer( + childConsumer = new ActionTestLanguageChildConsumer( this, null ); } @@ -60,8 +55,7 @@ public class ActionTestLanguageParserConfiguration extends AbstractParserConfigu if (grammarAccess == null) throw new NullPointerException("grammarAccess may not be null, you call configureConsumers"); getModelConsumer().setRule(grammarAccess.prModel()); - getElementConsumer().setRule(grammarAccess.prElement()); - getItemConsumer().setRule(grammarAccess.prItem()); + getChildConsumer().setRule(grammarAccess.prChild()); getIdConsumer().setRule(grammarAccess.trID()); getIntConsumer().setRule(grammarAccess.trINT()); getStringConsumer().setRule(grammarAccess.trSTRING()); @@ -71,13 +65,11 @@ public class ActionTestLanguageParserConfiguration extends AbstractParserConfigu getAnyOtherConsumer().setRule(grammarAccess.trANY_OTHER()); - getModelConsumer().setElementConsumer(getElementConsumer()); - - getElementConsumer().setItemConsumer(getItemConsumer()); + getModelConsumer().setChildConsumer(getChildConsumer()); - getItemConsumer().setIdConsumer(getIdConsumer()); + getChildConsumer().setIdConsumer(getIdConsumer()); - getItemConsumer().setRuleCall$5$Delimiter(org.eclipse.xtext.testlanguages.parser.packrat.ActionTestLanguageDelimiters.ruleCall$20$Delimiter); + getChildConsumer().setRuleCall$2$Delimiter(org.eclipse.xtext.testlanguages.parser.packrat.ActionTestLanguageDelimiters.ruleCall$13$Delimiter); } public TerminalsParserConfiguration getTerminalsConfiguration() { @@ -88,12 +80,8 @@ public class ActionTestLanguageParserConfiguration extends AbstractParserConfigu return modelConsumer; } - public ActionTestLanguageElementConsumer getElementConsumer() { - return elementConsumer; - } - - public ActionTestLanguageItemConsumer getItemConsumer() { - return itemConsumer; + public ActionTestLanguageChildConsumer getChildConsumer() { + return childConsumer; } public TerminalsIDConsumer getIdConsumer() { diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageChildConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageChildConsumer.java new file mode 100644 index 0000000..cba28c7 --- a/dev/null +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageChildConsumer.java @@ -0,0 +1,99 @@ +/* +* generated by Xtext +*/ +package org.eclipse.xtext.testlanguages.parser.packrat.consumers; + +import org.eclipse.emf.ecore.EClassifier; + +import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.RuleCall; + +import org.eclipse.xtext.parser.packrat.consumers.IElementConsumer; +import org.eclipse.xtext.parser.packrat.consumers.INonTerminalConsumerConfiguration; +import org.eclipse.xtext.parser.packrat.consumers.ITerminalConsumer; +import org.eclipse.xtext.parser.packrat.consumers.NonTerminalConsumer; +import org.eclipse.xtext.parser.packrat.matching.ISequenceMatcher; + +import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess.ChildElements; + +public final class ActionTestLanguageChildConsumer extends NonTerminalConsumer { + + private ChildElements rule; + + private ITerminalConsumer idConsumer; + + private IElementConsumer assignment$1$Consumer; + + private IElementConsumer ruleCall$2$Consumer; + + private ISequenceMatcher ruleCall$2$Delimiter; + + protected class Assignment$1$Consumer extends AssignmentConsumer { + + protected Assignment$1$Consumer(final Assignment assignment) { + super(assignment); + } + + @Override + protected IElementConsumer getConsumer() { + return ruleCall$2$Consumer; + } + } + + protected class RuleCall$2$Consumer extends ElementConsumer<RuleCall> { + + protected RuleCall$2$Consumer(final RuleCall ruleCall) { + super(ruleCall); + } + + @Override + protected int doConsume(boolean optional) throws Exception { + return consumeTerminal(idConsumer, "name", false, false, getElement(), getRuleCall$2$Delimiter(), optional); + } + } + + public ActionTestLanguageChildConsumer(INonTerminalConsumerConfiguration configuration, ITerminalConsumer[] hiddenTokens) { + super(configuration, hiddenTokens); + ruleCall$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); + } + + @Override + protected int doConsume() throws Exception { + return assignment$1$Consumer.consume(); + } + + public ChildElements getRule() { + return rule; + } + + public void setRule(ChildElements rule) { + this.rule = rule; + + assignment$1$Consumer = new Assignment$1$Consumer(rule.eleAssignmentName()); + ruleCall$2$Consumer = new RuleCall$2$Consumer(rule.ele0TerminalRuleCallID()); + } + + @Override + protected AbstractRule getGrammarElement() { + return getRule().getRule(); + } + + @Override + protected EClassifier getDefaultType() { + return getGrammarElement().getType().getClassifier(); + } + + public void setIdConsumer(ITerminalConsumer idConsumer) { + this.idConsumer = idConsumer; + } + + public ISequenceMatcher getRuleCall$2$Delimiter() { + return ruleCall$2$Delimiter; + } + + public void setRuleCall$2$Delimiter(ISequenceMatcher matcher) { + ruleCall$2$Delimiter = matcher != null ? matcher : ISequenceMatcher.Factory.nullMatcher(); + } + +} diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageElementConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageElementConsumer.java deleted file mode 100644 index ae82504..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageElementConsumer.java +++ b/dev/null @@ -1,138 +0,0 @@ -/* -* generated by Xtext -*/ -package org.eclipse.xtext.testlanguages.parser.packrat.consumers; - -import org.eclipse.emf.ecore.EClassifier; - -import org.eclipse.xtext.AbstractRule; -import org.eclipse.xtext.Action; -import org.eclipse.xtext.Assignment; -import org.eclipse.xtext.Group; -import org.eclipse.xtext.RuleCall; - -import org.eclipse.xtext.parser.packrat.consumers.IElementConsumer; -import org.eclipse.xtext.parser.packrat.consumers.INonTerminalConsumer; -import org.eclipse.xtext.parser.packrat.consumers.INonTerminalConsumerConfiguration; -import org.eclipse.xtext.parser.packrat.consumers.ITerminalConsumer; -import org.eclipse.xtext.parser.packrat.consumers.NonTerminalConsumer; - -import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess.ElementElements; - -public final class ActionTestLanguageElementConsumer extends NonTerminalConsumer { - - private ElementElements rule; - - private INonTerminalConsumer itemConsumer; - - private IElementConsumer group$1$Consumer; - - private IElementConsumer ruleCall$2$Consumer; - - private IElementConsumer action$4$Consumer; - - private IElementConsumer assignment$6$Consumer; - - private IElementConsumer ruleCall$7$Consumer; - - protected class Group$1$Consumer extends GroupConsumer { - - protected Group$1$Consumer(final Group group) { - super(group); - } - - @Override - protected void doGetConsumers(ConsumerAcceptor acceptor) { - acceptor.accept(ruleCall$2$Consumer); - acceptor.accept(action$4$Consumer); - acceptor.accept(assignment$6$Consumer); - } - } - - protected class RuleCall$2$Consumer extends ElementConsumer<RuleCall> { - - protected RuleCall$2$Consumer(final RuleCall ruleCall) { - super(ruleCall); - } - - @Override - protected int doConsume(boolean optional) throws Exception { - return consumeNonTerminal(itemConsumer, null, false, false, false, getElement(), optional); - } - } - - protected class Action$4$Consumer extends ElementConsumer<Action> { - - protected Action$4$Consumer(final Action action) { - super(action); - } - - @Override - protected int doConsume(boolean optional) throws Exception { - consumeAction(getElement(), true); - return SUCCESS; - } - } - - protected class Assignment$6$Consumer extends AssignmentConsumer { - - protected Assignment$6$Consumer(final Assignment assignment) { - super(assignment); - } - - @Override - protected IElementConsumer getConsumer() { - return ruleCall$7$Consumer; - } - } - - protected class RuleCall$7$Consumer extends ElementConsumer<RuleCall> { - - protected RuleCall$7$Consumer(final RuleCall ruleCall) { - super(ruleCall); - } - - @Override - protected int doConsume(boolean optional) throws Exception { - return consumeNonTerminal(itemConsumer, "items", true, false, false, getElement(), optional); - } - } - - public ActionTestLanguageElementConsumer(INonTerminalConsumerConfiguration configuration, ITerminalConsumer[] hiddenTokens) { - super(configuration, hiddenTokens); - } - - @Override - protected int doConsume() throws Exception { - return group$1$Consumer.consume(); - } - - public ElementElements getRule() { - return rule; - } - - public void setRule(ElementElements rule) { - this.rule = rule; - - group$1$Consumer = new Group$1$Consumer(rule.eleGroup()); - ruleCall$2$Consumer = new RuleCall$2$Consumer(rule.ele0ParserRuleCallItem()); - action$4$Consumer = new Action$4$Consumer(rule.ele10ActionItemitems()); - assignment$6$Consumer = new Assignment$6$Consumer(rule.ele11AssignmentItems()); - ruleCall$7$Consumer = new RuleCall$7$Consumer(rule.ele110ParserRuleCallItem()); - } - - @Override - protected AbstractRule getGrammarElement() { - return getRule().getRule(); - } - - @Override - protected EClassifier getDefaultType() { - return getGrammarElement().getType().getClassifier(); - } - - public void setItemConsumer(INonTerminalConsumer itemConsumer) { - this.itemConsumer = itemConsumer; - } - -} diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageItemConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageItemConsumer.java deleted file mode 100644 index 08c3a1c..0000000 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageItemConsumer.java +++ b/dev/null @@ -1,133 +0,0 @@ -/* -* generated by Xtext -*/ -package org.eclipse.xtext.testlanguages.parser.packrat.consumers; - -import org.eclipse.emf.ecore.EClassifier; - -import org.eclipse.xtext.AbstractRule; -import org.eclipse.xtext.Action; -import org.eclipse.xtext.Assignment; -import org.eclipse.xtext.Group; -import org.eclipse.xtext.RuleCall; - -import org.eclipse.xtext.parser.packrat.consumers.IElementConsumer; -import org.eclipse.xtext.parser.packrat.consumers.INonTerminalConsumerConfiguration; -import org.eclipse.xtext.parser.packrat.consumers.ITerminalConsumer; -import org.eclipse.xtext.parser.packrat.consumers.NonTerminalConsumer; -import org.eclipse.xtext.parser.packrat.matching.ISequenceMatcher; - -import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess.ItemElements; - -public final class ActionTestLanguageItemConsumer extends NonTerminalConsumer { - - private ItemElements rule; - - private ITerminalConsumer idConsumer; - - private IElementConsumer group$1$Consumer; - - private IElementConsumer action$2$Consumer; - - private IElementConsumer assignment$4$Consumer; - - private IElementConsumer ruleCall$5$Consumer; - - private ISequenceMatcher ruleCall$5$Delimiter; - - protected class Group$1$Consumer extends GroupConsumer { - - protected Group$1$Consumer(final Group group) { - super(group); - } - - @Override - protected void doGetConsumers(ConsumerAcceptor acceptor) { - acceptor.accept(action$2$Consumer); - acceptor.accept(assignment$4$Consumer); - } - } - - protected class Action$2$Consumer extends ElementConsumer<Action> { - - protected Action$2$Consumer(final Action action) { - super(action); - } - - @Override - protected int doConsume(boolean optional) throws Exception { - consumeAction(getElement(), false); - return SUCCESS; - } - } - - protected class Assignment$4$Consumer extends AssignmentConsumer { - - protected Assignment$4$Consumer(final Assignment assignment) { - super(assignment); - } - - @Override - protected IElementConsumer getConsumer() { - return ruleCall$5$Consumer; - } - } - - protected class RuleCall$5$Consumer extends ElementConsumer<RuleCall> { - - protected RuleCall$5$Consumer(final RuleCall ruleCall) { - super(ruleCall); - } - - @Override - protected int doConsume(boolean optional) throws Exception { - return consumeTerminal(idConsumer, "name", false, false, getElement(), getRuleCall$5$Delimiter(), optional); - } - } - - public ActionTestLanguageItemConsumer(INonTerminalConsumerConfiguration configuration, ITerminalConsumer[] hiddenTokens) { - super(configuration, hiddenTokens); - ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); - } - - @Override - protected int doConsume() throws Exception { - return group$1$Consumer.consume(); - } - - public ItemElements getRule() { - return rule; - } - - public void setRule(ItemElements rule) { - this.rule = rule; - - group$1$Consumer = new Group$1$Consumer(rule.eleGroup()); - action$2$Consumer = new Action$2$Consumer(rule.ele0ActionThingcontent()); - assignment$4$Consumer = new Assignment$4$Consumer(rule.ele1AssignmentName()); - ruleCall$5$Consumer = new RuleCall$5$Consumer(rule.ele10TerminalRuleCallID()); - } - - @Override - protected AbstractRule getGrammarElement() { - return getRule().getRule(); - } - - @Override - protected EClassifier getDefaultType() { - return getGrammarElement().getType().getClassifier(); - } - - public void setIdConsumer(ITerminalConsumer idConsumer) { - this.idConsumer = idConsumer; - } - - public ISequenceMatcher getRuleCall$5$Delimiter() { - return ruleCall$5$Delimiter; - } - - public void setRuleCall$5$Delimiter(ISequenceMatcher matcher) { - ruleCall$5$Delimiter = matcher != null ? matcher : ISequenceMatcher.Factory.nullMatcher(); - } - -} diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageModelConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageModelConsumer.java index 2aba68d..ee7492d 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageModelConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/packrat/consumers/ActionTestLanguageModelConsumer.java @@ -6,7 +6,9 @@ package org.eclipse.xtext.testlanguages.parser.packrat.consumers; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.Action; import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.Group; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.parser.packrat.consumers.IElementConsumer; @@ -21,21 +23,30 @@ public final class ActionTestLanguageModelConsumer extends NonTerminalConsumer { private ModelElements rule; - private INonTerminalConsumer elementConsumer; + private INonTerminalConsumer childConsumer; - private IElementConsumer assignment$1$Consumer; + private IElementConsumer group$1$Consumer; private IElementConsumer ruleCall$2$Consumer; - protected class Assignment$1$Consumer extends LoopAssignmentConsumer { + private IElementConsumer group$3$Consumer; + + private IElementConsumer action$4$Consumer; + + private IElementConsumer assignment$6$Consumer; + + private IElementConsumer ruleCall$7$Consumer; + + protected class Group$1$Consumer extends GroupConsumer { - protected Assignment$1$Consumer(final Assignment assignment) { - super(assignment); + protected Group$1$Consumer(final Group group) { + super(group); } @Override - protected IElementConsumer getConsumer() { - return ruleCall$2$Consumer; + protected void doGetConsumers(ConsumerAcceptor acceptor) { + acceptor.accept(ruleCall$2$Consumer); + acceptor.accept(group$3$Consumer); } } @@ -47,7 +58,57 @@ public final class ActionTestLanguageModelConsumer extends NonTerminalConsumer { @Override protected int doConsume(boolean optional) throws Exception { - return consumeNonTerminal(elementConsumer, "children", true, false, false, getElement(), optional); + return consumeNonTerminal(childConsumer, null, false, false, false, getElement(), optional); + } + } + + protected class Group$3$Consumer extends OptionalGroupConsumer { + + protected Group$3$Consumer(final Group group) { + super(group); + } + + @Override + protected void doGetConsumers(ConsumerAcceptor acceptor) { + acceptor.accept(action$4$Consumer); + acceptor.accept(assignment$6$Consumer); + } + } + + protected class Action$4$Consumer extends ElementConsumer<Action> { + + protected Action$4$Consumer(final Action action) { + super(action); + } + + @Override + protected int doConsume(boolean optional) throws Exception { + consumeAction(getElement(), false); + return SUCCESS; + } + } + + protected class Assignment$6$Consumer extends AssignmentConsumer { + + protected Assignment$6$Consumer(final Assignment assignment) { + super(assignment); + } + + @Override + protected IElementConsumer getConsumer() { + return ruleCall$7$Consumer; + } + } + + protected class RuleCall$7$Consumer extends ElementConsumer<RuleCall> { + + protected RuleCall$7$Consumer(final RuleCall ruleCall) { + super(ruleCall); + } + + @Override + protected int doConsume(boolean optional) throws Exception { + return consumeNonTerminal(childConsumer, "right", false, false, false, getElement(), optional); } } @@ -57,7 +118,7 @@ public final class ActionTestLanguageModelConsumer extends NonTerminalConsumer { @Override protected int doConsume() throws Exception { - return assignment$1$Consumer.consume(); + return group$1$Consumer.consume(); } public ModelElements getRule() { @@ -67,8 +128,12 @@ public final class ActionTestLanguageModelConsumer extends NonTerminalConsumer { public void setRule(ModelElements rule) { this.rule = rule; - assignment$1$Consumer = new Assignment$1$Consumer(rule.eleAssignmentChildren()); - ruleCall$2$Consumer = new RuleCall$2$Consumer(rule.ele0ParserRuleCallElement()); + group$1$Consumer = new Group$1$Consumer(rule.eleGroup()); + ruleCall$2$Consumer = new RuleCall$2$Consumer(rule.ele0ParserRuleCallChild()); + group$3$Consumer = new Group$3$Consumer(rule.ele1Group()); + action$4$Consumer = new Action$4$Consumer(rule.ele10ActionParentleft()); + assignment$6$Consumer = new Assignment$6$Consumer(rule.ele11AssignmentRight()); + ruleCall$7$Consumer = new RuleCall$7$Consumer(rule.ele110ParserRuleCallChild()); } @Override @@ -81,8 +146,8 @@ public final class ActionTestLanguageModelConsumer extends NonTerminalConsumer { return getGrammarElement().getType().getClassifier(); } - public void setElementConsumer(INonTerminalConsumer elementConsumer) { - this.elementConsumer = elementConsumer; + public void setChildConsumer(INonTerminalConsumer childConsumer) { + this.childConsumer = childConsumer; } } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java index bbfb5c6..dee22b4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java @@ -19,27 +19,12 @@ public class ActionTestLanguageGrammarAccess implements IGrammarAccess { public class ModelElements implements IParserRuleAccess { private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model"); - private final Assignment cAssignmentChildren = (Assignment)rule.eContents().get(1); - private final RuleCall c0ParserRuleCallElement = (RuleCall)cAssignmentChildren.eContents().get(0); - - // not supported - public ParserRule getRule() { return rule; } - - // not supported - public Assignment eleAssignmentChildren() { return cAssignmentChildren; } - - // not supported - public RuleCall ele0ParserRuleCallElement() { return c0ParserRuleCallElement; } - } - - public class ElementElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Element"); private final Group cGroup = (Group)rule.eContents().get(1); - private final RuleCall c0ParserRuleCallItem = (RuleCall)cGroup.eContents().get(0); + private final RuleCall c0ParserRuleCallChild = (RuleCall)cGroup.eContents().get(0); private final Group c1Group = (Group)cGroup.eContents().get(1); - private final Action c10ActionItemitems = (Action)c1Group.eContents().get(0); - private final Assignment c11AssignmentItems = (Assignment)c1Group.eContents().get(1); - private final RuleCall c110ParserRuleCallItem = (RuleCall)c11AssignmentItems.eContents().get(0); + private final Action c10ActionParentleft = (Action)c1Group.eContents().get(0); + private final Assignment c11AssignmentRight = (Assignment)c1Group.eContents().get(1); + private final RuleCall c110ParserRuleCallChild = (RuleCall)c11AssignmentRight.eContents().get(0); // not supported public ParserRule getRule() { return rule; } @@ -48,47 +33,38 @@ public class ActionTestLanguageGrammarAccess implements IGrammarAccess { public Group eleGroup() { return cGroup; } // not supported - public RuleCall ele0ParserRuleCallItem() { return c0ParserRuleCallItem; } + public RuleCall ele0ParserRuleCallChild() { return c0ParserRuleCallChild; } // not supported public Group ele1Group() { return c1Group; } // not supported - public Action ele10ActionItemitems() { return c10ActionItemitems; } + public Action ele10ActionParentleft() { return c10ActionParentleft; } // not supported - public Assignment ele11AssignmentItems() { return c11AssignmentItems; } + public Assignment ele11AssignmentRight() { return c11AssignmentRight; } // not supported - public RuleCall ele110ParserRuleCallItem() { return c110ParserRuleCallItem; } + public RuleCall ele110ParserRuleCallChild() { return c110ParserRuleCallChild; } } - public class ItemElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Item"); - private final Group cGroup = (Group)rule.eContents().get(1); - private final Action c0ActionThingcontent = (Action)cGroup.eContents().get(0); - private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1); - private final RuleCall c10TerminalRuleCallID = (RuleCall)c1AssignmentName.eContents().get(0); + public class ChildElements implements IParserRuleAccess { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Child"); + private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1); + private final RuleCall c0TerminalRuleCallID = (RuleCall)cAssignmentName.eContents().get(0); // not supported public ParserRule getRule() { return rule; } // not supported - public Group eleGroup() { return cGroup; } + public Assignment eleAssignmentName() { return cAssignmentName; } // not supported - public Action ele0ActionThingcontent() { return c0ActionThingcontent; } - - // not supported - public Assignment ele1AssignmentName() { return c1AssignmentName; } - - // not supported - public RuleCall ele10TerminalRuleCallID() { return c10TerminalRuleCallID; } + public RuleCall ele0TerminalRuleCallID() { return c0TerminalRuleCallID; } } private ModelElements pModel; - private ElementElements pElement; - private ItemElements pItem; + private ChildElements pChild; private final GrammarProvider grammarProvider; @@ -117,13 +93,8 @@ public class ActionTestLanguageGrammarAccess implements IGrammarAccess { } // not supported - public ElementElements prElement() { - return (pElement != null) ? pElement : (pElement = new ElementElements()); - } - - // not supported - public ItemElements prItem() { - return (pItem != null) ? pItem : (pItem = new ItemElements()); + public ChildElements prChild() { + return (pChild != null) ? pChild : (pChild = new ChildElements()); } // not supported diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java index a0ee7ae..e127016 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java @@ -16,6 +16,8 @@ public class PluginTestSuite { suite.addTestSuite(org.eclipse.xtext.EcoreUtil2Test.class); suite.addTestSuite(org.eclipse.xtext.GrammarUtilTest.class); suite.addTestSuite(org.eclipse.xtext.XtextGrammarTest.class); + suite.addTestSuite(org.eclipse.xtext.actions.ParserTest.Antlr.class); + suite.addTestSuite(org.eclipse.xtext.actions.ParserTest.Packrat.class); suite.addTestSuite(org.eclipse.xtext.crossrefs.CrossRefTest.class); suite.addTestSuite(org.eclipse.xtext.crossrefs.DefaultScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.crossrefs.LinkingErrorTest.class); diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/testlanguages/ActionTestLanguage.xtext b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/testlanguages/ActionTestLanguage.xtext index 757739c..d0fbfdc 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/testlanguages/ActionTestLanguage.xtext +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/testlanguages/ActionTestLanguage.xtext @@ -6,16 +6,14 @@ * http://www.eclipse.org/legal/epl-v10.html * *******************************************************************************/ - grammar org.eclipse.xtext.testlanguages.ActionTestLanguage with org.eclipse.xtext.common.Terminals - generate actionLang "http://www.eclipse.org/2008/tmf/xtext/ActionLang" +grammar org.eclipse.xtext.testlanguages.ActionTestLanguage with org.eclipse.xtext.common.Terminals - Model: - (children+=Element)*; - - Element returns Type: - Item ( { Item.items+=current } items+=Item ); - - Item returns Type: - { Thing.content=current } name=ID; +generate actionLang "http://www.eclipse.org/2008/tmf/xtext/ActionLang" + +Model: + Child ({Parent.left=current} right=Child)?; + +Child: + name=ID;
\ No newline at end of file |

