RosettaCodeData/Task/Comments/Verbexx/comments.verbexx

93 lines
5.0 KiB
Plaintext

//////////////////////////////////////////////////////////////////////////////////////////////
//
// Line Comments:
// =============
//
@VAR v1 = 10; // Line comments start from the "//" and continue to end of the line.
// (normal code can appear on the same line, before the //)
//
// Line comments can span a complete line, or start in the middle of a line.
///
//// Additional // chars and /* /* /[ ]/ and /] are ignored
//// Line comments can be appear to be nested, since any additional // is ignored.
///
// Note: // can appear in strings without triggering a line comment
// // cannot appear inside an operator (or verbname), since a line comment
// would start
//
/////////////////////////////////////////////////////////////////////////////////////////////
/********************************************************************************************
*
* Block Comments:
* ==============
*
********************************************************************************************/
//*
//* These start with /* and end with the next */ . They cannot be nested, since the first */
//* will end the block comment. For example, the comment, /* /* */ */ would end after the
//* first */. Note that /* is ignored inside a block comment, as are // /[ /] and /].
//*
//* Also note that something like the following will cause trouble in a block comment:
//*
//* /* comments //
//* * more comments // */ (the // does not prevent the */ from ending
//* * (no longer part of the comment) // block comment)
//* */
//*
//* Note: /* can appear in strings without triggering the start of a block comment
//* /* cannot appear inside an operator (or verbname), since a line comment will
//* start, although */ is allowed inside an operator (verbname). Commenting
//* out such a verbname may cause problems.
//*
//* Note: Since string literals are not recognized in block comments, */ appearing
//* in a string literal inside a block comment (perhaps commented-out code)
//* will cause the block comment to end.
//*
//* Note: It is an error to start a block comment and not end it, so that it is still
//* in progresss when the end-of-file is reached.
//*
//* Block comments can appear inside lines of code:
//*
/*1*/@VAR/*2*/v2/*3*/=/*4*/20/*5*/;/*6*/ // a line comment can follow block comments on the
// same line
/[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
/[] []
/[] Nestable Block Comments: []
[] ======================== []/
[] []/
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]/
//[]
//[] These start with /[ and end with the next matching ]/ . Additional occurrences
//[] of /[ ... ]/ can appear inside a nestable block comment. The nestable block comment
//[] will end only when the nest level reaches 0. Note that /* is ignored inside a nestable
//[] block comment, as are */ // and /].
//[]
//[] Nestable block comments can be used to comment out blocks of code containing line
//[] comments or regular comments, and even balanced and well-formed nestable block comments.
//[]
//[] Note: /[ can appear in strings without triggering the start of a block comment.
//[] However, strings literals are not recognized inside a nestable block comment, so
//[] any appearances of /[ and /] inside a string literal in a nestable block commment
//[] will affect the nest level, and may cause problems.
//[]
//[] Note: It is an error to start a nestable block comment and not end it, so that it is
//[] still in progresss when the end of file is reached.
//[]
//[] Nestable block comments can appear inside lines of code:
//[]
/[1]/@VAR/[2]/v3/[3]/=/[4]/30/[5]/;/[6]/ // a line comment can follow nestable block comments
// on the same line
@SAY v1 v2 v3; // should see: 10 20 30
/]
/=================================================================================================\
| |
| /] starts a block comment that lasts until the end of the current file. Everything after |
| the /] is ignored. |
| |
\=================================================================================================/