Page 1 of 1
Syntax files: language elements beginning with Percent sign
Posted: Tue Nov 11, 2003 4:27 pm
by jimgawn
I am trying to create a syntax file for the ERwin macro language, where every keyword begins with % - the percentage sign. These keywords are not being highlighted as specified.
Is TextPad treating the lines starting with % as comments?
How does one get TextPad to recognize these keywords?
Posted: Tue Nov 11, 2003 6:26 pm
by talleyrand
I'm too lazy to search but you ought to find previous posts detailing people with similar issues. IIRC, you needed to add the character to Other Characters In Words (Configure, Preferences, Document Classes, Syntax)
Posted: Tue Nov 11, 2003 7:29 pm
by jimgawn
Nope, I did search the site for "percent" before posting my question. No results. And I had included the % character as anOther Character In Words. But thanks for mentioning it.
Posted: Tue Nov 11, 2003 8:55 pm
by talleyrand
Congratulations Jim, you've got me stumped and annoyed right now! Previous people had issues with the things like - and $ not working as part of keywords. However, I've altered my sql syntax file to add both a %FOO and FOOD in [keyword 1]. The FOOD shows up a-ok but I can't seem to get %FOO to highlight to save my life. Took my own lousy suggestion of the other character in keyword (which I actually broke out the help to understand what it was for---it's used for including those characters in selected text, who knew?) but that hasn't done anything.
After spending way too much time, here's how I got it to work. I had a percent sign in my OperatorChars which is the mod operator which seems to have preempted the %FOO keyword.
I don't know how I feel about that. As it stands, it doesn't affect me but I could see how it could be an issue if I went to work in the BAR language where keywords and operators shared the same characters. Hmmm Digging through other language syntax files, I didn't see any langauges that I understood that would have collisions between the two domains.
Code: Select all
; based on sqlservertransact.syn by Tony Rabun
C=1
[Syntax]
Namespace1 = 4
IgnoreCase = yes
InitKeyWordChars = A-Za-z_
KeyWordChars = A-Za-z0-9_
BracketChars = {[()]}
OperatorChars = -+*/<>!~%^&|=
PreprocStart =
SyntaxStart =
SyntaxEnd =
CommentStart = /*
CommentEnd = */
SingleComment = --
SingleCommentCol =
SingleCommentAlt = //
SingleCommentColAlt =
StringStart = "
StringEnd = "
StringEsc =
CharStart = '
CharEnd = '
CharEsc =
[Keywords 1]
%FOO
FOOD