From 3570869c9ae2c4df14b15423789919e514322916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 7 Dec 2016 16:49:29 +0100 Subject: 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. --- lexers/tcl.lua | 59 ---------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 lexers/tcl.lua (limited to 'lexers/tcl.lua') diff --git a/lexers/tcl.lua b/lexers/tcl.lua deleted file mode 100644 index f76e6ee..0000000 --- a/lexers/tcl.lua +++ /dev/null @@ -1,59 +0,0 @@ --- Copyright 2014-2016 Joshua Krämer. See LICENSE. --- Tcl LPeg lexer. --- This lexer follows the TCL dodekalogue (http://wiki.tcl.tk/10259). --- It is based on the previous lexer by Mitchell. - -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 = 'tcl'} - --- Whitespace. -local whitespace = token(l.WHITESPACE, l.space^1) - --- Separator (semicolon). -local separator = token(l.CLASS, P(';')) - --- Delimiters. -local braces = token(l.KEYWORD, S('{}')) -local quotes = token(l.FUNCTION, '"') -local brackets = token(l.VARIABLE, S('[]')) - --- Argument expander. -local expander = token(l.LABEL, P('{*}')) - --- Variable substitution. -local variable = token(l.STRING, '$' * (l.alnum + '_' + P(':')^2)^0) - --- Backslash substitution. -local backslash = token(l.TYPE, '\\' * ((l.digit * l.digit^-2) + - ('x' * l.xdigit^1) + ('u' * l.xdigit * l.xdigit^-3) + - ('U' * l.xdigit * l.xdigit^-7) + P(1))) - --- Comment. -local comment = token(l.COMMENT, '#' * P(function(input, index) - local i = index - 2 - while i > 0 and input:find('^[ \t]', i) do i = i - 1 end - if i < 1 or input:find('^[\r\n;]', i) then return index end -end) * l.nonnewline^0) - -M._rules = { - {'whitespace', whitespace}, - {'comment', comment}, - {'separator', separator}, - {'expander', expander}, - {'braces', braces}, - {'quotes', quotes}, - {'brackets', brackets}, - {'variable', variable}, - {'backslash', backslash}, -} - -M._foldsymbols = { - _patterns = {'[{}]', '#'}, - [l.KEYWORD] = {['{'] = 1, ['}'] = -1}, - [l.COMMENT] = {['#'] = l.fold_line_comments('#')} -} - -return M -- cgit v1.2.3