Error on retrieval of features in *Generator.xtend [message #1818693] |
Mon, 23 December 2019 12:50 |
Ebert Schoofs Messages: 2 Registered: December 2019 |
Junior Member |
|
|
I'm trying to generate an DSL written in xtext to java using the provided classes and files, but can't retrieve one specific future of one specific rule.
The xtext rule of a Room looks as follows:
Room :
'Room' name=ID
'{'
('cells' ':' '[' cells+=[Cell] (',' cells+=[Cell])* ']')
'}'
;
But when I try to retrieve the cells in *Generator.xtend, it returns an empty array.
My code:
Room «room.name» = new Room();
«FOR cell : room.cells»
Cell «cell.name» = this.getCellFromLoc(«cell.loc_x»,«cell.loc_y»);
«room.name».addCell(«cell.name»);
«cell.name».setRoom(«room.name»);
«ENDFOR»
A room is defined in my DSL as follows:
Room r0
{
cells : [c00,c01,c02]
}
Other features like the name, or the cells of other rules can be retrieved fine. The cells are surely added to the room, because in the validator we can retrieve them fine.
I'm sorry of this is a duplicate question, but I couldn't find it anywhere, not even in the FAQ.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02816 seconds