Re: [code] [scintillua] Match patterns between embedded lexer start/end?

From: Mitchell <m.att.foicica.com>
Date: Wed, 9 Oct 2013 08:34:15 -0400 (Eastern Daylight Time)

Hi Claire

On Wed, 9 Oct 2013, Claire Lewis wrote:

> Thanks for the patch, unfortunately I think it's going to be somewhat
> more complex than that.
>
> As far as I can see from looking at the source, the lexer table returned
> is the module itself. So changing _NAME via alt_name doesn't really
> help, a the same package/table is of course returned from require in
> either case. The name is simply overridden the second time, and so only
> the second version works.

I'm not exactly sure if I understand the concern you raised, but the
patch's `package.loaded[lexer_name] = nil` should force `require()` to
look up the lexer, even if one of the "same name" was previously loaded.

> In fact, I'm not even sure the _NAME is set unless there's an error with
> require.

You are correct, I forgot to add a line. New patch attached.

I've also attached a sample lexer I threw together in 5 minutes and tested
it with some simple ffi declarations and it seems to work. Asking for the
whitespace style names in each declaration gives the "cpp" and "cpp2"
names, so the styling works wherever I start typing in the file.

Sorry if I'm misunderstanding your use case.

Cheers,
Mitchell

-- 
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 Wed 09 Oct 2013 - 08:34:15 EDT

This archive was generated by hypermail 2.2.0 : Thu 10 Oct 2013 - 06:37:26 EDT