Highlighting: KEYWORDS vs FUNCTIONS

General questions about using TextPad

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

Post Reply
User avatar
Bob Stone
Posts: 5
Joined: Fri Sep 12, 2003 12:07 pm

Highlighting: KEYWORDS vs FUNCTIONS

Post by Bob Stone »

My FoxPro syntax file works pretty well <g> with the following problem.

FoxPro functions will not highlight properly unless there is a space between the function name and the first parenthesis of the argument.

Curiously, if a square bracket is used to surround the arguments, it highlights correctly... no space required. FoxPro actually allows the use of square brackets in this way but it is not usual practice.

While the function name does not highlight correctly, the parentheses do highlight correctly, so it appears TextPad recognizes them, but does not recognize that a keyword has ended when it sees the opening (.

I also need to maintain () as brackets as in FoxPro a variable name surrounded by parentheses is a valid expression.
ProMatrix MVP - Life
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

Characters that can be a part of keywords are all letters, plus any others that are included in any of the list of keyword characters. When looking for keywords, TextPad gathers together all consecutive groups of characters that could be part of a keyword, then looks the result up in the keyword tables. This is why "(" is being included with function names, causing the lookup to fail. I guess FoxPro is a language that needs to be treated as a special case.

Keith MacDonald
Helios Software Solutions
User avatar
Bob Stone
Posts: 5
Joined: Fri Sep 12, 2003 12:07 pm

Post by Bob Stone »

Thanks Keith...

I have not included any parentheses in the function names as listed in the keyword lists. They are only in the BracketChars key of the [Syntax] section of the .syn file. As brackets, they always highlight correctly even in function call. This is desireable. They are not included in the KeyWordChars key. (Is KeyWordChars still supported? I don't see it in the help file.)

If I remove them from the BracketChars key, it does not solve the problem.

I opened some C programs, whcih uses the supplied CPP.SYN file and that seems to work for parentheses and functions. Don't see why there should be a difference. I'll play with my syntax file some more...


[/img]
ProMatrix MVP - Life
User avatar
Bob Stone
Posts: 5
Joined: Fri Sep 12, 2003 12:07 pm

Post by Bob Stone »

Found the problem...

I had a keyword section for system function calls that included parentheses, e.g.

SYS(1)
SYS(2)
...

Don't know why this would affect other function names. Confused TexPad anyway <vbg>...

I added SYS to a new Keyword section to get specific colors. I'll also update the VFP syntax file on the TextPad site...
ProMatrix MVP - Life
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

My guess:
All characters that appear in any keyword are treated as word characters - therefore it will affect other functions as the ( in foo(1) is treated as part of the word and therefore foo( is looked up in the keyword lists instead of foo
karovaldas
Posts: 1
Joined: Mon Oct 16, 2006 7:09 pm

Post by karovaldas »

Found the same problem with SPSS syntax. The following keywords had parentheses included and consequently no functions followed by ")" would highlight:

;TEST(ESTIMABLE)
;TEST(LMATRIX)
;TEST(MMATRIX)
;TEST(SSCP)
;TEST(TRANSFORM)

Once these were deactivated with preceding ";" highlighting works like magic.

How do I change the SPSS.syn file in the downloads section of this website?
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

How do I change the SPSS.syn file in the downloads section of this website?
Open the file in a text editor.
I suggest using TEXTPAD.
Edit as needed and save.
Hope this was helpful.............good luck,
Bob
Post Reply