How to edit a lexer

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
sl23
Posts: 161
Joined: 29.01.2013 10:04

How to edit a lexer

Post 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 ;)
Last edited by sl23 on 11.09.2024 12:38, edited 1 time in total.
Live for an ideal and leave no place in the mind for anything else.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: How to edit a lexer

Post 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
sl23
Posts: 161
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post by sl23 »

Oh that's great thanks for that! :)
Live for an ideal and leave no place in the mind for anything else.
sl23
Posts: 161
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post 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:
Live for an ideal and leave no place in the mind for anything else.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: How to edit a lexer

Post by main Alexey »

you are right, I fixed this regex again. to allow trailing spaces. updated the lexer.
sl23
Posts: 161
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post by sl23 »

Ah ok thanks for the fix! ;)
Live for an ideal and leave no place in the mind for anything else.
Post Reply