Xtext: Unable to Resolve Link

I have the following Xtext grammar:

grammar dsl.miniproject.Question2.EclipsePluginLanguage with org.eclipse.xtext.common.Terminals

import "platform:/resource/Question2/model/EclipsePluginModel.ecore" 
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Plugin:
    {Plugin}
    'Plugin' Name = EntityName
    '{'             
        (documentation = Documentation)?
        (functions += Functionality)*
        manifest = Manifest
    '}'
;

Documentation:
    {Documentation}
    'description =' documentation = STRING
;

Manifest:
    {Manifest}
    'manifest'
    '{'
        (dependencies += Dependency)*
        (extensionPoints += ExtensionPoint)*    
        (extensions += Extension)*
    '}'
;

Functionality:
    {Functionality}
    'function' Name = EntityName ';'
;

Dependency:
    {Dependency}
    Name = EntityName '=>' depends = [Plugin|EntityName]
;

Extension:
    {Extension}
    Name = EntityName '->' extends = [ExtensionPoint|EntityName]
;

ExtensionPoint:
    {ExtensionPoint}
    'ExtensionPoint' Name = EntityName 
    '{'
        'ref' functions += [Functionality|EntityName] ';'       
    '}'
;

EntityName:
    ID ('.' ID)*
;

      

However, when writing a sample script ex:

    Plugin x{
        description = "test"

        function f;
        function f2;

        manifest{

            dep1 => x

            ExtensionPoint ep.ep1{
                ref f;
            }

            ext1 -> ep.ep1
        }    
}

      

I am getting the following error:

Could not find plugin link "x". Could not find a reference to functionality "f" .... etc.

This is my first attempt at xtext and I cannot figure out what I am doing wrong

Thanks in advance for your help!

+3


source to share


1 answer


hi you have to call you attributes name

and NOT attributes and name

you have to make sure that the (actual) qualified names in the scope in the place you use it match the terminal rule or data type you are using (in your case EntityName

), alternatively you can changeIQualifiedNameProvider



+2


source







All Articles