vis: implement :set cursorline
[vis.git] / lexers / litcoffee.lua
blobf31a2d1e9e474e6e0472159e488532d2651ef251
1 -- Copyright 2006-2013 Robert Gieseke. See LICENSE.
2 -- Literate CoffeeScript LPeg lexer.
3 -- http://coffeescript.org/#literate
5 local l = require('lexer')
6 local token = l.token
7 local P = lpeg.P
9 local M = {_NAME = 'litcoffee'}
11 -- Embedded in Markdown.
12 local markdown = l.load('markdown')
13 M._lexer = markdown -- ensure markdown's rules are loaded, not HTML's
15 -- Embedded CoffeeScript.
16 local coffeescript = l.load('coffeescript')
17 local coffee_start_rule = token(l.STYLE_EMBEDDED, (P(' ')^4 + P('\t')))
18 local coffee_end_rule = token(l.STYLE_EMBEDDED, l.newline)
19 l.embed_lexer(markdown, coffeescript, coffee_start_rule, coffee_end_rule)
21 return M