[antlr-interest] Re: nested comments
nbsherid at secsme.org.au
Wed Jul 6 13:59:40 PDT 2005
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of David Wigg
> Sent: Wednesday, 6 July 2005 9:31 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Re: nested comments
> With reference to recent messages about nested C comments, I am
> not aware that any comments can be nested, eg. something like,
> /* comment
> source code /* nested comment */
> source code
> */ .
> In my (bitter) experience the first closing (*/) after an
> opening (/*) closes the comment.
> Perhaps I misunderstood the meaning of nested here?
> If this is legal please could someone quote any reference
> supporting it.
In C/C++/Java this is true - nesting is not allowed and is ignored, so the
first */ matches.
In some other formal languages (ASN.1 is an example), there is the concept
of nesting; e.g. that the exact number of /* must match the exact number of
*/ before the comment terminates.
PhD research student
Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435
More information about the antlr-interest