Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Couldn't resolve reference to grammer (Two grammers one cannot resolve reference to another)
Couldn't resolve reference to grammer [message #1795343] Thu, 20 September 2018 15:05 Go to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 55
Registered: September 2018
Member
I have two grammars in the same Project.

the second one is referencing the first one like so:

grammar de.bmw.rhmi.Hmi
with de.bmw.rhmi.App
hidden(WS, ML_COMMENT, SL_COMMENT)

however when I run gradle installDist, I get the error:

Couldn't resolve reference to Grammar 'de.bmw.rhmi.App'.

Re: Couldn't resolve reference to grammer [message #1795353 is a reply to message #1795343] Thu, 20 September 2018 18:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
can You please provide a reproducing sample project
How does your workflow and custom gradle script look like


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 20 September 2018 18:51]

Report message to a moderator

Re: Couldn't resolve reference to grammer [message #1795355 is a reply to message #1795353] Thu, 20 September 2018 19:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
can you try something like

language = StandardLanguage {
name = "org.xtext.example.mydsl5.MyDsl"
fileExtensions = "mydsl5"

serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
language = StandardLanguage {
referencedResource="platform:/resource/org.xtext.example.mydsl5/src/org/xtext/example/mydsl5/MyDsl.xtext"
name = "org.xtext.example.mydsl5.MyDsl2"
fileExtensions = "mydsl52"

serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Couldn't resolve reference to grammer [message #1795398 is a reply to message #1795355] Fri, 21 September 2018 11:15 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 55
Registered: September 2018
Member
hey thanks that actually worked!!
I am not getting the dependency error anymore, but now I am getting another error when generating the XText Language.

warning(200): //Users/mehmetcans/Documents/Workspaces/VSCodeXtextExtensionNewNew/de.bmw.rhmi.parent/de.bmw.rhmi/../de.bmw.rhmi/src/main/xtext-gen/de/bmw/rhmi/parser/antlr/internal/InternalHmi.g:1880:3: Decision can match input such as "{'onSelect', '}', 'screen'..'model', 'notificationEvent', 'textModel'..'multimediaConnectionEvent', 'promptEvent', 'popupEvent', 'notificationIconEvent', 'action', 'enum', 'val', 'audioState', 'toolbar', 'calendarListState', 'calendarMonthState', 'location', 'player', 'overlay', 'icState'..'icPopup', 'icWidget'..'logical', 'state', 'popup'}" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
error(201): //Users/mehmetcans/Documents/Workspaces/VSCodeXtextExtensionNewNew/de.bmw.rhmi.parent/de.bmw.rhmi/../de.bmw.rhmi/src/main/xtext-gen/de/bmw/rhmi/parser/antlr/internal/InternalHmi.g:1880:3: The following alternatives can never be matched: 2

72884 [main] INFO text.xtext.generator.XtextGenerator - Generating common infrastructure
72889 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow de.bmw.rhmi.GenerateHmi:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: /Users/mehmetcans/Documents/Workspaces/VSCodeXtextExtensionNewNew/de.bmw.rhmi.parent/de.bmw.rhmi/../de.bmw.rhmi/src/main/xtext-gen/de/bmw/rhmi/parser/antlr/internal/InternalHmiParser.java (No such file or directory)
Re: Couldn't resolve reference to grammer [message #1795400 is a reply to message #1795398] Fri, 21 September 2018 11:40 Go to previous message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 55
Registered: September 2018
Member
here is my current workflow:

module de.bmw.rhmi.GenerateHmi

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {

component = XtextGenerator {
configuration = {
project = StandardProjectConfig {
baseName = "de.bmw.rhmi"
rootPath = rootPath
runtimeTest = {
enabled = true
}
genericIde = {
enabled = true
}
mavenLayout = true
}
code = {
encoding = "UTF-8"
lineDelimiter = "\n"
fileHeader = "/*\n * generated by Xtext \${version}\n */"
}
}
language = StandardLanguage {
name = "de.bmw.rhmi.App"
fileExtensions = "app"

serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
language = StandardLanguage {
referencedResource = "platform:/resource/de.bmw.rhmi/src/main/java/de/bmw/rhmi/App.xtext"
name = "de.bmw.rhmi.Hmi"
fileExtensions = "hmi"

serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
}
}
Previous Topic:String rule to support double quotes inside String
Next Topic:Internal...Parser.java no such file or directory error
Goto Forum:
  


Current Time: Tue Sep 21 17:52:08 GMT 2021

Powered by FUDForum. Page generated in 0.02052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top