Syntax Highlighting - single-quote commenting

General questions about using TextPad

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

Post Reply
Tyriel
Posts: 25
Joined: Wed Jul 16, 2003 6:20 pm

Syntax Highlighting - single-quote commenting

Post by Tyriel »

Hi there,

i've recently (which is to say this hasn't always happened) been having a problem with instances of textpad on some machines. Using both the supplied ASP.syn and other downloadable ones like aspjshtml, the SingleComment directive for ASP is not getting highlighted properly.

Worse, since the comment character for ASP is a single quote, this is turning my scripts into looking like random portions of commented and uncommented code: every other comment I make, everything in between the two comments is interpreted as a string. This is even more confusing because nowhere in the ASP syntax definition is a single quote defined as a string delimiter. It's like it's interpreting these things as strings by total magic.

Can anyone tell me what's going on here? Thanks,

Steve
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
-Steve Estes (Tyriel)
AIM: EnderW271
ICQ: 6854118
Email: destes[at]ix.netcom.com
Tyriel
Posts: 25
Joined: Wed Jul 16, 2003 6:20 pm

Post by Tyriel »

Figured it out - somehow the HTML class had reacquired *.asp and *.php as members, and was taking precedence.

I now have a new question: if i'm modifying a syntax file, how can I get it to only interpret a particular attribute (say, SingleComment) within a certain set of syntax delimiters (say, <% ... %>), and otherwise treat it as something else (say, a string). Specifically, I want the logic to go like this:

Code: Select all

If we encounter a single quote ( ' ):
   If we are inside a <% ... %> block
      then treat as SingleComment
   Else
      then treat as CharStart / CharEnd
It seems that using SyntaxStart / SyntaxEnd removes all possibility of handling things outside of those syntax tags (like, say, HTML). Are there any alternative directives I can use to make the .syn file tell TP to interpret things differently inside or outside a set of syntax tags?

Thanks,

Steve
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
-Steve Estes (Tyriel)
AIM: EnderW271
ICQ: 6854118
Email: destes[at]ix.netcom.com
cycloid
Posts: 6
Joined: Fri Jul 22, 2005 9:49 am

Post by cycloid »

i post comments in vbscript with two single quotes thus

Code: Select all

'' this is a comment
'this is a string'
this is somewhat similar to c-syntax comments:

Code: Select all

//this is a comment
just that your finger presses a different key twice.

then you can set

Code: Select all

SingleComment = ''
in your .syn file
Post Reply