Re: [code] Factor lexer for Textadept

From: Michael Richter <>
Date: Wed, 3 Apr 2013 15:58:22 +0800

Yeah, that's the problem I've got with the way things are now.

A stack declaration is ( words words words -- words words words ). It may
be nested as well. So you could have ( words words ( words -- words ) --
words words ). All of the words are optional, incidentally. The only
fixed parts are (, ) and --. Those *must* be there.

Like Forth, Factor is, indeed, whitespace delimited so ( must have
whitespace before and after it as must ) and --. This is what I tried in
earlier attempts to leverage, but failed with. I just don't know LPEG well
enough yet to figure out even where to begin with this.

On 3 April 2013 01:19, Mitchell <> wrote:

> Hi Michael,
> On Mon, 1 Apr 2013, Michael Richter wrote:
> The Factor language ( as of yesterday supported
>> the
>> launching of Textadept from within its REPL (
>> As of today Textadept
>> supports the Factor language syntax (
>> Well, mostly supports it.
>> The lexer (
>> textadept/lexers/factor.lua<>
>> )
>> works fine (so far) except for one edge case I can't figure out. The
>> problem is that I want to treat constructs that look like this…
>> ( some words here -- some more words here )
>> …as one "operator" (there's no such thing, really, in Factor) while
>> *anything
>> else* like, say, these…
>> (one_word) (two_separate words)
>> …are treated as "identifiers".
> How can you distinguish between the two? Are there spaces between the
> parentheses and a word for the first? The way you have it in your
> "stack_declaration" pattern, it matches any set of parentheses as an
> "operator" so your "identifer" rule is never hit.
> Cheers,
> Mitchell

"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
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 03 Apr 2013 - 03:58:22 EDT

This archive was generated by hypermail 2.2.0 : Wed 03 Apr 2013 - 06:38:43 EDT