BookmarkSubscribe
Choose Language Hide Translation Bar
ih
ih
Community Trekker

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.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5

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

View solution in original post

pmroz
Super User

Re: Syntax Highlighting

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

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
ih
Community Trekker

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.

0 Kudos
vince_faller
Super User

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 

Vince Faller - Predictum
0 Kudos