creating new syntax file

Discuss syntax highlighting or submit new syntax files.
Post Reply
User avatar
DerellLicht1
Posts: 136
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

creating new syntax file

Post by DerellLicht1 »

Hi all;
I'm new to RJTE, but everything seems to be working pretty well, as I'm learning how to handle various things here...

Now, I want to create syntax files for a new extension, .rc (Windows resource file).
I'm looking in C:\Users\dan7m\AppData\Roaming\RJ TextEd\Syntax
and am planning to use .cpp as reference files; so I see the following files, and have guessed their purposes as shown here:

_list.ver: I *think* this just documents who has created the files for each extension (??)
cpp.ini: defines AutoComplete, UserMenu, Comment (header block?),Sample, Hints
I'm not actually sure what any of these do, except for Sample, which I've seen somewhere...
cpp.syx: This looks like the core config file, where I add my keywords and other config entries

So I have a few questions before I dive into this:
1. Do I need to do anything other than create rc.syx in the Syntax folder, and then re-start RJTE ??
2. Will I be able to edit rc.syn *in* RJTE, without confusing anyone??
3. Can I initially skip rc.ini for now, since I don't think I need any of those categories?
If not, what are the minimum entries will I need there?

Thank ye all for your support up until now!!
User avatar
pjj
Posts: 2108
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: creating new syntax file

Post by pjj »

The pursuit of knowledge, brother, is the askin’ of many questions.
Raymond Chandler, Farewell, My Lovely
Try Tools > Syntax editor > New; it's a dedicated syntax editor, you can define the needed syntax with it. You can also open appropriate file and save it with a new name in ..:\Users\%username%\AppData\Roaming\RJ TextEd\syntax\User defined dir.

Then go to Environment > Add-ons > Highlighters, switch your newly created one on and add file extension(s).

Then you may want to go to Environment > Themes > Customize and tune colors of your theme.

I don't really know much about creation of syntax files, but what I wrote above should give you a (hopefully) good start.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
DerellLicht1
Posts: 136
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

Re: creating new syntax file

Post by DerellLicht1 »

Well, first try did not work at all, at least so far...
Here's what I did...

> loaded cpp.syx into Syntax Editor
> saved as rc.syx (in User Defined folder)
> In Keywords:Keywords, deleted all the .cpp keywords and added a useful set of .rc keywords to the list,
then saved the file; verified that rc.syx is being updated and cpp.syx is *not* !!
> Updated Author information:
1. set File extensions to .rc (removed all .cpp extensions)
2. set Syntax: field in Author Info to Rc
> saved file again
> closed and re-opened TextEd

However, *no* keyword colors are being set in the .rc file, though they are set in the .cpp file.
I have used Highlighters: All Languages to set colors, so (unless I'm mis-understanding the logic here), .rc keywords should be using the same color as .cpp keywords, yes??

Part of my confusion is, I don't know if it isn't actually recognizing the .rc file, or the syntax file for .rc, or if it is simply not setting keyword colors as I intend, in the .rc file...

Help ?!?! :(
User avatar
pjj
Posts: 2108
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: creating new syntax file

Post by pjj »

Assuming that highlighter drop-down in the main toolbar proudly shows "RC", indicating that your freshly created syntax file is actually being used, I don't have idea right now what could have gone wrong... Maybe post your syx file here, and a sample .rs file to check it on?
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
DerellLicht1
Posts: 136
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

Re: creating new syntax file

Post by DerellLicht1 »

pjj wrote: 28 Jul 2021 06:58 Assuming that highlighter drop-down in the main toolbar proudly shows "RC", indicating that your freshly created syntax file is actually being used, I don't have idea right now what could have gone wrong...
Aha! That was it... Once I changed that highlighter menu to 'rc', then my syntax highlighting showed up...

What I had to do, in that menu, was select 'other' at the bottom, and click on my new highlighter...
That caused 'rc' to appear in the main highlighter menu, and now it works for *all* .rc files, including newly-loaded ones...

So that is simply one more step that needs to be added to the 'new syntax file' procedure...

Thank you again, pjj !!
User avatar
pjj
Posts: 2108
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: creating new syntax file

Post by pjj »

Cool, I'm glad to hear your syntax works! :-D
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply