Re: [code] [textadept]bold/italics styles in lexer generates segment fault

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Tue, 26 May 2015 07:33:22 +1000

Gabriel,

While I have no idea what might be causing this problem, good luck with
your project. IMHO it would be a fantastic addition to Textadept.

On 26 May 2015 at 05:23, Gabriel Dubatti <gdubatti.att.gmail.com> wrote:

> Hi Mitchell,
>
> I'm getting a segmentation fault when I try to apply my simple lexer to
> more than one file.
>
> For the first file it works OK, but if I uncomment any of the 4
> token-styles and apply the style to a second file, I get a seg-fault.
>
> If I removed the "bold" and "italics" modifiers from the styles, the issue
> is gone.
>
> Here is my lexer file:
> ---------------------
> -- myproj LPeg lexer.
>
> local l = require('lexer')
> local token, word_match = l.token, l.word_match
> local P, R, S = lpeg.P, lpeg.R, lpeg.S
>
> local M = {_NAME = 'myproj'}
>
> -- Whitespace.
> local ws = token(l.WHITESPACE, l.space^1)
>
> local hidden = token('hidden', '::' * l.nonnewline^0)
> local style_hidden = 'notvisible'
>
> local group1 = token('group1', '[' * (l.nonnewline - ']')^0 * ']' )
> local style_group1 = 'fore:#400000,bold'
>
> local group2 = token('group2', '(' * (l.nonnewline - ')')^0 * ')' )
> local style_group2 = 'fore:#000040,bold'
>
> local group3 = token('group3', '<' * (l.nonnewline - '>')^0 * '>' )
> local style_group3 = 'fore:#000080,bold'
>
> local extension = token('extension', '.' * l.word^0 )
> local style_extension = 'fore:#005050,italics'
>
> M._rules = {
> {'whitespace', ws},
> {'hidden', hidden},
> {'group1', group1},
> {'group2', group2},
> {'group3', group3},
> {'extension', extension},
> }
>
> M._tokenstyles = {
> hidden = style_hidden,
> -- group1 = style_group1,
> -- group2 = style_group2,
> -- group3 = style_group3,
> -- extension= style_extension,
> }
>
> M._FOLDBYINDENTATION = true
>
> return M
> ---------------------
>
> This lexer is for a project management system I'm writing.
> The file format is very simple and can be easily generated with "ls -R -1"
> plus some hand editing.
> The lexer hides the control info, hilights groups of files and file
> extensions and handles group folding.
>
> For example, when you apply this lexer to the file:
> ---------------------
> [textadept]::/home/user/textadept_8.0.x86_64/::
> init.lua
> properties.lua
> README.md
> <src>::/home/user/textadept_8.0.x86_64/src/::
> Makefile
> textadept.c
> textadept.rc
> (core)::/home/user/textadept_8.0.x86_64/core/::
> args.lua
> events.lua
> file_io.lua
> iface.lua
> ---------------------
> you get something like:
> [image: project]
> I'm planning to publish this in the wiki when is ready.
>
> Anyway, I think this might be a Scintilla bug....
>
> Best wishes,
> Gabriel
>
>
>

-- 
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.
textadept_project.png
Received on Mon 25 May 2015 - 17:33:22 EDT

This archive was generated by hypermail 2.2.0 : Tue 26 May 2015 - 06:44:26 EDT