Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question regarding "Comments 2" for color syntax o

 
Post new topic   Reply to topic    Community Forum Index -> Java
View previous topic :: View next topic  
Author Message
chaoscreater



Joined: 16 May 2010
Posts: 4

PostPosted: Sun May 16, 2010 3:36 am    Post subject: Question regarding "Comments 2" for color syntax o Reply with quote

Hi all, i'm new to this forum and hope someone can help me out as i'm very new to using Textpad. First off, i'm using the latest version (full) and i'm trying to change the color highlighting of certain keywords for Java, so that it'll make it easier on the eyes to distinguish the codes i'm writing.

First off, for those of you that don't know what i'm talking about, please go to Configure --> Preferences --> Document Classes --> Java --> Colors.

Under the "Item" list, you should see this:

Window background
Bookmarks
Brackets
Characters
Comments
Comments 2


etc etc.....and basically you can setup the colors for the background/foreground for the items in the list so that it makes it easier to look at your code with color so it can make certain parts of the code or keyword or blocks or whatever stand out, so that it makes it easier to look at your codes.



Ok, so what I've done is changed the background color for "Comment" to light yellow so that any Java code that I comment out will stand out in yellow, and so it'll make it easier for me to look at my codes. I did the same for "Comments 2" but use the color red. However, i can't seem to get it working.

I know that to comment out Java codes, you use either:

// (code goes here)

or

/* (code goes here) */


and using either will give me the yellow background, which is correct as that's what i've configured for "Comments". But how do i use it for "Comments 2"???


I hope this makes sense....please help me out, thanks.
Back to top
View user's profile Send private message
chaoscreater



Joined: 16 May 2010
Posts: 4

PostPosted: Sat Jun 05, 2010 3:23 am    Post subject: Reply with quote

no replies huh.....is this forum dead??
Back to top
View user's profile Send private message
Dan_Sitar



Joined: 05 Sep 2010
Posts: 7

PostPosted: Sun Sep 05, 2010 11:50 am    Post subject: Reply with quote

Hey chaoscreater,

It took me a while to figure that one out for myself last year. I wish there was some documentation about the syntax highlight!

Go to Configure --> Preferences --> Document Classes --> Java --> Syntax.

  1. Did you [v] activate the syntax highlight?
  2. Did you choose the proper syntax definition file, i.e. java.syn ?
  3. If ‘yes’ for both questions, then click on the OPEN button.

The "Comments 2" are the Alternative of the regular "Comments", which are the regular ‘CommentStart = ’ and ‘CommentEnd = ’.

Therefore, the "Comments 2" are just ‘CommentStartAlt = ’ and ‘CommentEndAlt = ’. That's all.


Dan_Sitar
Back to top
View user's profile Send private message Visit poster's website
chaoscreater



Joined: 16 May 2010
Posts: 4

PostPosted: Sun Sep 05, 2010 12:17 pm    Post subject: Reply with quote

hi Dan, thanks for replying. I assume you registered just to post this since this is your first post?? I appreciate it man Smile

As for the suggestion, i'm not sure i understand. All i know is, there're 2 ways to create a JAVA comment.

The first is typing:

// (code goes here)



The 2nd is typing:

/* (code goes here) */



so to create Comment2, what do i type??





I like to keep everything organize and easy to see, so if this does work i might switch back to Textpad as i'm now using Notepad++ and found it a lot better, it's so easy to keep track of my code with all its colour configurations & bookmarking.


But anyway, thanks for your reply. It's rather funny to see how this forum has no support itself but other users are the one contributing and helping instead.
Back to top
View user's profile Send private message
Dan_Sitar



Joined: 05 Sep 2010
Posts: 7

PostPosted: Thu Sep 09, 2010 1:17 pm    Post subject: Reply with quote

Hey chaoscreater,
you wrote:
The first is typing: // (code goes here)

// To start a single line comment, add a string of characters
// to one or both of these two Syntax Definitions:

SingleComment ’ = // (used in JAVA, JavaScript, PHP and others)
OR
SingleCommentAlt ’ = # (an alternative used at least in PHP)

then you wrote:
The 2nd is typing: /* (code goes here) */
/*
As for a multiple line comment (or code to be ignored),
add a string of characters to one or both of these
two pairs of Syntax Definitions:

*/
CommentStart ’ =
CommentEnd ’ =
OR
CommentStartAlt ’ = /*
CommentEndAlt ’ = */

NOTE: Whatever combination you choose, Comment2 is always the
...Alt definitions, e.g. ‘ SingleCommentAltand the pair ‘ CommentStart ’ + ‘ CommentEndAlt ’.

So chaoscreater, bottom line for you would be:

CommentStart =
CommentEnd =
CommentStartAlt = /*
CommentEndAlt = */
SingleComment = //
SingleCommentAlt =

Make sure you close ALL your java files and reopen one to see the effect of the changes in your java.syn. But you can keep them open while editing the colors to see the effects on the fly.


you wrote:
I assume you registered just to post this since this is your first post?? I appreciate it man Very Happy

That's right! Now that your are all set up, I can unregister… Wink

Cool Actually, I was looking for more details about the Syntax Definitions and guess what? I just found a document about it that I will post soon as a topic that I'll name:
٩(ૈ̮͂.̮͂ૈٌ)۶ Syntax Definitions 101
̒८̫ ̡̒̃ ʅ

Dan_Sitar &♭⁴∕₄║: ≷ . ♪ ♫♫|♫♩⌒♩. ͡ ♪⌢|♪‿♩ ♪♫‿♫‿|♫‿♫⌢| ̊⌒|♩ ז ♪ ♫♫:║
Back to top
View user's profile Send private message Visit poster's website
chaoscreater



Joined: 16 May 2010
Posts: 4

PostPosted: Thu Sep 09, 2010 11:41 pm    Post subject: Reply with quote

Hi m8, thanks for replying again.

I still dun quite get it, at first i thought you left out the blanks for some of them such as:

CommentStart =
CommentEnd =


but after checking that link you provided at the end, it says to leave it blank.

But if you leave it blank, with no syntax or whatever to show that it's a comment, then how does that work?? Could you give an example?


I already know how to use the "//" and "/* */" as they're the basics. E.g.


// Hello World

the output: Hello World


/* TESTING!! */

the output: TESTING!!



BUT not sure about the other ones...
Back to top
View user's profile Send private message
Dan_Sitar



Joined: 05 Sep 2010
Posts: 7

PostPosted: Sat Oct 30, 2010 1:38 pm    Post subject: Reply with quote

Hey chaoscreater,

Let's recap here to make sure we understand each other:

you wrote:
All i know is, there're 2 ways to create a JAVA comment.

The first is typing: // (code goes here)

The 2nd is typing: /* (code goes here) */

so to create Comment2, what do i type??

By that I understood that you want to set up 2 different colors, e.g.
one color for
Comment: // (code goes here)
another color for Comment2: /* (code goes here) */

My reply was clear for that set up:
I wrote:
So chaoscreater, bottom line for you would be:

CommentStart =
CommentEnd =
CommentStartAlt = /*
CommentEndAlt = */
SingleComment = //
SingleCommentAlt =

Now, according to your last reply:

you wrote:
I already know how to use the "//" and "/* */" as they're the basics. E.g.

// Hello World
the output: // Hello World

/* TESTING!! */
the output: /* TESTING!! */
then
you wrote:
BUT not sure about the other ones...


It depends upon the effect you want to create.

Is it one color for both "
//" and "/* */" as ‘Comment’, then another color for whatever as ‘Comment2’ ?

If that is the case, no problem, you can highlight any text you want between delimiters that you choose just for that purpose. But you have to keep in mind that Java and any other programs will not consider that text as a Comment and will execute it.

As I explained previously, the definitions of
Comment2 always ends with the letters “ Alt ”, e.g.
SingleCommentAlt ’ and the pair ‘ CommentStartAlt ’ + ‘ CommentEndAlt ’.

Example, to highlight
some text (that are not any code) as a Comment2 in a program, I could use the delimiters « some text »

Therefore, in that case, Comment would be:
CommentStart = /*
CommentEnd = */
SingleCommentAlt = //

And the Comment2:
CommentStartAlt = «
CommentEndAlt = »
SingleCommentAlt =

Private Message me if you reply here, then I'll come to check it out.

Dan_Sitar &♭⁴∕₄║: ≷ . ♪ ♫♫|♫♩⌒♩. ͡ ♪⌢|♪‿♩ ♪♫‿♫‿|♫‿♫⌢| ̊⌒|♩ ז ♪ ♫♫:║ http://facebook.com/Dan.Bourdon
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB