diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-07 16:49:29 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-12-07 20:11:32 +0100 |
| commit | 3570869c9ae2c4df14b15423789919e514322916 (patch) | |
| tree | 6b990c9ec59fbdc7abce89c1307d22e66d0fd88a /lua/lexers/litcoffee.lua | |
| parent | 098504f67aea8a862840d58c69e8f6360eef3073 (diff) | |
| download | vis-3570869c9ae2c4df14b15423789919e514322916.tar.gz vis-3570869c9ae2c4df14b15423789919e514322916.tar.xz | |
Move all lua related files to lua/ subfolder
Also remove the lexers sub directory from the Lua search path.
As a result we attempt to open fewer files during startup:
$ strace -e open -o log ./vis +q config.h && wc -l log
In order to avoid having to modifiy all lexers which `require('lexer')`
we instead place a symlink in the top level directory.
$ ./configure --disable-lua
$ rm -rf lua
Should result in a source tree with most lua specifc functionality
removed.
Diffstat (limited to 'lua/lexers/litcoffee.lua')
| -rw-r--r-- | lua/lexers/litcoffee.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/lexers/litcoffee.lua b/lua/lexers/litcoffee.lua new file mode 100644 index 0000000..f31a2d1 --- /dev/null +++ b/lua/lexers/litcoffee.lua @@ -0,0 +1,21 @@ +-- Copyright 2006-2013 Robert Gieseke. See LICENSE. +-- Literate CoffeeScript LPeg lexer. +-- http://coffeescript.org/#literate + +local l = require('lexer') +local token = l.token +local P = lpeg.P + +local M = {_NAME = 'litcoffee'} + +-- Embedded in Markdown. +local markdown = l.load('markdown') +M._lexer = markdown -- ensure markdown's rules are loaded, not HTML's + +-- Embedded CoffeeScript. +local coffeescript = l.load('coffeescript') +local coffee_start_rule = token(l.STYLE_EMBEDDED, (P(' ')^4 + P('\t'))) +local coffee_end_rule = token(l.STYLE_EMBEDDED, l.newline) +l.embed_lexer(markdown, coffeescript, coffee_start_rule, coffee_end_rule) + +return M |
