Re: [code] Still wrestling with oddball folds.

From: Michael Richter <ttmrichter.att.gmail.com>
Date: Wed, 8 Jan 2014 20:33:24 +0800

I found making the class [%s\0] deals with the end-of-line case.

On 8 January 2014 13:38, Michael Richter <ttmrichter.att.gmail.com> wrote:

> On 8 January 2014 02:40, Mitchell <m.att.foicica.com> wrote:
>
>> You should be using a function to determine the end of the fold point
>> because I don't see a good pattern rule. This seems to work for me:
>>
>>
>> M._foldsymbols = {
>> _patterns = { '%:%-', '%.', },
>> [l.OPERATOR] = {
>> [':-'] = 1,
>> ['.'] = function(text, pos, line, s, match)
>> return line:find('%.%f[%s]', s) and -1 or 0
>> end,
>> },
>> }
>>
>> It checks to see if the next character after '.' (if it exists) is a
>> whitespace character. Documentation on such functions is here[1].
>>
>
> I looked at that documentation, but I couldn't work out what the five
> parameters were and which ones applied where. Any chance of having that
> described a bit more thoroughly somewhere?
>
> That being said, your solution (as modified by the anchor you later
> suggested) works unless the "." appears at the end of a line like these:
>
> :- import_module io.
>
> :- type token_list
> ---> token_cons(token, token_context, token_list)
> ; token_nil.
>
> Are line feeds not matched as whitespace in Lua patterns or is the line
> feed truncated when passed to that function?
>
> --
> "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.
>

-- 
"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 08 Jan 2014 - 07:33:24 EST

This archive was generated by hypermail 2.2.0 : Thu 09 Jan 2014 - 06:49:08 EST