CommentBlock

Comments the text in the selection using language-specific commenting (see also SelectLanguage). For languages such as C that do not support parenthesis-style nested comments, any comment-delimiting characters in the selected text will be mangled so that they are no longer parsed as comment characters. For example, if the following C code is selected:

int i=5; /* index */
void bad(void) {}

Then the CommentBlock will replace it with:

/*int i=5; /@*$ index $*@/
- void bad(void) {}*/

In other words, the block would be surrounded with C-style comments '/*', '*/', nested comments would have '@' and '$' inserted to allow for uncommenting and correct nesting, and new lines are replaced by ' - '. Note that if these comments are now included in another CommentBlock command, they will change to '/@@*$' and '$*@@/', so subsequent UnCommandBlock commands will work as expected.

For C++, C++ style comments '//' will be prepended to every line.

Pascal behaves like C, except that the block is surrounded with '{', '}', nested comments will be replaced by '(@*$', '$*@)'.

function foo {my comment};
begin
i := 5;
end; {foo}

Would become:

{function foo (@*$my comment$*@);
- begin
- i := 5;
- end; (@*$foo$*@)}

If there is no selection, CommentBlock treats the current line as the selection.

Related topic:


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.