Syntax highlighting - Infinite "string"

General questions about using TextPad

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

Post Reply
Paul

Syntax highlighting - Infinite "string"

Post by Paul »

Hi there,
I want to make Textpad highlight a whole line based on the presence of a keyword at the start of that line. So if my keyword is "ERROR" and my file contains the line:

ERROR: File not found

Then the whole line appears red, not just the word "ERROR". I'm imagining Perl type expressions here. So my keyword definition might be [start of line]ERROR:[any number of characters]. Is this possible in Textpad? I suppose its very similar to the way single line comments are defined, but I want to define several Keywords, and colour them differently.

I'm using TextPad version 4.5.0.

Cheers,
Paul
Paul

Re: Syntax highlighting - Infinite "string"

Post by Paul »

My mail address is paulb"at"vulcanmachines.com!
smhaus_net

Re: Syntax highlighting - Infinite "string"

Post by smhaus_net »

define the keyword as the start of a line comment. That will highlight the whole line.
Paul

Re: Syntax highlighting - Infinite "string"

Post by Paul »

Yeah I've done that. So that gives me one of my keywords highlighted as a whole line, but what about the rest?

It doesn't work if I insert multiple keywords, all as the start of a line comment.

Eg,

SingleComment = NOTE ERROR WARNING FAILURE

in my .syn file.

Textpad can't parse the line into separate keywords. (Unless there's some kind of separator?) And even if I could do that, I want them to be highlighted in different colours.

My surrent .syn file looks something like:

C=1

[Syntax]
Namespace1 = 4
IgnoreCase = Yes
SyntaxStart = :
SingleComment = ERROR
SingleCommentAlt = FAILURE
StringsSpanLines = Yes


[Keywords 1]
NOTE
[Keywords 2]
WARNING

I'd like to be able to list under the Keyword that the whole line is to be highlighted.

As an aside, what difference does the C/HTML/TEXT/LaTeX type option make? The documentation isn't very clear.

Paul
Post Reply