how to create another colorer dialect?

33 views
Skip to first unread message

gar

unread,
Mar 2, 2020, 4:20:29 AM3/2/20
to leo-editor
copy say 'modes/javascript.py' to 'modes/test.py'
create a node with @language test (it's loaded - since it is colored and if make an error there - there'll be an abuse in stdout)
write something reasonable - and get nothing highlighted.

is it necessary to do anything else with it?

Edward K. Ream

unread,
Mar 2, 2020, 7:02:13 AM3/2/20
to leo-editor
I don't remember :-)

What do you see when you run Leo with --trace=coloring ?

Edward

gar

unread,
Mar 2, 2020, 8:34:31 AM3/2/20
to leo-e...@googlegroups.com
Not much :-)

--trace-coloring...
@bool use-pygments                 : False
@bool use-pytments-styles          : True
@string pygments-style-name        : default

literal

--trace-coloring: js7.leokeyword              0  13      '@language js7' match_at_language,colorRangeWithTag

пн, 2 мар. 2020 г. в 15:02, Edward K. Ream <edre...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3Q-93FtKwvnD9usRYccRhtyVmnPpb0iEUqUKB31Ym5-Q%40mail.gmail.com.

Edward K. Ream

unread,
Mar 2, 2020, 8:48:46 AM3/2/20
to leo-editor
On Mon, Mar 2, 2020 at 7:34 AM gar wrote:
Not much :-)

--trace-coloring...
@bool use-pygments                 : False
@bool use-pytments-styles          : True
@string pygments-style-name        : default

literal

--trace-coloring: js7.leokeyword              0  13      '@language js7' match_at_language,colorRangeWithTag

Alright.  I'll look into this.

Edward

Edward K. Ream

unread,
Mar 2, 2020, 9:05:53 AM3/2/20
to leo-editor
On Monday, March 2, 2020 at 7:48:46 AM UTC-6, Edward K. Ream wrote:

--trace-coloring: js7.leokeyword              0  13      '@language js7' match_at_language,colorRangeWithTag

Alright.  I'll look into this.

In modes/test.py, change the string "javascript" to "test" everywhere. This worked for me.

The colorizer accesses data structures in test.py based on the name of the language.

Edward

gar

unread,
Mar 2, 2020, 9:22:17 AM3/2/20
to leo-e...@googlegroups.com
Oh couldn't even imagine..... Thanks a lot, it works now!

Edward K. Ream

unread,
Mar 2, 2020, 10:54:38 AM3/2/20
to leo-editor
On Mon, Mar 2, 2020 at 8:22 AM gar <gar...@gmail.com> wrote:
Oh couldn't even imagine..... Thanks a lot, it works now!

You're welcome :-)

Edward
Reply all
Reply to author
Forward
0 new messages