How to edit a lexer

All questions regarding lexer highlighting schemes are discussed here...
sl23
Posts: 166
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: 2531
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: 166
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: 166
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: 2531
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: 166
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.
sl23
Posts: 166
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post by sl23 »

Hi Alexey,
I just updated the plugins using the built in updater and now the Rainmeter lexer has reverted back to the problem mentioned in the OP, I then copied the lexers back as I had changed the colours for syntax highlighting, but it didn't fix the issue. What is the cause and can it be solved once and for all or will it do this every time I update the plugins?

Thank you for your help.

EDIT: It's ok, I reinstalled using the Addons Manager and it's fixed it. :D
Live for an ideal and leave no place in the mind for anything else.
sl23
Posts: 166
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post by sl23 »

Actually, there is also one enhancement that would help:
Similar to the Section names in the OP, keys do not keep their highlighting if they have spaces and/or symbols.
So this works ok: MouseOverAction=....
But this does not: Mouse Over.Action=....
The reason for it is that INI files are useful for note taking. I use INI for everything where notes are required. Not comments btw, but separate files for note taking. So having spaces/symbols is often helpful here.

Here's an example of note taking:
Minimum= NVIDIA GeForce GT 1050 4GB / AMD Radeon RX 550 4GB
Recommended= NVIDIA GeForce GTX 1660 6GB / AMD Radeon RX 5500 8GB (with “Force maximum clocks” enabled) / Adreno
Optimal= NVIDIA Geforce RTX 3060 12GB / AMD Radeon RX 6700 10GB (with “Force maximum clocks” enabled)
Integrated Graphics (Minimum)= Intel UHD Graphics 730 / AMD Radeon Vega 3
Integrated Graphics (Recommended)= Intel Iris Xe Graphics / AMD Radeon 680M / Qualcomm Adreno 740 / ARM Mali G720
The Keys of the last two lines aren't coloured the same as the first three lines of Keys.

FR: Please could you add that to the Rainmeter lexer.
Thank you. :)
Live for an ideal and leave no place in the mind for anything else.
main Alexey
Posts: 2531
Joined: 25.08.2021 18:15

Re: How to edit a lexer

Post by main Alexey »

I just added this to the Rainmeter lexer. lexer is updated in addons-manager.
sl23
Posts: 166
Joined: 29.01.2013 10:04

Re: How to edit a lexer

Post by sl23 »

Ah your the best! Thank you :)
Live for an ideal and leave no place in the mind for anything else.
Post Reply