Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XbaseInterpreter evaluation(Exception: feature was simple feature call but got receiver instead of null)
XbaseInterpreter evaluation [message #1265606] Thu, 06 March 2014 10:04
Ana Farcasi is currently offline Ana FarcasiFriend
Messages: 1
Registered: March 2014
Junior Member
Dear all,

I am working on a DSL for platoons of Lego mindstorms. I am generating code in NXC from the DSL model. In the models I have a command that instructs the robots to move forward for a certain distance. I have a working version of the DSL where the distance is an integer.

Now I switched to a new version of the DSL, where I use the partial language Xbase for the distance attribute of the forward command. In this new language, I the distance is of type XExpression. So, when the user types "forward(10 + 2)" in the DSL, I want to generate code in NXC that moves the robots forward with 12 units.

I have modified the grammar accordingly and I injected the xbase interpreter into the generator. Then I simply used the evaluate method with the XExpression argument on the interpreter. When I type a simple integer as a distance in the forward command, then the Xbase interpreter correctly outputs the integer as a result of the evaluation, but when I write "10 + 2" as the distance in the foward command, I obtain the following exception:

java.lang.IllegalStateException: feature was simple feature call but got receiver instead of null. Receiver: 10
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(
at org.xtext.example.newplatoon.generator.Master.createMasterText(
at org.xtext.example.newplatoon.generator.NewPlatoonGenerator.doGenerate(

In another version I also injected the evaluation context provider and the interpreter, and I used the evaluate method on the interpreter with the XExpression and IEvaluationContext arguments, but I obtain the same exception.

I followed the stack trace and I am not able to grasp the exact problem. I think I am using the interpreter in a wrong way. If anyone could please give me any hints on where the problem could be, I would be really grateful.

Best regards,
Previous Topic:How I can create a generator project for my DSL in Xtext?
Next Topic:Problem with automatic update of a P2 repository
Goto Forum:

Current Time: Sat Dec 05 00:26:30 GMT 2020

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

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

Back to the top