SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Topic started by: Wanderer on January 14, 2009, 05:01:36 pm

Title: Adding new language support
Post by: Wanderer on January 14, 2009, 05:01:36 pm
Hello,

Since my new language is quite basic-like, I was hoping to expedite the process of adding support by copying vbscript.e to basicLike.e, and adjusting as necessary.  I have also copied the VB section from vslick.vlx into basicLike.vlx, and load that in basicLike.e.

Generally, the support is working; I have removed support for tokens my language doesn't have, and added tokens my language does.
However, I have run in to a problem with 'Define', as in:

Define monster 666

I have added 'Global' as a keyword for a variable, and those variables are getting tagged.
Global witch as String

I can't figure out how to get 'Define' tokens recognized, though.  I suspect that 'define' already has some sort of meaning in vbscript.e, but I can't figure out where it is used.

Any help would be appreciated...

UPDATE:
I think the problem is in lang_proc_search():
         _str signature_re='[ \t]*([(]{#1[^)]*}[)_][ \t]*|)(as[ \t]*{#2'variable_re'}|=|$)';

I suspect I have to accommodate, in this regex, the 'define' syntax.

UPDATE_2:
Attempt to make the 'as' optional:

#define LANG_WORD_CHARS  'a-zA-Z0-9_$'

         _str signature_re='[ \t]*([(]{#1[^)]*}[)_][ \t]*|)((as[ \t]*{#2'variable_re'}|=|$)|([ \t]*['LANG_WORD_CHARS']*))';

This tags correctly:
Define Move 1
Sub Move()

but does not tag:
Define Move_To  1
Sub Move_To()

In the Defs toolbar,
Define IDS_STRING_1   1
appears as:
IDS
Title: Re: Adding new language support
Post by: Dennis on January 14, 2009, 10:03:27 pm
It would appear that your 'variable_re' is not matching underscore.Ā  Have you changed VBS_WORD_CHARS or variable_re?  In VBScript, underscore can be a line continuation.
Title: Re: Adding new language support
Post by: Wanderer on January 14, 2009, 10:23:36 pm
It seems I did corrupt variable_re somehow; when I restored it from vbscript.e, my modified signature_re seems to be working as desired.

However, I am not getting tagging of local variables, and can't figure out why; local variables are tagged in a .vb file.

Thanks for the reply.  Having this language support -- particularly context tagging -- is very handy.
Title: Re: Adding new language support
Post by: Wanderer on January 16, 2009, 06:55:54 pm
However, I am not getting tagging of local variables, and can't figure out why; local variables are tagged in a .vb file.

Ack.  It appears 'Dim' statements are not being tagged...
Title: Re: Adding new language support
Post by: Dennis on January 20, 2009, 09:04:59 pm
Local variable tagging requires a different callback.  The way tagging works, is we gather basic global symbol information using either a simple proc_search callback, like we have for vbscript, or a list_tags callback, like we do for higher tier languages, such as visual basic or C++.  Local variable tagging is done through a list_locals callback.  Generally, we only do this for languages that have a proc_search, where we can really, reliable determine the context that we are trying to local local variables in.