aboutsummaryrefslogtreecommitdiff
path: root/lua/lexers/xs.lua
diff options
context:
space:
mode:
authororbitalquark <70453897+orbitalquark@users.noreply.github.com>2024-09-18 14:30:49 -0400
committerRandy Palamar <randy@rnpnr.xyz>2025-01-04 12:29:07 -0700
commitc1f4d3f68787fa2ae964c468d28a84df37319b28 (patch)
treedcd62bd74f8f9fd786cba6a0c248fb388d5244a8 /lua/lexers/xs.lua
parentcc18cea14d1f836abcebb84a96f5029431474255 (diff)
downloadvis-c1f4d3f68787fa2ae964c468d28a84df37319b28.tar.gz
vis-c1f4d3f68787fa2ae964c468d28a84df37319b28.tar.xz
lexers: switch to tabs for indentation
Diffstat (limited to 'lua/lexers/xs.lua')
-rw-r--r--lua/lexers/xs.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/lua/lexers/xs.lua b/lua/lexers/xs.lua
index 7527ecb..0973a6f 100644
--- a/lua/lexers/xs.lua
+++ b/lua/lexers/xs.lua
@@ -13,11 +13,11 @@ lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))
-- Keywords.
lex:add_rule('keyword', token(lexer.KEYWORD, word_match{
- 'access', 'alias', 'catch', 'cd', 'dirs', 'echo', 'else', 'escape', 'eval', 'exec', 'exit',
- 'false', 'fn-', 'fn', 'for', 'forever', 'fork', 'history', 'if', 'jobs', 'let', 'limit', 'local',
- 'map', 'omap', 'popd', 'printf', 'pushd', 'read', 'result', 'set-', 'switch', 'throw', 'time',
- 'true', 'umask', 'until', 'unwind-protect', 'var', 'vars', 'wait', 'whats', 'while', ':lt', ':le',
- ':gt', ':ge', ':eq', ':ne', '~', '~~', '...', '.'
+ 'access', 'alias', 'catch', 'cd', 'dirs', 'echo', 'else', 'escape', 'eval', 'exec', 'exit',
+ 'false', 'fn-', 'fn', 'for', 'forever', 'fork', 'history', 'if', 'jobs', 'let', 'limit', 'local',
+ 'map', 'omap', 'popd', 'printf', 'pushd', 'read', 'result', 'set-', 'switch', 'throw', 'time',
+ 'true', 'umask', 'until', 'unwind-protect', 'var', 'vars', 'wait', 'whats', 'while', ':lt', ':le',
+ ':gt', ':ge', ':eq', ':ne', '~', '~~', '...', '.'
}))
-- Identifiers.
@@ -27,12 +27,12 @@ lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
local str = lexer.range("'", false, true)
local herestr = '<<<' * str
local heredoc = '<<' * P(function(input, index)
- local s, e, _, delimiter = input:find('[ \t]*(["\']?)([%w!"%%+,-./:?@_~]+)%1', index)
- if s == index and delimiter then
- delimiter = delimiter:gsub('[%%+-.?]', '%%%1')
- e = select(2, input:find('[\n\r]' .. delimiter .. '[\n\r]', e))
- return e and e + 1 or #input + 1
- end
+ local s, e, _, delimiter = input:find('[ \t]*(["\']?)([%w!"%%+,-./:?@_~]+)%1', index)
+ if s == index and delimiter then
+ delimiter = delimiter:gsub('[%%+-.?]', '%%%1')
+ e = select(2, input:find('[\n\r]' .. delimiter .. '[\n\r]', e))
+ return e and e + 1 or #input + 1
+ end
end)
lex:add_rule('string', token(lexer.STRING, str + herestr + heredoc))
@@ -47,7 +47,7 @@ lex:add_rule('constant', token(lexer.CONSTANT, '$&' * lexer.word))
-- Variables.
lex:add_rule('variable',
- token(lexer.VARIABLE, '$' * S('"#')^-1 * ('*' + lexer.digit^1 + lexer.word)))
+ token(lexer.VARIABLE, '$' * S('"#')^-1 * ('*' + lexer.digit^1 + lexer.word)))
-- Operators.
lex:add_rule('operator', token(lexer.OPERATOR, S('@`=!<>*&^|;?()[]{}') + '\\\n'))