Reputation: 11
I am trying to setup a user defined language in notepad++ for a language that uses the letter C on its own line to begin a block of comments and a $ to close the comment.
I have set the following in Comment Style:
Comment open: C
Comment close: $
Using just the letter C as the open character for the comment will work until the letter C is used somewhere else in the code. eg. "device" will begin a comment colored block.
Is there a way to specify that the comment open character needs a \n so only a letter C on its own line and not part of other words will trigger a comment section?
Upvotes: 1
Views: 5957
Reputation: 389
Use
((EOL))
Notepad will understand this as \n in configuration of comment styles whereas \n or \n\n will not work.
Upvotes: 6
Reputation: 41
I'm not sure this question is still current as Notepad++ now seems to have options for where the starting character of the comment must be (eg. start of line) but I had a similar problem.
I needed a comment that could start with && anywhere in the line and finish at the end of the line. So the Comment Style clearly Opened with && but specifying the Close seemed impossible. I tried the normal \n \r /n /r #10; etc but they didn't work.
Finally I found that using the NumPad on the keyboard works (on Windows)! In the Close box hold down the [Alt] key and type in 010 on the numeric keypad. Nothing will appear but the comments now end properly.
If you Export the language to XML you'll find it's saved this as:


in the Keywords, Comments section.
Upvotes: 4