Search in sources :

Example 6 with GeneratedMetamodel

use of org.eclipse.xtext.GeneratedMetamodel in project xtext-core by eclipse.

the class IdeaPluginGenerator method compilePluginGenXml.

public TextFileAccess compilePluginGenXml(final Grammar grammar) {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("<idea-plugin version=\"2\">");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("<extensions defaultExtensionNs=\"org.eclipse.xtext.idea\">");
            _builder.newLine();
            {
                Iterable<GeneratedMetamodel> _filter = Iterables.<GeneratedMetamodel>filter(grammar.getMetamodelDeclarations(), GeneratedMetamodel.class);
                for (final GeneratedMetamodel generatedMetamodel : _filter) {
                    _builder.append("\t\t");
                    _builder.append("<package");
                    _builder.newLine();
                    _builder.append("\t\t");
                    _builder.append("\t");
                    _builder.append("uri=\"");
                    String _nsURI = generatedMetamodel.getEPackage().getNsURI();
                    _builder.append(_nsURI, "\t\t\t");
                    _builder.append("\"");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t\t");
                    _builder.append("\t");
                    _builder.append("class=\"");
                    String _namespace = GrammarUtil.getNamespace(grammar);
                    _builder.append(_namespace, "\t\t\t");
                    _builder.append(".");
                    String _name = generatedMetamodel.getName();
                    _builder.append(_name, "\t\t\t");
                    _builder.append(".");
                    String _firstUpper = StringExtensions.toFirstUpper(generatedMetamodel.getName());
                    _builder.append(_firstUpper, "\t\t\t");
                    _builder.append("Package\"");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t\t");
                    _builder.append("/>");
                    _builder.newLine();
                }
            }
            _builder.append("\t\t");
            _builder.append("<resourceFactory ");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("type=\"");
            String _head = IterableExtensions.<String>head(IdeaPluginGenerator.this.getLanguage().getFileExtensions());
            _builder.append(_head, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t\t");
            _builder.append("class=\"org.eclipse.xtext.resource.IResourceFactory\"");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("factoryClass=\"");
            TypeReference _extensionFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getExtensionFactory(grammar);
            _builder.append(_extensionFactory, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("/>");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("<resourceServiceProvider");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("uriExtension=\"");
            String _head_1 = IterableExtensions.<String>head(IdeaPluginGenerator.this.getLanguage().getFileExtensions());
            _builder.append(_head_1, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t\t");
            _builder.append("class=\"org.eclipse.xtext.idea.resource.IResourceIdeaServiceProvider\"");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("factoryClass=\"");
            TypeReference _extensionFactory_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getExtensionFactory(grammar);
            _builder.append(_extensionFactory_1, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("/>");
            _builder.newLine();
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("<lang.setup");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("language=\"");
            String _languageID = IdeaPluginGenerator.this._ideaPluginExtension.getLanguageID(grammar);
            _builder.append(_languageID, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t\t");
            _builder.append("implementationClass=\"");
            TypeReference _ideaSetup = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar);
            _builder.append(_ideaSetup, "\t\t\t");
            _builder.append("\"");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("/>");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("</extensions>");
            _builder.newLine();
            _builder.newLine();
            _builder.append("\t");
            _builder.append("<extensions defaultExtensionNs=\"com.intellij\">");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("<psi.treeChangePreprocessor implementation=\"");
            TypeReference _codeBlockModificationListener = IdeaPluginGenerator.this._ideaPluginClassNames.getCodeBlockModificationListener(grammar);
            _builder.append(_codeBlockModificationListener, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("<fileTypeFactory implementation=\"");
            TypeReference _fileTypeFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getFileTypeFactory(grammar);
            _builder.append(_fileTypeFactory, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<stubElementTypeHolder class=\"");
            TypeReference _elementTypeProvider = IdeaPluginGenerator.this._ideaPluginClassNames.getElementTypeProvider(grammar);
            _builder.append(_elementTypeProvider, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension = IdeaPluginGenerator.this.compileExtension(grammar, "lang.ast.factory", TypeReference.typeRef("org.eclipse.xtext.idea.lang.BaseXtextASTFactory"));
            _builder.append(_compileExtension, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_1 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.parserDefinition", IdeaPluginGenerator.this._ideaPluginClassNames.getParserDefinition(grammar));
            _builder.append(_compileExtension_1, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_2 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.findUsagesProvider", TypeReference.typeRef("org.eclipse.xtext.idea.findusages.BaseXtextFindUsageProvider"));
            _builder.append(_compileExtension_2, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_3 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.refactoringSupport", TypeReference.typeRef("org.eclipse.xtext.idea.refactoring.BaseXtextRefactoringSupportProvider"));
            _builder.append(_compileExtension_3, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_4 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.namesValidator", TypeReference.typeRef("com.intellij.lang.refactoring.NamesValidator"));
            _builder.append(_compileExtension_4, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<lang.syntaxHighlighterFactory key=\"");
            String _languageID_1 = IdeaPluginGenerator.this._ideaPluginExtension.getLanguageID(grammar);
            _builder.append(_languageID_1, "\t\t");
            _builder.append("\" implementationClass=\"");
            TypeReference _syntaxHighlighterFactory = IdeaPluginGenerator.this._ideaPluginClassNames.getSyntaxHighlighterFactory(grammar);
            _builder.append(_syntaxHighlighterFactory, "\t\t");
            _builder.append("\" />");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_5 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.braceMatcher", TypeReference.typeRef("com.intellij.lang.PairedBraceMatcher"));
            _builder.append(_compileExtension_5, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_6 = IdeaPluginGenerator.this.compileExtension(grammar, "annotator", TypeReference.typeRef("org.eclipse.xtext.idea.annotation.IssueAnnotator"));
            _builder.append(_compileExtension_6, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<completion.contributor language=\"");
            String _languageID_2 = IdeaPluginGenerator.this._ideaPluginExtension.getLanguageID(grammar);
            _builder.append(_languageID_2, "\t\t");
            _builder.append("\" implementationClass=\"");
            TypeReference _completionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar);
            _builder.append(_completionContributor, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<pom.declarationSearcher implementation=\"");
            TypeReference _pomDeclarationSearcher = IdeaPluginGenerator.this._ideaPluginClassNames.getPomDeclarationSearcher(grammar);
            _builder.append(_pomDeclarationSearcher, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.newLine();
            _builder.append("\t\t");
            CharSequence _compileExtension_7 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.psiStructureViewFactory", TypeReference.typeRef("com.intellij.lang.PsiStructureViewFactory"));
            _builder.append(_compileExtension_7, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<facetType implementation=\"");
            TypeReference _facetType = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar);
            _builder.append(_facetType, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_8 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.documentationProvider", TypeReference.typeRef("org.eclipse.xtext.idea.documentation.IdeaDocumentationProvider"));
            _builder.append(_compileExtension_8, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<colorSettingsPage implementation=\"");
            TypeReference _colorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar);
            _builder.append(_colorSettingsPage, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("<highlightVisitor implementation=\"");
            TypeReference _semanticHighlightVisitor = IdeaPluginGenerator.this._ideaPluginClassNames.getSemanticHighlightVisitor(grammar);
            _builder.append(_semanticHighlightVisitor, "\t\t");
            _builder.append("\"/>");
            _builder.newLineIfNotEmpty();
            _builder.newLine();
            _builder.append("\t\t");
            CharSequence _compileExtension_9 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.formatter", TypeReference.typeRef("com.intellij.formatting.FormattingModelBuilder"));
            _builder.append(_compileExtension_9, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            CharSequence _compileExtension_10 = IdeaPluginGenerator.this.compileExtension(grammar, "lang.commenter", TypeReference.typeRef("com.intellij.lang.CodeDocumentationAwareCommenter"));
            _builder.append(_compileExtension_10, "\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("</extensions>");
            _builder.newLine();
            _builder.append("</idea-plugin>");
            _builder.newLine();
        }
    };
    return this.fileAccessFactory.createTextFile("plugin_gen.xml", _client);
}
Also used : GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 7 with GeneratedMetamodel

use of org.eclipse.xtext.GeneratedMetamodel in project xtext-core by eclipse.

the class XtextGenerator method checkConfigurationInternal.

@Override
protected void checkConfigurationInternal(final Issues issues) {
    this.initialize();
    final MweIssues generatorIssues = new MweIssues(this, issues);
    this.configuration.checkConfiguration(generatorIssues);
    final HashMap<String, Grammar> uris = new HashMap<String, Grammar>();
    for (final XtextGeneratorLanguage language : this.languageConfigs) {
        {
            language.checkConfiguration(generatorIssues);
            Iterable<GeneratedMetamodel> _filter = Iterables.<GeneratedMetamodel>filter(language.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class);
            for (final GeneratedMetamodel generatedMetamodel : _filter) {
                {
                    final String nsURI = generatedMetamodel.getEPackage().getNsURI();
                    boolean _containsKey = uris.containsKey(nsURI);
                    if (_containsKey) {
                        String _name = uris.get(nsURI).getName();
                        String _plus = ((("Duplicate generated grammar with nsURI \'" + nsURI) + "\' in ") + _name);
                        String _plus_1 = (_plus + " and ");
                        String _name_1 = language.getGrammar().getName();
                        String _plus_2 = (_plus_1 + _name_1);
                        generatorIssues.addError(_plus_2);
                    } else {
                        uris.put(nsURI, language.getGrammar());
                    }
                }
            }
        }
    }
}
Also used : GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) XtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage) IXtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage) HashMap(java.util.HashMap) MweIssues(org.eclipse.xtext.xtext.generator.MweIssues) Grammar(org.eclipse.xtext.Grammar)

Example 8 with GeneratedMetamodel

use of org.eclipse.xtext.GeneratedMetamodel in project xtext-core by eclipse.

the class Xtext2EcoreTransformer method getOrComputeReturnType.

private TypeRef getOrComputeReturnType(AbstractRule rule) {
    TypeRef result = rule.getType();
    if (result == null) {
        EClassifier classifier = getClassifierFor(rule);
        if (classifier == null) {
            if (rule.getName() == null)
                return null;
            result = getTypeRef(rule.getName());
        } else
            result = getTypeRef(classifier);
        if (result.getMetamodel() == null) {
            AbstractMetamodelDeclaration bestMatch = null;
            for (AbstractMetamodelDeclaration decl : grammar.getMetamodelDeclarations()) {
                if (decl instanceof GeneratedMetamodel && Strings.isEmpty(decl.getAlias())) {
                    bestMatch = decl;
                    break;
                }
            }
            if (result.getMetamodel() == null)
                result.setMetamodel(bestMatch);
        }
        rule.setType(result);
    }
    return result;
}
Also used : GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) TypeRef(org.eclipse.xtext.TypeRef) EClassifier(org.eclipse.emf.ecore.EClassifier) AbstractMetamodelDeclaration(org.eclipse.xtext.AbstractMetamodelDeclaration)

Example 9 with GeneratedMetamodel

use of org.eclipse.xtext.GeneratedMetamodel in project xtext-core by eclipse.

the class Xtext2EcoreTransformerTest method testBug310122.

@Test
public void testBug310122() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
    _builder.newLine();
    _builder.append("generate myDsl \"http://example.xtext.org/MyDsl\"");
    _builder.newLine();
    _builder.append("Model: Sub1 | name=ID \'somekeyword\';");
    _builder.newLine();
    _builder.append("Sub1 returns Model: \'(\' Model \')\';");
    _builder.newLine();
    final String grammarAsString = _builder.toString();
    final XtextResource resource = this.getResourceFromString(grammarAsString);
    EObject _head = IterableExtensions.<EObject>head(resource.getContents());
    final Grammar grammar = ((Grammar) _head);
    AbstractMetamodelDeclaration _head_1 = IterableExtensions.<AbstractMetamodelDeclaration>head(grammar.getMetamodelDeclarations());
    GeneratedMetamodel generatedMetamodel = ((GeneratedMetamodel) _head_1);
    Assert.assertEquals("myDsl", generatedMetamodel.getName());
    Assert.assertEquals(1, generatedMetamodel.getEPackage().getEClassifiers().size());
    EClassifier _type = this.<EClassifier>type(generatedMetamodel.getEPackage(), "Model");
    EClass createdModel = ((EClass) _type);
    Assert.assertEquals(EcorePackage.Literals.ESTRING, this.<EStructuralFeature>feature(createdModel, "name").getEType());
    EList<AbstractRule> _rules = grammar.getRules();
    for (final AbstractRule rule : _rules) {
        Assert.assertEquals(createdModel, rule.getType().getClassifier());
    }
}
Also used : GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) EClass(org.eclipse.emf.ecore.EClass) EObject(org.eclipse.emf.ecore.EObject) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) EClassifier(org.eclipse.emf.ecore.EClassifier) XtextResource(org.eclipse.xtext.resource.XtextResource) Grammar(org.eclipse.xtext.Grammar) AbstractMetamodelDeclaration(org.eclipse.xtext.AbstractMetamodelDeclaration) AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Example 10 with GeneratedMetamodel

use of org.eclipse.xtext.GeneratedMetamodel in project xtext-core by eclipse.

the class XtextSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == XtextPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtextPackage.ACTION:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_Action(context, (Action) semanticObject);
                    return;
                } else if (rule == grammarAccess.getActionRule()) {
                    sequence_Action(context, (Action) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.ALTERNATIVES:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_Alternatives(context, (Alternatives) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAssignableTerminalRule() || rule == grammarAccess.getParenthesizedAssignableElementRule() || rule == grammarAccess.getAssignableAlternativesRule() || action == grammarAccess.getAssignableAlternativesAccess().getAlternativesElementsAction_1_0()) {
                    sequence_AssignableAlternatives(context, (Alternatives) semanticObject);
                    return;
                } else if (rule == grammarAccess.getEnumLiteralsRule()) {
                    sequence_EnumLiterals(context, (Alternatives) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_TerminalAlternatives_TerminalToken(context, (Alternatives) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.ANNOTATION:
                sequence_Annotation(context, (Annotation) semanticObject);
                return;
            case XtextPackage.ASSIGNMENT:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_Assignment(context, (Assignment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAssignmentRule()) {
                    sequence_Assignment(context, (Assignment) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.CHARACTER_RANGE:
                if (rule == grammarAccess.getCharacterRangeRule()) {
                    sequence_CharacterRange(context, (CharacterRange) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_CharacterRange_TerminalToken(context, (CharacterRange) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.CONJUNCTION:
                sequence_Conjunction(context, (Conjunction) semanticObject);
                return;
            case XtextPackage.CROSS_REFERENCE:
                sequence_CrossReference(context, (CrossReference) semanticObject);
                return;
            case XtextPackage.DISJUNCTION:
                sequence_Disjunction(context, (Disjunction) semanticObject);
                return;
            case XtextPackage.EOF:
                if (rule == grammarAccess.getEOFRule()) {
                    sequence_EOF(context, (EOF) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_EOF_TerminalToken(context, (EOF) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.ENUM_LITERAL_DECLARATION:
                sequence_EnumLiteralDeclaration(context, (EnumLiteralDeclaration) semanticObject);
                return;
            case XtextPackage.ENUM_RULE:
                sequence_EnumRule(context, (EnumRule) semanticObject);
                return;
            case XtextPackage.GENERATED_METAMODEL:
                sequence_GeneratedMetamodel(context, (GeneratedMetamodel) semanticObject);
                return;
            case XtextPackage.GRAMMAR:
                sequence_Grammar(context, (Grammar) semanticObject);
                return;
            case XtextPackage.GROUP:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_ConditionalBranch_Group_PredicatedGroup(context, (Group) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPredicatedGroupRule()) {
                    sequence_PredicatedGroup(context, (Group) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_TerminalGroup_TerminalToken(context, (Group) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.KEYWORD:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_Keyword_PredicatedKeyword(context, (Keyword) semanticObject);
                    return;
                } else if (rule == grammarAccess.getKeywordRule() || rule == grammarAccess.getAssignableTerminalRule() || rule == grammarAccess.getParenthesizedAssignableElementRule() || rule == grammarAccess.getAssignableAlternativesRule() || action == grammarAccess.getAssignableAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getCrossReferenceableTerminalRule() || rule == grammarAccess.getCharacterRangeRule() || action == grammarAccess.getCharacterRangeAccess().getCharacterRangeLeftAction_1_0()) {
                    sequence_Keyword(context, (Keyword) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_Keyword_TerminalToken(context, (Keyword) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPredicatedKeywordRule()) {
                    sequence_PredicatedKeyword(context, (Keyword) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.LITERAL_CONDITION:
                sequence_LiteralCondition(context, (LiteralCondition) semanticObject);
                return;
            case XtextPackage.NAMED_ARGUMENT:
                sequence_NamedArgument(context, (NamedArgument) semanticObject);
                return;
            case XtextPackage.NEGATED_TOKEN:
                if (rule == grammarAccess.getAbstractNegatedTokenRule() || rule == grammarAccess.getNegatedTokenRule()) {
                    sequence_NegatedToken(context, (NegatedToken) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_NegatedToken_TerminalToken(context, (NegatedToken) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.NEGATION:
                sequence_Negation(context, (Negation) semanticObject);
                return;
            case XtextPackage.PARAMETER:
                sequence_Parameter(context, (Parameter) semanticObject);
                return;
            case XtextPackage.PARAMETER_REFERENCE:
                sequence_ParameterReference(context, (ParameterReference) semanticObject);
                return;
            case XtextPackage.PARSER_RULE:
                sequence_ParserRule_RuleNameAndParams(context, (ParserRule) semanticObject);
                return;
            case XtextPackage.REFERENCED_METAMODEL:
                sequence_ReferencedMetamodel(context, (ReferencedMetamodel) semanticObject);
                return;
            case XtextPackage.RULE_CALL:
                if (rule == grammarAccess.getAlternativesRule() || action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getConditionalBranchRule() || rule == grammarAccess.getUnorderedGroupRule() || action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0() || rule == grammarAccess.getGroupRule() || action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getAbstractTokenRule() || rule == grammarAccess.getAbstractTokenWithCardinalityRule() || rule == grammarAccess.getAbstractTerminalRule() || rule == grammarAccess.getParenthesizedElementRule()) {
                    sequence_AbstractTokenWithCardinality_PredicatedRuleCall_RuleCall(context, (RuleCall) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPredicatedRuleCallRule()) {
                    sequence_PredicatedRuleCall(context, (RuleCall) semanticObject);
                    return;
                } else if (rule == grammarAccess.getRuleCallRule() || rule == grammarAccess.getAssignableTerminalRule() || rule == grammarAccess.getParenthesizedAssignableElementRule() || rule == grammarAccess.getAssignableAlternativesRule() || action == grammarAccess.getAssignableAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getCrossReferenceableTerminalRule()) {
                    sequence_RuleCall(context, (RuleCall) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalRuleCallRule()) {
                    sequence_TerminalRuleCall(context, (RuleCall) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_TerminalRuleCall_TerminalToken(context, (RuleCall) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.TERMINAL_RULE:
                sequence_TerminalRule(context, (TerminalRule) semanticObject);
                return;
            case XtextPackage.TYPE_REF:
                sequence_TypeRef(context, (TypeRef) semanticObject);
                return;
            case XtextPackage.UNORDERED_GROUP:
                sequence_AbstractTokenWithCardinality_UnorderedGroup(context, (UnorderedGroup) semanticObject);
                return;
            case XtextPackage.UNTIL_TOKEN:
                if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_TerminalToken_UntilToken(context, (UntilToken) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAbstractNegatedTokenRule() || rule == grammarAccess.getUntilTokenRule()) {
                    sequence_UntilToken(context, (UntilToken) semanticObject);
                    return;
                } else
                    break;
            case XtextPackage.WILDCARD:
                if (rule == grammarAccess.getTerminalAlternativesRule() || action == grammarAccess.getTerminalAlternativesAccess().getAlternativesElementsAction_1_0() || rule == grammarAccess.getTerminalGroupRule() || action == grammarAccess.getTerminalGroupAccess().getGroupElementsAction_1_0() || rule == grammarAccess.getTerminalTokenRule() || rule == grammarAccess.getTerminalTokenElementRule() || rule == grammarAccess.getParenthesizedTerminalElementRule()) {
                    sequence_TerminalToken_Wildcard(context, (Wildcard) semanticObject);
                    return;
                } else if (rule == grammarAccess.getWildcardRule()) {
                    sequence_Wildcard(context, (Wildcard) semanticObject);
                    return;
                } else
                    break;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) UnorderedGroup(org.eclipse.xtext.UnorderedGroup) Group(org.eclipse.xtext.Group) Action(org.eclipse.xtext.Action) EnumLiteralDeclaration(org.eclipse.xtext.EnumLiteralDeclaration) Negation(org.eclipse.xtext.Negation) TypeRef(org.eclipse.xtext.TypeRef) RuleCall(org.eclipse.xtext.RuleCall) EPackage(org.eclipse.emf.ecore.EPackage) Assignment(org.eclipse.xtext.Assignment) EnumRule(org.eclipse.xtext.EnumRule) GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) LiteralCondition(org.eclipse.xtext.LiteralCondition) Wildcard(org.eclipse.xtext.Wildcard) UnorderedGroup(org.eclipse.xtext.UnorderedGroup) Conjunction(org.eclipse.xtext.Conjunction) NamedArgument(org.eclipse.xtext.NamedArgument) EOF(org.eclipse.xtext.EOF) ReferencedMetamodel(org.eclipse.xtext.ReferencedMetamodel) Keyword(org.eclipse.xtext.Keyword) ParameterReference(org.eclipse.xtext.ParameterReference) Grammar(org.eclipse.xtext.Grammar) Alternatives(org.eclipse.xtext.Alternatives) Annotation(org.eclipse.xtext.Annotation) Disjunction(org.eclipse.xtext.Disjunction) Parameter(org.eclipse.xtext.Parameter) CrossReference(org.eclipse.xtext.CrossReference) CharacterRange(org.eclipse.xtext.CharacterRange) UntilToken(org.eclipse.xtext.UntilToken) NegatedToken(org.eclipse.xtext.NegatedToken) TerminalRule(org.eclipse.xtext.TerminalRule)

Aggregations

GeneratedMetamodel (org.eclipse.xtext.GeneratedMetamodel)14 Grammar (org.eclipse.xtext.Grammar)8 EObject (org.eclipse.emf.ecore.EObject)6 AbstractMetamodelDeclaration (org.eclipse.xtext.AbstractMetamodelDeclaration)6 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 EPackage (org.eclipse.emf.ecore.EPackage)4 Test (org.junit.Test)4 EClassifier (org.eclipse.emf.ecore.EClassifier)3 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)3 EnumRule (org.eclipse.xtext.EnumRule)3 ReferencedMetamodel (org.eclipse.xtext.ReferencedMetamodel)3 XtextResource (org.eclipse.xtext.resource.XtextResource)3 EClass (org.eclipse.emf.ecore.EClass)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)2 AbstractRule (org.eclipse.xtext.AbstractRule)2 EnumLiteralDeclaration (org.eclipse.xtext.EnumLiteralDeclaration)2 TypeRef (org.eclipse.xtext.TypeRef)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1