Re: [code] Factor lexer for Textadept

From: Michael Richter <ttmrichter.att.gmail.com>
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 <m.att.foicica.com> wrote:

> Hi Michael,
>
>
> On Mon, 1 Apr 2013, Michael Richter wrote:
>
> The Factor language (http://factorcode.org/) as of yesterday supported
>> the
>> launching of Textadept from within its REPL (
>> https://github.com/**slavapestov/factor/pull/833<https://github.com/slavapestov/factor/pull/833>).
>> As of today Textadept
>> supports the Factor language syntax (
>> https://github.com/**slavapestov/factor/pull/835<https://github.com/slavapestov/factor/pull/835>).
>> Well, mostly supports it.
>>
>> The lexer (
>> https://github.com/ttmrichter/**factor/blob/master/misc/**
>> textadept/lexers/factor.lua<https://github.com/ttmrichter/factor/blob/master/misc/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 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 03 Apr 2013 - 03:58:22 EDT

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