Page 39 of 39

Re: Coder plugin (3)

Posted: Sat Dec 30, 2023 12:21 pm
by Cuprum
Задумал сделать подсветку Котлина. Из-за особенностей языка в коде возможны весьма сложные конструкции.
Более-менее удалось правильно подсветить такой однострочный пример

Code: Select all

val message = "$n is ${if (n > 0) "positive" else if (n < 0) "negative and ${if (n % 2 == 0) "even" else "odd"}" else "zero"}"
с помощью

Code: Select all

QuotesRE:
;================================================================================================================
;Flags  Pattern                              \BackRef=(FontStyle,ColorText,ColorBk) \BackRef=...  ParentID RuleID
;================================================================================================================
0	`".*"`                                "\0=(0,${STR},0)"                                        0    1
0	`\$\{.*\}`                            "\0=(0,0,0)"                                             1    2
0	`"[^"]*(?=\$\{)`                      "\0=(0,${STR},0)"                                        1    3
0	`"[^"]*"`                             "\0=(0,${STR},0)"                                        1    3
0	`(?<=\})[^"}]*"`                      "\0=(0,${STR},0)"                                        1    3
0	`"[^"}]*?(?=\$\{)`                    "\0=(0,${STR},0)"                                        2    3
0	`(?<=\})[^"}]*?"`                     "\0=(0,${STR},0)"                                        2    3
0	`"[^"}]*?"`                           "\0=(0,${STR},0)"                                        2    3
0	`(?<!\\)(\$)([A-Za-z_][A-Za-z_\d]*)`  "\1=(0,${OP},0) \2=(0,${HighLight_BasicTextColor},0)"   -2
0	`\$(?=\{)`                   "\0=(0,${OP},0)"                                                 -2
.


Image
.

Но ожидаемо из-за жадности поиска кавычек в первом правиле QuotesRE вот такая строка

Code: Select all

(e.message?.let { ": $it" } ?: ""))
сразу ломает

Image
.
Код выше еще можно раскрасить последовательно с помощью Quotes, но там тоже будут ложные срабатывания во многих других участках кода.
Есть у кого идеи как сделать такие случаи? А возможно ли вообще?

Re: Coder plugin (3)

Posted: Sat Aug 24, 2024 7:43 pm
by Diamen
Rarely crash, step:
Download and load this file in editor.
Down with cursor.
When arrive to row 50 crash.

Re: Coder plugin (3)

Posted: Thu Sep 19, 2024 6:49 am
by Diamen
Why CodeFold not work in json.coder?

Re: Coder plugin (3)

Posted: Sat Aug 29, 2026 5:51 pm
by Diamen
Diamen wrote: Sat Aug 24, 2024 7:43 pm Rarely crash, step:
Download and load this file in editor.
Down with cursor.
When arrive to row 50 crash.
it keeps happening with long line, I see also AkelPad.exe.2088.dmp generated.

Re: Coder plugin (3)

Posted: Sun Aug 30, 2026 7:13 pm
by Instructor
Diamen wrote: Sat Aug 29, 2026 5:51 pmit keeps happening with long line...
Send/Share your AkelPad folder and file that cause crash.

Re: Coder plugin (3)

Posted: Mon Aug 31, 2026 2:05 pm
by Diamen
it's not possible, I have too much sensitive data.