Hello, Hans!

Monday, February 25, 2002, 4:32:40 PM, Hans Hagen wrote
>>Now "/*" and "*/" gets typeset in red, the "*" after "/*" and the text
>>in the comment gets typeset in black and the two remaining "*" get
>>grayed out. Here I would like to have "/*", "*/" and the other stars
>>to be typeset in one color�, be it red or what ever, and the text to
>>be grayed out. I know this is not that easy to accomplish and is more a
>>feature request for the future. But since I am into this now, I
>>thought it would not do any harm, if mentioned it.

HH> if you give me precise specs and example files, i can have a look at it

Well, let's try this: In Java there are three sorts of comments.
The first one is the one-line-comment and is introduced with "//" as
in

// This is an assignment
a = 78

The second one can be used to make a multi-line comment. It is started
with a "/*" and finished with a "*/" as in

/*
 This is a multi-line comment.
 Really!
 */

Those first two sorts of comments are also available in JavaScript, C
and C++.

The third one is a speciality of Java. It is used to produce
JavaDoc-Comments. A tool, called JavaDoc, recognizes these comments
and generates an API-documentation from those comments.
JavaDoc-comments are used just before the definition of
- a class to describe what the class is for and show some simple
examples of how to use it.
- a method to describe what the method is for, to describe what the
meaning of the arguments is and to show simple examples of the usage
of the method.
- a field to (guess what) describe the field is for.
A JavaDoc-comment is started by a "/**". Each line in a JavaDoc-comment
begins with a "*". A JavaDoc-comment is finished by a "*/". An example

/**
 * This method adds to integers.
 *
 * @param a first number
 * @param b second number
 */
public int sum(int a, int b);

Although a JavaDoc-comment may contain some @-keywords and
although some IDEs highlight them differently, it would be to much for
a ConTeXt-document to also have them highlighted differently. That
would be to much eye-candy. Just highlighting the whole contents of a
JavaDoc-comment would be sufficient.
JavaDoc-comments use HTML for the formatting. The JavaDoc-tool
generates the API-documentation in HTML, so the formatting
instructions in a JavaDoc-comment are used directly in the resulting
documentation. But this also should not have any consequence for the
highlighting in ConTeXt.

There are two kinds of highlighting a Java-comment that would look
good and make it clear that it's a comment
- Highlight all of the comment including the markers "//", "/*",
"/**", "*" and "*/" in the same color.
- Highlight the markers and the contents differently. This would bring
a difficulty into it. It would be necessary to differentiate between
the "*" at the start of a JavaDoc-comment-line and a "*" that appears
somewhere in the body of the comment as in
/**
 * 2 * 2 = 4
 */
I would be glad with the first variant, but ConTeXt seems to use the
second one.

As a sample I have included a Java-class.

Does this help?

-- 
Greets
 Robert

Attachment: LoginServlet.java
Description: Binary data

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to