Syntax highlighting - comments

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Mattias Ohman

Syntax highlighting - comments

Post by Mattias Ohman »

I am using Textpad version 4.4.1, and having problems with getting the SingleComment tag to work as I want it to - with .asp syntax.

I downloaded all 3 versions of the .asp syntax files from your site, but none of them
seem to work with that tag.

[Syntax]
Namespace1 =
IgnoreCase = Yes
InitKeyWordChars = A-Za-z!
KeyWordChars = A-Za-z0-9_-
PreprocStart =
SyntaxStart = <%
SyntaxEnd = %>
CommentStart = <!--
CommentEnd = -->
CommentStartAlt =
CommentEndAlt =
SingleComment = '
SingleCommentCol =
SingleCommentEsc =
StringStart = "
StringEnd = "
StringAlt =
StringEsc =
CharStart =
CharEnd =
CharEsc =

This is the beginning of my highlighting file.

My goal is to create comments by using the VB syntax, once I place a ' somewhere in a line I want Textpad to mark that sign and everything behind it until a new line begins.

As my syntax file is made at the moment, I am getting the syntax highlighted - but it does not end at the end of a line - it carries on with the syntax highlighting until it finds another ' or something else that Textpad wants to highlight.

Is it possible to create those single line comments that I want?
Chad M. Kovac

Re: Syntax highlighting - comments

Post by Chad M. Kovac »

I have the same problem with the single comment tag in Textpad and ASP files... it seems to react strangely to the line below... unhighlighting the items below it...

In:

'This is a comment
dim Something
dim SomethingElse

The comment is highlighted correctly, but the next two lines are ignored.

In:

dim Something 'This is a comment
dim SomethingElse

the first DIM is highlighted, but the second is ignored. The comment is highlighted.


Here's the top of my asp SYN:

C=1

[Syntax]
Namespace1 = 6
IgnoreCase = Yes
InitKeyWordChars = A-Za-z!
KeyWordChars = A-Za-z0-9_-
OperatorChars = +-/*()%
BracketChars = ()
SyntaxStart =<
SyntaxEnd =>
CommentStart = <!--
CommentEnd = -->
CommentStartAlt ='
CommentEndAlt =
SingleComment ='
SingleCommentCol =1
StringStart = "
StringEnd = "
StringAlt =
StringEsc =
CharStart =&
CharEnd =;
CharEsc =
J.R. Farrar

Re: Syntax highlighting - comments

Post by J.R. Farrar »

Does anyone have a fix for this? I searched through the archives and could not find anything. I would like my single tic .asp files to color correctly also.

Thanks.
Mattias Ohman

Re: Syntax highlighting - comments

Post by Mattias Ohman »

Actually, I think I figured out what the problem was. (at least for me)

By default (I think.. otherwise I probably did it myself), *.asp files are opened with HTML syntax which isn't the best suited syntax for coloring asp files.

If you haven't already, download the asp syntax highlighting file asp3.zip from the Textpad site (http://www.textpad.com/add-ons/files/syntax/asp3.zip) and store it somewhere on your drive.

Next, in Textpad go to Configure - Preferences - Document Classes, highlight HTML and remove the *.asp from the box "Files in class". Apply that. Next, close all documents open in Textpad and go to Configure - Preferences - Document Classes, and create a new document class for your asp files. Then go to that new document class, add *.asp to "Files in class" and do not forget to enable syntax highlighting and point out the asp3.syn file you just downloaded and then make the other possibly changes you might want. Ok that.

Now you can open any file with the extension *.asp, and hopefully Textpad will highlight it nicely. :-)
Post Reply