Multiline Comment processing [message #997833] |
Tue, 08 January 2013 15:54  |
Eclipse User |
|
|
|
I'm new to xtext, and I'm trying to figure out how to get my DSL going. my DSL essentially lives inside comment blocks, e.g., /** ... */
The comment blocks that begin with two asterisks are the ones that are processed, while the ones with just a single opening asterisk are treated like normal comments.
It took me awhile but I figured out that to process the inside of the comment blocks I need to unhide the ML_COMMENT terminal.
What I want to know how is how to remove the default processing going on where when you hit enter it automatically adds a "*" at the beginning of the next line when inside of a comment. My comment blocks don't have asterisks at the beginning of each line, only at the start and end of the block. I can't figure out where this is being done though and how to stop it.
|
|
|
|
|
Re: Multiline Comment processing [message #998200 is a reply to message #998193] |
Wed, 09 January 2013 09:50  |
Eclipse User |
|
|
|
Ah,
Then your DOC comments are actually parsed. That works.
Sorry about the confusion.
Regards
- henrik
On 2013-09-01 15:37, Nathan M wrote:
> Thanks!!!!
>
> Overriding the method worked.
>
> Quote:
>> If you have both /* */ comments and /** */ comments you probably want
>> to add a terminal with higher priority for the /** */ comment, and
>> call it something like DOC_COMMENT. That would also skip the auto
>> edits which works on ML_COMMENT by default (IIRC).
>
>
> I had tried doing that, but with the presence of either a ML_COMMENT or
> DOC_COMMENT terminal, nothing is parsable. For example, with something like
>
> AnnotationBlock:
> start=BlockStart
> (annotations += Annotatation)*
> end=BlockEnd
> ;
>
> BlockStart: '/**' ;
> BlockEnd: '*/' ;
>
> ...
>
> terminal DOC_COMMENT: '/**' -> '*/';
> terminal ML_COMMENT: '/*' -> '*/';
>
> and source
>
> /**
> @annotation test
> */
>
> It just complains about the whole thing saying extraneous input at EOF.
>
> So i just removed DOC_COMMENT and changed ML_COMMENT to
> terminal ML_COMMENT: '/*'(!'*') -> '*/';
|
|
|
Powered by
FUDForum. Page generated in 0.25298 seconds