Re: [code] Extending a lexer

From: Michael Richter <ttmrichter.att.gmail.com>
Date: Mon, 19 Dec 2016 08:46:51 +0800

I keep looking for reasons to complain about Textadept, Mitchell, and I
keep getting disappointed each time! :D

Thanks, again, for the brilliant editor and the even more brilliant support
for it!

On 18 December 2016 at 21:29, Mitchell <m.att.foicica.com> wrote:

> Hi Michael,
>
> On Sun, 18 Dec 2016, Michael Richter wrote:
>
> I'd like to add some Logtalk support to Textadept. For those not in the
>> know, Logtalk is an OOP toolkit for kit-bashing OOP layers on top of
>> Prolog. Syntactically it is so close to Prolog that I can just use a
>> Prolog lexer and get "almost good enough" syntax highlighting.
>>
>> I'd like to improve this, however.
>>
>> What I'd like to do is basically build up on the Prolog lexer by adding
>> "keywords" and library "functions" and such to it rather than copying the
>> Prolog lexer and tweaking it. Unfortunately the tools for embedding
>> parent
>> or child lexers are *not* really suitable for this task: there is no clear
>> "region of Logtalk" vs. "region of Prolog" code. Logtalk is essentially a
>> syntax-compatible dialect of Prolog.
>>
>> How would I go about making such a beast if this is possible at all?
>>
>
> Textadept has a number of lexers that "extend" existing ones:
>
> * LESS and SASS extend CSS
> * CUDA and GLSL extend C++ (cpp)
> * Rails extends Ruby
>
> All you really do is `lexer.load()` the lexer to entend, modify its
> `_rules` table, and set it as your lexer's own. Each of the lexers I
> mentioned above does this.
>
> 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.
>
>

-- 
"Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-- 
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 Sun 18 Dec 2016 - 19:46:51 EST

This archive was generated by hypermail 2.2.0 : Mon 19 Dec 2016 - 06:44:10 EST