Coder plugin (3)

Discuss and announce AkelPad plugins
  • Author
  • Message
Offline
Posts: 382
Joined: Wed Sep 28, 2011 3:05 pm

Re: Coder plugin (3)

Post 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, но там тоже будут ложные срабатывания во многих других участках кода.
Есть у кого идеи как сделать такие случаи? А возможно ли вообще?

Offline
Posts: 165
Joined: Fri Aug 15, 2008 8:58 am

Re: Coder plugin (3)

Post by Diamen »

Rarely crash, step:
Download and load this file in editor.
Down with cursor.
When arrive to row 50 crash.

Offline
Posts: 165
Joined: Fri Aug 15, 2008 8:58 am

Re: Coder plugin (3)

Post by Diamen »

Why CodeFold not work in json.coder?

Offline
Site Admin
Posts: 6411
Joined: Thu Jul 06, 2006 7:20 am

Re: Coder plugin (3)

Post by Instructor »

Diamen wrote: Sat Aug 24, 2024 7:43 pmRarely crash, step:
There is 14 lines in "jsonlint.html" file and no crash.

Offline
Posts: 47
Joined: Sat Jul 05, 2008 11:30 am
Location: Odesa, Ukraine

Re: Coder plugin (3)

Post by ewild »

Diamen wrote: Thu Sep 19, 2024 6:49 am Why CodeFold not work in json.coder?
Not confirmed. It works as intended.
Instructor wrote: Sun Oct 06, 2024 5:05 pm There is 14 lines in "jsonlint.html" file...
There are 56 lines in the file.
It's seen either just by viewing the page source online in the browser or the downloaded file:

Code: Select all

command:
wget --timestamping --no-hsts "https://interno.altervista.org/temp/jsonlint.html"
result:
jsonlint.html, 2024-08-24 22:37:48, 1538 b, md5: e141f932b258184501b32c58f4e4639c
Instructor wrote: Sun Oct 06, 2024 5:05 pm ... and no crash.
Can confirm that. No crash on jsonlint.html for AkelPad v.4.9.9 64-bit + Coder plugin v.20.4 64-bit.

Offline
Posts: 165
Joined: Fri Aug 15, 2008 8:58 am

Re: Coder plugin (3)

Post 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 crash if I have in AkelPad.ini:
Coder::CodeFold=65536
LineBoard::Main=65536
but if I change font size with ctrl- not crash .

Why not work CodeFold for .json to me?

Offline
Site Admin
Posts: 6411
Joined: Thu Jul 06, 2006 7:20 am

Re: Coder plugin (3)

Post by Instructor »

Diamen wrote: Mon Oct 07, 2024 4:06 pmIt crash if I have in AkelPad.ini
Can you send to email or share your akelpad folder with problem HTML file?

Offline
Posts: 165
Joined: Fri Aug 15, 2008 8:58 am

Re: Coder plugin (3)

Post by Diamen »

Diamen wrote: Sat Aug 24, 2024 7:43 pm Why not work CodeFold for .json to me?
excuse me, I confuse with XBrackets plugin.

Offline
Posts: 165
Joined: Fri Aug 15, 2008 8:58 am

Re: Coder plugin (3)

Post by Diamen »

Instructor wrote: Mon Oct 07, 2024 4:22 pm
Diamen wrote: Mon Oct 07, 2024 4:06 pmIt crash if I have in AkelPad.ini
Can you send to email or share your akelpad folder with problem HTML file?
I changed zooms and I can't reproduce it anymore.

Offline
Posts: 1879
Joined: Mon Aug 06, 2007 1:07 pm
Contact:

Re: Coder plugin (3)

Post by Infocatcher »

У меня тут спрашивают про подсветку ссылок только при наведении:
https://github.com/Infocatcher/AkelPad_coder/issues/5
То есть чтобы текст ссылки выводился как обычный и подсвечивался только при наведении курсора.
Впрочем, я бы подчеркивание оставил (и сделал бы отдельной настройкой его отключение).

Offline
Site Admin
Posts: 6411
Joined: Thu Jul 06, 2006 7:20 am

Re: Coder plugin (3)

Post by Instructor »

Infocatcher
Подсветка ссылок приоритетнее чем Folds. Поэтому нельзя, чтобы ссылки зависили от Folds.

Offline
Posts: 1879
Joined: Mon Aug 06, 2007 1:07 pm
Contact:

Re: Coder plugin (3)

Post by Infocatcher »

Instructor
Так это в процессе поиска приоритет.
А можно найти, запомнить, но не красить, пока не отработает Coder, если тот установлен?

Offline
Site Admin
Posts: 6411
Joined: Thu Jul 06, 2006 7:20 am

Re: Coder plugin (3)

Post by Instructor »

Infocatcher
Сделать можно, но это смена приоритетов. Данная смена не планируется.

Offline
Posts: 7
Joined: Sat Feb 19, 2011 6:00 pm

Re: Coder plugin (3)

Post by newquaker »

подскажите будьте добры возможно ли указать относительный путь в параметре HighLight_BkImageFile? я указал там файл 1.jpg положив рядом с exe, но он не отображается

Offline
Posts: 286
Joined: Mon Jun 20, 2011 8:33 am
Location: Электросталь

Re: Coder plugin (3)

Post by yozhic »

newquaker
Здесь действуют внутренние переменные AkelPad

Code: Select all

"%a\1.jpg"
В справке поиском по %a гляньте, все они перечислены.
Ещё пример:
Image
Last edited by yozhic on Thu Feb 06, 2025 9:11 am, edited 1 time in total.
Post Reply