Re: [textadept] TeX lexers

From: mitchell <c....at.caladbolg.net>
Date: Mon, 20 Jun 2011 12:47:45 -0400 (Eastern Daylight Time)

Robert,

On Sat, 18 Jun 2011, Robert wrote:

> On Fri, Jun 17, 2011 at 6:28 PM, mitchell <c....at.caladbolg.net> wrote:
>>>>
>>> It seems to only work with built-in token names like l.COMMENT,
>>> l.KEYWORD - when I have fold patterns
>>> [l.COMMENT] = { ['\\begin'] = 1, ['\\end'] = -1 },
>>> ['environment'] = { ['\\begin'] = 1, ['\\end'] = -1 },
>>> only the first works.
>>> What is the getStyleAt function doing/looking for?
>>
>> I don't know why you are seeing this because it's working for me: \begin ..
>> \end environment tokens fold properly. getStyleAt should return a string.
>>
>
> I've pushed a current version [1]:

You are overwriting the tex lexer's _tokenstyles. Your latex lexer needs
to be like this:

local tex = l.load('tex')
_rules = tex._rules
_rules[1] = { 'whitespace', ws }
_rules[2] = { 'comment', comment }
_rules[3] = { 'environment', environment }
table.insert(_rules, 4, { 'parts', parts })
_tokenstyles = tex._tokenstyles
_tokenstyles[#_tokenstyles + 1] = { 'parts', l.style_class }
_tokenstyles[#_tokenstyles + 1] = { 'environment', l.style_tag }

mitchell

>
> If I only use l.* token names [2], like l.FUNCTION instead of
> 'environment', both
>
> \begin{comment}
> ...
> \end{comment}
>
> \begin{something}
> ...
> \end{something}
>
> are folded, but not with the 'environment' version. Do both versions
> work for you?
>
> Robert
>
> [1] https://github.com/rgieseke/textadept-lexers/blob/master/latex.lua
> [2] https://gist.github.com/1033004
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Mon 20 Jun 2011 - 12:47:45 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:11:31 EST