Best way to extend Xtend? [message #812958] |
Sun, 04 March 2012 11:19  |
Eclipse User |
|
|
|
Hi,
I'm trying to extend Xtend (!) with a new XPrimaryExpression. My first attempt was to create a new XText grammar like this:
grammar com.ibm.mwc.xtext.Coava with org.eclipse.xtext.xtend2.Xtend2
and then to override the XPrimaryExpression defined in XBase, something like this:
XPrimaryExpression returns XExpression:
XConstructorCall |
XBlockExpression |
XSwitchExpression |
XFeatureCall |
XLiteral |
XIfExpression |
XForLoopExpression |
XWhileExpression |
XDoWhileExpression |
XThrowExpression |
XReturnExpression |
XTryCatchFinallyExpression |
XParenthesizedExpression |
XMyNewExpression;
The main reason it does not work is XExpression is sealed.
So my question is what is the recommended way to create a grammar based on XTend2?
Thanks
Lionel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Best way to extend Xtend? [message #976805 is a reply to message #976730] |
Thu, 08 November 2012 16:37   |
Eclipse User |
|
|
|
Hi Iuzuz,
it might be that the generated package is wrong. The
XtendProposalProvider is in xtend.ide.contentassist and not in core.ui..
I'm afraid you'll have to adapt that manually
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 08.11.12 21:28, schrieb Iuzuz Denker:
> Hello Xtend-frieds,
> I also want to extend Xtend and try out some ideas. But some things has
> been changed since last message (at least the URLs) and the guidance
> seems not to work any more. I must say I am an Xtext beginner.
>
> Steps, I tried:
>
>
> Installed a new Eclipse with Xtext
> Created a new Xtext project (=4 projects)
> Changed the with-clause to "with org.eclipse.xtend.core.Xtend" -> can't
> resolve the grammar
> Added to the project org.xtext.example.mydsl a manifest dependence to
> ...xtend.core -> the error disappear
> added to the .mwe2 file:
> registerGeneratedEPackage = "org.eclipse.xtend.core.xtend.XtendPackage"
> registerGenModelFile =
> "platform:/resource/org.eclipse.xtend.core/model/Xtend.genmodel"
>
> "Generate Xtext Artifacts" (on the .xtext file) -> Successful (with the
> download)
>
>
> After the (successful) generating there is a compile error in th ..ui
> project:
> Quote:
>> The project was not built since its build path is incomplete. Cannot
>> find the class file for
>> org.eclipse.xtend.core.services.XtendGrammarAccess$ImportElements. Fix
>> the build path then try building this project
>
>
>
> Added to the project org.xtext.example.mydsl a manifest dependences to
> all ..xtend.. and ..xbase.. (without .source)
>
> I get 6 erroros, the base seems to be, the package
> org.eclipse.xtend.core.ui and the class are not in the classpath
> org.eclipse.xtend.core.ui.contentassist.XtendProposalProvider
>
> But if I ctrl-click on it, it is found in one of the dependences.
>
> Have any one a suggestion?
> What do I make wrong?
>
> Thanks, Iuzuz
|
|
|
Re: Best way to extend Xtend? [message #977872 is a reply to message #976805] |
Fri, 09 November 2012 11:53  |
Eclipse User |
|
|
|
Thank you Sebastian,
it helps.
But after generating artifacts again, the problem is again there.
As a workaround I created a class in ...ui/src:
package org.eclipse.xtend.core.ui.contentassist;
public class XtendProposalProvider
extends org.eclipse.xtend.ide.contentassist.XtendProposalProvider {}
Thank you again.
|
|
|
Powered by
FUDForum. Page generated in 0.06054 seconds