Page 1 of 1

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

Posted: 11.04.2023 23:02
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

Posted: 12.04.2023 05:13
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.

Posted: 12.04.2023 06:15
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.

Posted: 12.04.2023 14:18
by BBServ
Thank you - works perfectly. Thank you for explaining what was wrong.

Posted: 21.04.2023 15:05
by main Alexey