Lexer "Total Commander menu" (was: Help with lexer)

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
BBServ
Posts: 14
Joined: 01.04.2021 17:20

Lexer "Total Commander menu" (was: Help with lexer)

Post by BBServ »

I am trying to create a lexer for Total Commander menu files. I have succeeded in creating everything that I wanted except the ability to fold between POPUP
and END_POPUP. I have read your tutorials and attempted many variations. I also tried starting with the Autoit lexer and retrofitting it with my lexer. Still
not able to get it to work.

I have attached the lexer I created - without the Blockrules section. Can you give me a some additional help?
Joe

---------
From moderator:
Updated lexer is here: https://github.com/Alexey-T/CudaText-le ... Cmd%20menu
Attachments
TCMenu.lcf.txt
(5.1 KiB) Downloaded 231 times
main Alexey
Posts: 2236
Joined: 25.08.2021 18:15

Post by main Alexey »

Pls attach also some small TCmd menu file, so I will fix the lexer to work on this file.

EDIT
found the example inside lexer file.
main Alexey
Posts: 2236
Joined: 25.08.2021 18:15

Post by main Alexey »

errors in your lexer file

1. missing block-rules of course
2. 'token type' fields of Parser rules was not set OK (main error! it prevented to config block-rules, which need 'token type')
3. instead of parser 'popup|end_popup' you must write '\b(popup|end_popup)\b'
3b. the same as 3 for other word-finding parsers
4. 'comment' parser: must support spaces: '^\x20*;.*' -- but to find leading spaces, you must toggle the lexer property "skip leading spaces" (I write by memory, it is checkbox in SynWrite)
5. 'number' parser: need '\d+\b'

lexer is updated. it has folding now.
Attachments
TCMenu.lcf.txt
(6.08 KiB) Downloaded 227 times
BBServ
Posts: 14
Joined: 01.04.2021 17:20

Post by BBServ »

Thank you - works perfectly. Thank you for explaining what was wrong.
main Alexey
Posts: 2236
Joined: 25.08.2021 18:15

Post by main Alexey »

Post Reply