Re: [code] [textadept] Improvements to C and Rust lexers

From: Mitchell <>
Date: Fri, 20 Sep 2019 18:10:32 -0400 (EDT)

Hi Gabriel,

On Fri, 20 Sep 2019, Gabriel Bertilson wrote:

>> But here's a version that uses lookbehind.
> Whoops, lexer.starts_line also uses lookbehind. My new function ended
> up being very similar. The practical difference is that it skips over
> any spaces or tabs when looking for a newline before the pattern.
> I already noticed an error: the pattern '%f[^\n\0][ \t]+$' should be
> '%f[^\0\n\r\f][ \t]+$'. (The \0 for "start of string" also isn't a
> great idea because there could be null characters in the file.)

I've committed a change[1] that simply doesn't test for '#' at the beginning of a line. Lexers are not parsers, so I think this should be good enough. If it turns out to cause major problems, we can look for another solution.

Regardless, preprocessor statements can now be indented. Thanks for bringing this up.

I also committed your Rust lexer changes. Thanks again!



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 20 Sep 2019 - 18:10:32 EDT

This archive was generated by hypermail 2.2.0 : Sat 21 Sep 2019 - 06:49:23 EDT