Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Documentation generation based on grammar(Xtext Documentation Generation)
Documentation generation based on grammar [message #1820910] Fri, 31 January 2020 07:52 Go to next message
Eclipse UserFriend
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 01:43] by Moderator

Re: Documentation generation based on grammar [message #1821025 is a reply to message #1820910] Tue, 04 February 2020 11:22 Go to previous messageGo to next message
Eclipse UserFriend
i dont know of any possibility to do this ootb
Re: Documentation generation based on grammar [message #1821067 is a reply to message #1821025] Wed, 05 February 2020 01:43 Go to previous messageGo to next message
Eclipse UserFriend
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 02:05 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Documentation generation based on grammar [message #1821147 is a reply to message #1821070] Thu, 06 February 2020 05:34 Go to previous messageGo to next message
Eclipse UserFriend
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 05:42 Go to previous message
Eclipse UserFriend
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.

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: Wed Jul 23 16:35:51 EDT 2025

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

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

Back to the top