aboutsummaryrefslogtreecommitdiff
path: root/lexers/gnuplot.lua
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-07 16:49:29 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-07 20:11:32 +0100
commit3570869c9ae2c4df14b15423789919e514322916 (patch)
tree6b990c9ec59fbdc7abce89c1307d22e66d0fd88a /lexers/gnuplot.lua
parent098504f67aea8a862840d58c69e8f6360eef3073 (diff)
downloadvis-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 'lexers/gnuplot.lua')
-rw-r--r--lexers/gnuplot.lua80
1 files changed, 0 insertions, 80 deletions
diff --git a/lexers/gnuplot.lua b/lexers/gnuplot.lua
deleted file mode 100644
index 26913db..0000000
--- a/lexers/gnuplot.lua
+++ /dev/null
@@ -1,80 +0,0 @@
--- Copyright 2006-2016 Mitchell mitchell.att.foicica.com. See LICENSE.
--- Gnuplot LPeg lexer.
-
-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 = 'gnuplot'}
-
--- Whitespace.
-local ws = token(l.WHITESPACE, l.space^1)
-
--- Comments.
-local comment = token(l.COMMENT, '#' * l.nonnewline^0)
-
--- Strings.
-local sq_str = l.delimited_range("'")
-local dq_str = l.delimited_range('"')
-local bk_str = l.delimited_range('[]', true)
-local bc_str = l.delimited_range('{}', true)
-local string = token(l.STRING, sq_str + dq_str + bk_str + bc_str)
-
--- Keywords.
-local keyword = token(l.KEYWORD, word_match{
- 'cd', 'call', 'clear', 'exit', 'fit', 'help', 'history', 'if', 'load',
- 'pause', 'plot', 'using', 'with', 'index', 'every', 'smooth', 'thru', 'print',
- 'pwd', 'quit', 'replot', 'reread', 'reset', 'save', 'set', 'show', 'unset',
- 'shell', 'splot', 'system', 'test', 'unset', 'update'
-})
-
--- Functions.
-local func = token(l.FUNCTION, word_match{
- 'abs', 'acos', 'acosh', 'arg', 'asin', 'asinh', 'atan', 'atan2', 'atanh',
- 'besj0', 'besj1', 'besy0', 'besy1', 'ceil', 'cos', 'cosh', 'erf', 'erfc',
- 'exp', 'floor', 'gamma', 'ibeta', 'inverf', 'igamma', 'imag', 'invnorm',
- 'int', 'lambertw', 'lgamma', 'log', 'log10', 'norm', 'rand', 'real', 'sgn',
- 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'column', 'defined', 'tm_hour',
- 'tm_mday', 'tm_min', 'tm_mon', 'tm_sec', 'tm_wday', 'tm_yday', 'tm_year',
- 'valid'
-})
-
--- Variables.
-local variable = token(l.VARIABLE, word_match{
- 'angles', 'arrow', 'autoscale', 'bars', 'bmargin', 'border', 'boxwidth',
- 'clabel', 'clip', 'cntrparam', 'colorbox', 'contour', 'datafile ',
- 'decimalsign', 'dgrid3d', 'dummy', 'encoding', 'fit', 'fontpath', 'format',
- 'functions', 'function', 'grid', 'hidden3d', 'historysize', 'isosamples',
- 'key', 'label', 'lmargin', 'loadpath', 'locale', 'logscale', 'mapping',
- 'margin', 'mouse', 'multiplot', 'mx2tics', 'mxtics', 'my2tics', 'mytics',
- 'mztics', 'offsets', 'origin', 'output', 'parametric', 'plot', 'pm3d',
- 'palette', 'pointsize', 'polar', 'print', 'rmargin', 'rrange', 'samples',
- 'size', 'style', 'surface', 'terminal', 'tics', 'ticslevel', 'ticscale',
- 'timestamp', 'timefmt', 'title', 'tmargin', 'trange', 'urange', 'variables',
- 'version', 'view', 'vrange', 'x2data', 'x2dtics', 'x2label', 'x2mtics',
- 'x2range', 'x2tics', 'x2zeroaxis', 'xdata', 'xdtics', 'xlabel', 'xmtics',
- 'xrange', 'xtics', 'xzeroaxis', 'y2data', 'y2dtics', 'y2label', 'y2mtics',
- 'y2range', 'y2tics', 'y2zeroaxis', 'ydata', 'ydtics', 'ylabel', 'ymtics',
- 'yrange', 'ytics', 'yzeroaxis', 'zdata', 'zdtics', 'cbdata', 'cbdtics',
- 'zero', 'zeroaxis', 'zlabel', 'zmtics', 'zrange', 'ztics', 'cblabel',
- 'cbmtics', 'cbrange', 'cbtics'
-})
-
--- Identifiers.
-local identifier = token(l.IDENTIFIER, l.word)
-
--- Operators.
-local operator = token(l.OPERATOR, S('-+~!$*%=<>&|^?:()'))
-
-M._rules = {
- {'whitespace', ws},
- {'keyword', keyword},
- {'function', func},
- {'variable', variable},
- {'identifier', identifier},
- {'string', string},
- {'comment', comment},
- {'operator', operator},
-}
-
-return M