Re: LPeg for multiple line constructs (was: Re: [code] A small addition to the textadept Wiki)

From: <>
Date: Mon, 19 Feb 2018 09:06:48 -0500

Mitchell (and all),


Just for the record:

   * after some thought, I think I'll stick with trying to write my lexer in
C/C++--I think it has a couple of advantages (for me) (learning more (some??)
about C/C++, easier to install in any Scintilla based editor (doesn't need
Scintillua), and it might be faster (important since I anticipate large files
(100 MB now, 1 GB+ in the future)

   * I guess the key to the multiline header is the same in both Lua and
C/C++, that is, using the 32-bit per-line state variable.

I might grep for the lex_by_line lexers to see if they give me some extra
insight (I guess I'll figure out if that phase is used in the C/C++ lexers as
well as the Lua lexers).

Thanks again!

On Sunday, February 18, 2018 10:50:02 AM Mitchell wrote:
> On Sat, 17 Feb 2018, wrote:
> The highlighting should be pretty straightforward. You'd be writing a lexer
> that lexes by lines and you would look for lines that start with "From "
> and lines that start with "[keyword]: " (where keyword would probably be
> `lexer.word`), and process them accordingly.
> As for folding, that's more difficult and you'd probably need to write a
> custom folder.
> You can look at examples of line lexers via `grep -i lex_by_line lexers/*`.
> Custom folders are outside the scope of the documentation, but
> `lexers/lexer.lua` has an `M.fold()` function that you can reference when
> writing your own folding function (e.g. `function lex:fold(...) ... end`).

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 19 Feb 2018 - 09:06:48 EST

This archive was generated by hypermail 2.2.0 : Tue 20 Feb 2018 - 06:28:37 EST