I'm having problems with the serializer inserting comments. I'm using the standard "SL_COMMENT" and "ML_COMMENT" rules. As an example, my SL_COMMENT rule is:
terminal SL_COMMENT:
'--' !('\n' | '\r')* ('\r'? '\n')?;
A single comment in this place is missing in the serialized output:
Input:
suite "mysuite" is
-- single-line-comment
subprogram x() is end subprogram;
end suite;
Output:
suite "mysuite" is
subprogram x ( ) is
end subprogram;
end suite;
But placing is here causes a duplication:
Input:
suite "mysuite" is
subprogram x() is end subprogram;
-- single-line-comment
end suite;
Output:
suite "mysuite" is -- single-line-comment
subprogram x ( ) is
end subprogram; -- single-line-comment
end suite;
Finally, placing the comment inside the 'subprogram' element works as expected:
suite "mysuite" is
subprogram x ( ) is -- single-line-comment
end subprogram;
end suite;
The "Suite" rule is pretty straightforward:
Suite:
'suite' name=STRING 'is'
subprograms+=Subprogram*
'end' 'suite' ';'
;
Any thoughts? I don't think that I've overriden any of the relevant classes.