1 -- Copyright 2006-2013 Robert Gieseke. See LICENSE.
2 -- Literate CoffeeScript LPeg lexer.
3 -- http://coffeescript.org/#literate
5 local l
= require('lexer')
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
)