[code] [scintillua] Trying to make a Literate Haskell lexer?

From: Jeremy Clarke <geckojsc.att.gmail.com>
Date: Wed, 9 Dec 2015 05:19:38 +0000

Hi, I'm trying to make a simple Literate Haskell lexer based on the
existing Literate CoffeeScript one.

local l = require('lexer')
local token = l.token
local P = lpeg.P

local M = {_NAME = 'lithaskell'}

local haskell = l.load('haskell')
local start_rule = token(l.STYLE_EMBEDDED, l.starts_line(P('>')))
local end_rule = token(l.STYLE_EMBEDDED, l.newline)
l.embed_lexer(M, haskell, start_rule, end_rule)

return M

However, I'm having absolutely no luck in getting this to work correctly.

I added the line

textadept.file_types.extensions.lhs = "lithaskell"

to my init.lua, and my .lhs files are identified as lithaskell, but there
is no highlighting (it just looks like boring old text).
What is the correct way to embed the Haskell highlighter into an otherwise
ordinary text lexer?

Ideally I'd like to get plain text to display as comments.
I tried the following:

local line = token(l.COMMENT, l.nonnewline^0)
M._rules = {
{'comment', line}
}

but again, no luck...

Sorry if I'm missing something obvious here!

Thanks,
Jeremy

-- 
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 09 Dec 2015 - 00:19:38 EST

This archive was generated by hypermail 2.2.0 : Wed 09 Dec 2015 - 06:50:39 EST