Can my SYNTAX DEFINITION file hilight the following . . .?

General questions about using TextPad

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

Post Reply
User avatar
no.cache
Posts: 165
Joined: Thu May 15, 2003 2:52 pm

Can my SYNTAX DEFINITION file hilight the following . . .?

Post by no.cache »

Following is a clip from one of my ~.syn files, in use as an inventory sheet for supplies that I regularly order (I'm a health insurance agent). The following 10 files, typed exactly as I have them, need to be hilighted. I know Textpad's Syntax Hilighting can do words, but can it also do phrases? If so, how many? If so, where/how do I define these 10 phrases in the ~.syn file?

I've tried it the following way and it obviously doesn't work. Nothing hilights. I'm using Ver. 4.7.0. Thanks!

Skye

- - - - - - - - - - - - - - - - - - - - - - - -
[Keywords 2]
DIR — 2 BAY AREA
DIR — HMO
DIR — 4 SANTA CRUZ & MONTEREY
DIR — 5 SAN JOAQUIN

[Keywords 3]
DIR — I —SAN JOAQUIN
DIR — J —SANTA CLARA
DIR — K —EAST BAY
DIR — L —SAN FRANCISCO & MARIN

[Keywords 4]
DENTAL DIR — C — BAY AREA
DENTAL DIR — D —NAPA & SOLANO

- - - - - - - - - - - - - - - - - - - - - - - -
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

Not possible, sorry.

One idea is to do something like this (change symbols if you want...):
[Syntax]
CommentStart = DIR
CommentEnd = @
CommentStartAlt = DENTAL
CommentEndAlt = #
SingleComment = //
However, you'd need to type the lines slightly differently:
DIR — 2 BAY AREA @
DENTAL DIR — C — BAY AREA #
// this line will also be highlighted as a comment

Another idea is to do is something like this:
[Keywords 2]
DIR
BAY
AREA
HMO
SANTA
CRUZ
MONTEREY
SAN
JOAQUIN


And you'd need to add & to the operators list. Change the syntax coloring of operators and numbers in the TextPad preferences.
User avatar
no.cache
Posts: 165
Joined: Thu May 15, 2003 2:52 pm

Post by no.cache »

Thanks CS. You have me wondering . . . I count 7 opportunities to list something that looks like strings:

SyntaxStart =
SyntaxEnd =
CommentStart =
CommentEnd =
CommentStartAlt =
CommentEndAlt =
SingleComment =
SingleCommentCol =
SingleCommentAlt =
SingleCommentColAlt =
StringStart =
StringEnd =

Could I at least get 7 of the 10 listed here? And how? Thanks!

SKYE
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

The bad news:

SyntaxStart= and SyntaxEnd= are only useful for HTML files, sorry.
SingleCommentCol = and SingleCommentColAlt = are only useful in conjunction with the other strings, so they are also out.
StringStart=, StringEnd=, CharStart=, CharEnd=, StringAlt= do not help either. They can only be a single character (typically the double-quote or single-quote mark).

The Good news:

SingleComment = and SingleCommentAlt = are useful! Any text including and following following the comment character(s) is colored to the end of the line.
CommentStart = and CommentEnd = color any text between the comment character(s) including themselves.
CommentStartAlt = and CommentEndAlt = work the same way.

Examples

CommentStart = /*
CommentEnd = */
CommentStartAlt = cStart
CommentEndAlt = cEnd
SingleComment = REM
SingleCommentAlt = #

This is normal text. # the text is colored as a comment
This is normal text. /* this text is colored
this text is still colored until the closing mark */
Normal text
REM this entire line will be comment colored
This is normal text.
cStart
this is another comment block.
all contents will be colored.
cEnd
Post Reply