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

From: <rhkramer.att.gmail.com>
Date: Sat, 17 Feb 2018 18:31:45 -0500

Let me ask a followup--one of the important things my lexer / folder needs to
recognize is the multiline mbox header (with a variable number of lines).

A minimum mbox header (constrained by the applications I plan to use--kmail,
recoll, nmail, some others is 3 lines, like this:

From "poor man's lobster" Fri Feb 16 09:22:39 2018
Date: 02/16/18 09:22 am
Subject: poor man's lobster

It can include an arbitrary number of additional lines after the From line of
the form:

<keyword>: <whatever>

(In other words, just like what can be included in a real mbox header.)

When a valid mbox header is recognized, the From line would become a fold
point, and, the lines (and parts of lines) would be highlighted to make it
easy to read.

I think I finally have some insight into how to to that in a C++ lexer
(handling the multiple lines is the problem).

Would that be fairly easy to do in LPeg?

Thanks!

On Saturday, February 17, 2018 03:16:43 PM Mitchell wrote:
> I saw you posting on the Scintilla mailing list and I'd like to point out
> that if you prefer using SciTE, you can use LPeg lexers with it via
> Scintillua[1]. Fetch the nightly version if you want to write
> object-oriented lexers like the one posted to the wiki. There's an LPeg
> lexer tutorial[2] available too if you're interested.
>
> Cheers,
> Mitchell
>
> [1]: https://foicica.com/scintillua/
> [2]: https://foicica.com/textadept/api.html#lexer

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 17 Feb 2018 - 18:31:45 EST

This archive was generated by hypermail 2.2.0 : Sun 18 Feb 2018 - 06:49:17 EST