BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
ih

Community Trekker

Joined:

Sep 30, 2016

Syntax Highlighting

Does anyone have a list of all internal functions and constants used in JSL, or better yet a Lexer or similar file for syntax highlighting?

 

I use git and gitlab for version control of JSL scripts and would like to see syntax highlighting on the  web interface for JSL scripts like for other languages.   Gitlab uses Rogue for syntax highlighting so it is possible to submit highlighting rules (similar to these) to be included in future releases.

1 ACCEPTED SOLUTION

Accepted Solutions
Justin_Chilton

Joined:

Aug 27, 2015

Solution

Re: Syntax Highlighting

Here's a way to get the Function Names and Object (mostly platform) Constructors from the Scripting Index. There's also the Show Commands() function to get a list of all functions (even a few that are not in the SI).

Main Menu( "Scripting Index" );

cmb = Window( "Scripting Index" )[Combo Box( 1 )];
lb1 = Window( "Scripting Index" )[ListBoxBox( 1 )];
lb2 = Window( "Scripting Index" )[ListBoxBox( 2 )];

cmb << Set( Contains( cmb << get Items(), "Functions" ) );

lb1 << Set Selected( 1 );

functionNames = lb2 << get items;

cmb << Set( Contains( cmb << get Items(), "Objects" ) );

objectConstructorNames = lb1 << get items;

// clean up the extra spaces
For( i = 1, i <= N Items( objectConstructorNames ), i++,
	objectConstructorNames[i] = Trim( objectConstructorNames[i] )
);
show( functionNames, "", objectConstructorNames );

Let me know if you get something working!

Justin
5 REPLIES 5
Justin_Chilton

Joined:

Aug 27, 2015

Solution

Re: Syntax Highlighting

Here's a way to get the Function Names and Object (mostly platform) Constructors from the Scripting Index. There's also the Show Commands() function to get a list of all functions (even a few that are not in the SI).

Main Menu( "Scripting Index" );

cmb = Window( "Scripting Index" )[Combo Box( 1 )];
lb1 = Window( "Scripting Index" )[ListBoxBox( 1 )];
lb2 = Window( "Scripting Index" )[ListBoxBox( 2 )];

cmb << Set( Contains( cmb << get Items(), "Functions" ) );

lb1 << Set Selected( 1 );

functionNames = lb2 << get items;

cmb << Set( Contains( cmb << get Items(), "Objects" ) );

objectConstructorNames = lb1 << get items;

// clean up the extra spaces
For( i = 1, i <= N Items( objectConstructorNames ), i++,
	objectConstructorNames[i] = Trim( objectConstructorNames[i] )
);
show( functionNames, "", objectConstructorNames );

Let me know if you get something working!

Justin
pmroz

Super User

Joined:

Jun 23, 2011

Re: Syntax Highlighting

Along related lines, does anyone have the necessary customization file so that Notepad++ displays JSL files with the proper syntax colorization?  

Justin_Chilton

Joined:

Aug 27, 2015

Re: Syntax Highlighting

@pmroz,

Here's a Notepad++ syntax highlighter I just threw together using Notepad++'s built-in tool. It obviously won't work as well as the regular JSL Script Editor, but it might do the job.

Here's a preview:

Capture.PNG 

I had to zip the file since the User Community does not allow uploading XML files.

Justin
ih

Community Trekker

Joined:

Sep 30, 2016

Re: Syntax Highlighting

Nice idea @pmroz and thank you @Justin_Chilton! I didn't even think all the time I spend in Notepad++.  Now I finally have syntax highlighting for .jmpcust and .def files too!

 

If I ever find myself with a free evening I will work on a Lexer for Rogue.  If I submit something I will let you know.

vince_faller

Super User

Joined:

Mar 17, 2015

Re: Syntax Highlighting

@pmroz

I use n++ for pretty much all my development.  

 

Attached is my language for highlighting as well as my parser so you can actually use the function list. It works pretty well.  

funciton list.png