gpt4 book ai didi

java - Xtext:无法解析引用

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:22:04 24 4
gpt4 key购买 nike

我有以下 Xtext 语法:

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)*
;

但是在编写示例脚本时:

    Plugin x{
description = "test"

function f;
function f2;

manifest{

dep1 => x

ExtensionPoint ep.ep1{
ref f;
}

ext1 -> ep.ep1
}
}

我收到以下错误:

Couldn't resolve reference to Plugin 'x'. Couldn't resolve reference to Functionality 'f'. ... etc

这是我第一次尝试 xtext,我不知道我做错了什么

在此先感谢您的帮助!!

最佳答案

您好,您应该将元素命名为 name 而不是 Name并且您必须确保在您使用它的地方范围内的(实际)限定名称与您使用的终端或数据类型规则相匹配(在您的情况下 EntityName)或者您可以更改 IQualifiedNameProvider

关于java - Xtext:无法解析引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27670698/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com