Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using user defined classes plus jvm classes
Using user defined classes plus jvm classes [message #1384707] Fri, 30 May 2014 15:24 Go to next message
Marc Kunze is currently offline Marc KunzeFriend
Messages: 6
Registered: May 2014
Junior Member
Hi there,
I've got two questions.
First, I'd like to allow users to reference JVM classes as well as own classes in the language.
Therefore I defined the rule like this
class_ref: ownRef=[Class_name | FULL_IDENTIFIER] | ref=[jvmTypes::JvmTypeReference | FULL_IDENTIFIER];

Which leads to "Decision can match input such as "RULE_ID" using multiple alternatives: 1, 2"
Is there any way to embed both at once into the grammar without changing the language itself?

Second, I changed the rule for testing purposes to only allow JVM Types:
class_ref: ref=[jvmTypes::JvmTypeReference | FULL_IDENTIFIER];

However, if I try to reference some basic JVM classes, I get "Couldn't resolve reference to JvmTypeReference 'java.lang.Object'.". I guess that XText does not have a valid Java Build path (since there is none in the project). How can I add a default JVM implementation to the Build Path so that the XText Editor is able to find it (I am using a custom builder, which does not really need these references)?

Thank you very much for any help Smile
Re: Using user defined classes plus jvm classes [message #1384724 is a reply to message #1384707] Fri, 30 May 2014 17:59 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13469
Registered: July 2009
Senior Member
Hi this is not possible since parsing and lexing are done in
different phases. Maybe you can hook into the linker or infer
something for your type as well or find a syntactic difference


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:xpand version from the xtext releases repository
Next Topic:the formatter and modification in a unit of work
Goto Forum:
  


Current Time: Thu Jun 04 20:15:21 GMT 2020

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

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

Back to the top