How to include some multiline comments in the model instance ? [message #1862907] |
Fri, 05 January 2024 09:40  |
Eclipse User |
|
|
|
Hi,
My project is processing specific language (una) provided by the supplier tool.
A grammar file has been built to support the language and I built some code to load a una file, validate it then serialize it in xmi.
After I can work on the xmi file with Python to play with the model instance of the una file.
This is an example of the una file I'm parsing. It's simplified, the __TestGroup object contains much more information.
Unison:SyntaxRevision1709.9;
/**
@brief my documentation
**/
__TestGroup test_tg {
}
The grammar is:
UnaFile:
header=Header (una_elements+=UnaElement)*;
Header:
'Unison:SyntaxRevision' version=Decimal ';';
UnaElement:
TestGroup | CommentSection;
CommentSection:
{CommentSection}
comment=ML_COMMENT;
TestGroup:
'__TestGroup' name=ID '{'
'}';
In my Java main, I'm loading the Resource (una file), validate it then serialize it to xmi using the save() method of the Resource class.
My problem is that the comments from my original una file are not present in the xmi.
Is there a way to serialize also the comments ?
I did try in the grammar to have a CommentSection rule which takes terminal ML_COMMENT as value but I think that ML_COMMENT are ignored by the lexer (? not sure if it's the correct word).
Any help would be appreciated.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07908 seconds