Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Inheritance issues in the grammar
Inheritance issues in the grammar [message #685336] Fri, 17 June 2011 09:52 Go to next message
Daniel Santos is currently offline Daniel SantosFriend
Messages: 5
Registered: June 2011
Junior Member
I am working on the grammar and I would like that a type is inherit from common one.
That you can follow my problem here is my grammar:

CommonType:
(AType | BType)
{
"property1" : STRING &
"property2" : STRING &
.....
}
"}";

AType:
"aType:" name=ID "{"
(properties=ATypeProperties)?;

BType:
"bType:" name=ID "{"
(properties=BTypeProperties)?;

ATypeProperties:
.....

BTypeProperties:
....

After generating the grammar model are the Classes AType and BType inherit from CommonType which I like to have. By using this approach the editor in which I use my grammar is source code folding but also text formatting not working properly. The text section folding is only between AType and their properties but not the complet AType element.

Example:

1 | aType: xxxx
2 | {
3 | properties
4 | {
5 | p1:"test"
6 | }
7 | property1:value1
8 | property2:value2
9 |}

Whenever you collapse the element "aType" it will folding from line 1 to 6 and not the total text block.

Can someone help me out on this?
Re: Inheritance issues in the grammar [message #685367 is a reply to message #685336] Fri, 17 June 2011 11:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

a grammar that is actually parseable would help to solve the problem.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Inheritance issues in the grammar [message #685866 is a reply to message #685367] Mon, 20 June 2011 12:50 Go to previous messageGo to next message
Daniel Santos is currently offline Daniel SantosFriend
Messages: 5
Registered: June 2011
Junior Member
So, here is a nice example:


Vehicle:
(Bus | Truck)
"plate:" plate=ID
"model:" model=STRING
"}";

Bus:
"bus:" "{"
"seats:" seats=INT;

Truck:
"truck:" "{"
"maxlength:" maxlenght=INT;

=>

bus: {
seats: 3
plate: LU133223
model: "Audi"
}

Whenever you try to folding the bus element it will collapse just one line of it.
Re: Inheritance issues in the grammar [message #685870 is a reply to message #685866] Mon, 20 June 2011 13:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

maybe this is a bug / not supported usecase in org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Inheritance issues in the grammar [message #685890 is a reply to message #685870] Mon, 20 June 2011 14:22 Go to previous messageGo to next message
Daniel Santos is currently offline Daniel SantosFriend
Messages: 5
Registered: June 2011
Junior Member
What can I do to let this issue be fixed? Create a bug?
Re: Inheritance issues in the grammar [message #685899 is a reply to message #685890] Mon, 20 June 2011 15:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:keywords & identifiers
Next Topic:'without object instantiation warning'
Goto Forum:
  


Current Time: Thu Apr 25 10:04:42 GMT 2024

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

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

Back to the top