Page 1 of 1

How to edit a lexer

Posted: 11.09.2024 11:42
by sl23
I am using the Rainmeter lexer for INI files, but am wanting to change how it shows a Section. I really don't know anything about adjusting lexers though.
EG, currently, the Rainmeter lexer shows a Section in one of two ways.
1. A section named like this: [MySectionName] shows correctly, nicely highlighted easy to see when scanning through a file.
2. But, a section name like this: [My Section Name] or with any symbols in like this: [My-Section.Name] causes it to display as normal text with highlighted brackets and not in bold.

The lexer I used to use for INI files works better and always shows the Section name bold and highlighted.
Is there any way to adjust the Rainmeter lexer without affecting the rest of the highlighting options/settings?

Thanks ;)

Re: How to edit a lexer

Posted: 11.09.2024 12:26
by main Alexey
1. I fixed the Rainmeter lexer, it's updated in addons-manager.
changed regex for sections to simple: ^\[.+\]$

2. how to edit --
Lexers modification and creation
in the wiki https://wiki.freepascal.org/CudaText

Re: How to edit a lexer

Posted: 11.09.2024 12:38
by sl23
Oh that's great thanks for that! :)

Re: How to edit a lexer

Posted: 16.09.2024 12:35
by sl23
Hi Alexey, this has been working perfectly, until today I noticed that single words no longer show in bold or highlighted as they originally did. Sort of the opposite of what I was getting in the first post.
Would you be able to adjust to fix that please. :)

EDIT: No worries, there was a space after the closed square bracket! Sorry. :oops:

Re: How to edit a lexer

Posted: 17.09.2024 05:50
by main Alexey
you are right, I fixed this regex again. to allow trailing spaces. updated the lexer.

Re: How to edit a lexer

Posted: 17.09.2024 21:08
by sl23
Ah ok thanks for the fix! ;)