Re: [code] Debugging language modules

From: Robert Gieseke <>
Date: Sat, 26 Mar 2016 17:20:23 +0100

Hi Arnel,

Am 26/03/16 um 16:22 schrieb Arnel:
> - I have the following lines in the 'init.lua' file for the Racket module:
> textadept.file_types.extensions.rkt = 'racket'
> = 'racket "%f"'
>[ + 1] = '^(.-):(%d+):%
> d+: (.+)$' = 'racket -f "%f"'
> = ':(%d+):%d+: (.+)'
> textadept.editing.comment_string.racket = ";"
> However, if I open a Racket script and try testing the syntax checking, nothing
> happens. The 'init.lua' file is located inside the 'racket' directory inside
> '~/.textadept/modules'. If I run
> ui.print(textadept.file_types.extensions.rkt)
> from the command entry, I come up with plain 'nil'. Why is that?
> If I place these lines in my regular '~/.textadept/init.lua', the syntax
> checking works fine.

This works as expected, the file extension and commands are set adding
to Textadept modules tables. The first time a Racket module is detected
(via extension) Textadept will load your module.

If you submit your lexer and the extension settings once it's done you
won't have this problem anymore.

> - Is there a better way to debug lexer modules? The Racket lexer I'm working on
> was based off the Scheme lexer file provided with TA. I've read somewhere in
> the API manual that troubleshooting lexers can be tricky and it's recommended
> to run TA in the terminal to get the error messages. I tried this but I didn't
> get any. Those who have written lexers for other languages before - any
> pointers? Anything on seeing what's actually captured by the LPEG expressions
> would be great.

One option is to use Scintillua as a standalone library, there is an
example in the manual[1]. It might help to really understand and test a
single pattern.

> - Is it possible to change the background color of highlighted
> brackets and parentheses when looking for their pairs? There doesn't appear to
> be anything related mentioned in the buffer API for it.

In your properties.lua file you can overwrite Textadept's defaults, this
gives me a red box (with Solarized theme):

buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_FULLBOX
buffer.indic_fore[INDIC_BRACEMATCH] = buffer.property_int['color.base08']
buffer:brace_highlight_indicator(not CURSES, INDIC_BRACEMATCH)

(I use a base16 theme, so you might not have other colors defined, you
could also specify a color directly.)



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 26 Mar 2016 - 12:20:23 EDT

This archive was generated by hypermail 2.2.0 : Sun 27 Mar 2016 - 06:43:12 EDT