I am new to xtext.
I want to add the following comments.
- ML_COMMENT (from org.eclipse.xtext.common.Terminals)
own comment
/* @var var1 @property property1 */
The following is my attempt code.
grammar org.xtext.example.mydemo.MyDemo with org.eclipse.xtext.common.Terminals
generate myDemo "http://www.xtext.org/example/mydemo/MyDemo"
Model:
(elements+=DocComments)*
;
DocComments hidden(WS, OTHER):
start=StartComment name=VarComment? property=PropertyComment* end=EndComment
;
StartComment: '/**';
EndComment:'*/';
VarComment: key='@var' name=ID;
PropertyComment: key='@property' name=ID;
terminal OTHER: '*';
It seems that ML_COMMENT works and own comment does not work.
How to resolve this problem? Please help.
you can override
ML_COMMENT
to something "else"e.g.
or you dont inherit from terminals but copy the rules (except
ML_COMMENT
)