Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Documentation generation based on grammar(Xtext Documentation Generation)
Documentation generation based on grammar [message #1820910] Fri, 31 January 2020 12:52 Go to next message
Rob K is currently offline Rob KFriend
Messages: 5
Registered: January 2020
Junior Member
Hi,

I'm trying to generate documentation based on my .Xtext grammar. My example Types.xtext file, located in types/src, has the following line:
Range:
    min = (NUMER|DECIMAL) ',' max = (NUMBER|DECIMAL)


This generates the Range.java file in types/src-gen. This contains among others the method & generated documentation:
/**
 * Returns the value of the '<em><b>Min</b></em>' attribute
 * <!-- begin-user-doc -->
 * <p>
 * If the meaning of the '<em>Min</em>' attribute isn't clear, 
 * there really should be more of a description here...
 * </p>
 * <!-- end-user-doc -->
... {some parts skipped} ...
 */
String getMin();


The default user-doc text implies that you can add some documentation, however since Range.java is entirely generated based on the xtext file editing it would be pointless. I have tried several ways of adding documentation to the xtext file (using the '//' and '/**' annotation methods) but none of these results in the generated files getting documentation.

Is there an official way to generate user doc based on documentation int he xtext file, and if yes, how?

Thanks for your time

[Updated on: Wed, 05 February 2020 06:43]

Report message to a moderator

Re: Documentation generation based on grammar [message #1821025 is a reply to message #1820910] Tue, 04 February 2020 16:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
i dont know of any possibility to do this ootb

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Documentation generation based on grammar [message #1821067 is a reply to message #1821025] Wed, 05 February 2020 06:43 Go to previous messageGo to next message
Rob K is currently offline Rob KFriend
Messages: 5
Registered: January 2020
Junior Member
Christian Dietrich wrote on Tue, 04 February 2020 16:22
i dont know of any possibility to do this ootb


That's too bad, does this mean the official method of adding user-doc is editing generated files? How would I prevent these edits being overwritten by generation?
Re: Documentation generation based on grammar [message #1821070 is a reply to message #1821067] Wed, 05 February 2020 07:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
you can e.g. switch to a manually maintained metamodel.
and then use emf to generate the metamodel yourself.
i think (not tested) it will keep the docs


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Documentation generation based on grammar [message #1821147 is a reply to message #1821070] Thu, 06 February 2020 10:34 Go to previous messageGo to next message
Rob K is currently offline Rob KFriend
Messages: 5
Registered: January 2020
Junior Member
Christian Dietrich wrote on Wed, 05 February 2020 07:05
you can e.g. switch to a manually maintained metamodel.
and then use emf to generate the metamodel yourself.
i think (not tested) it will keep the docs


What is this metamodel? I can't find any information about it
Re: Documentation generation based on grammar [message #1821149 is a reply to message #1821147] Thu, 06 February 2020 10:42 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
i fear if you cannot answer this question yourself the topic is too advanced for you.
xtext does two things with the grammar
- it derived a parser
- it derived a metamodel (ecore file)
you can also maintain the metamodel manually and import it into the grammar instead of generating it.



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Translate Template Proposal Pattern into Xtext Model
Next Topic:Customizing content proposal in Xtext 2.20 for web editors
Goto Forum:
  


Current Time: Fri Dec 04 15:31:37 GMT 2020

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

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

Back to the top