Re: [code] embed_lexer --- bug or feature?

From: Mitchell <m.att.foicica.com>
Date: Mon, 22 Feb 2016 20:44:37 -0500 (EST)

Hi Carl,

On Mon, 22 Feb 2016, Carl Sturtivant wrote:

> Hello,
>
> In the lexer I am writing, embedded D code can occur in two completely
> different ways.
>
> First, inline between #{ and }, and for now I will assume no braces in
> the D code between these.
>
> Second, line based, following a special symbol like
> -
> |=
> and so forth. There may be braces in this embedded code, which could
> interfere with the first case when setting an end rule for the embedded
> D lexer.
>
> To avoid this, I tried calling embed_lexer once to set up the first
> case, and once to set up the second case. But the second call simply
> replaced the effect of the first one, instead of adding a new instance
> of embedded lexing. If the language had been different for the second
> call, this would not have happened.
>
> I see this as a bug. Maybe there's a work-around. Could I get a copy of
> the lexer object with a different name in a simple way, and use that to
> avoid the name collision that causes the above behavior?

Call `lexer.load()`[1] more than once with alternate names and then call
`lexer.embed()` with each name[2].

Cheers,
Mitchell

[1]: file:///home/mitchell/code/textadept/doc/api.html#lexer.load
[2]: http://foicica.com/lists/code/201310/1238.html

-- 
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 Mon 22 Feb 2016 - 20:44:37 EST

This archive was generated by hypermail 2.2.0 : Tue 23 Feb 2016 - 06:50:40 EST