diff options
| author | orbitalquark <70453897+orbitalquark@users.noreply.github.com> | 2024-09-18 14:30:49 -0400 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2025-01-04 12:29:07 -0700 |
| commit | c1f4d3f68787fa2ae964c468d28a84df37319b28 (patch) | |
| tree | dcd62bd74f8f9fd786cba6a0c248fb388d5244a8 /lua/lexers/rc.lua | |
| parent | cc18cea14d1f836abcebb84a96f5029431474255 (diff) | |
| download | vis-c1f4d3f68787fa2ae964c468d28a84df37319b28.tar.gz vis-c1f4d3f68787fa2ae964c468d28a84df37319b28.tar.xz | |
lexers: switch to tabs for indentation
Diffstat (limited to 'lua/lexers/rc.lua')
| -rw-r--r-- | lua/lexers/rc.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lua/lexers/rc.lua b/lua/lexers/rc.lua index 2e1cfd0..ac25650 100644 --- a/lua/lexers/rc.lua +++ b/lua/lexers/rc.lua @@ -12,8 +12,8 @@ lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) -- Keywords. lex:add_rule('keyword', token(lexer.KEYWORD, word_match{ - 'for', 'in', 'while', 'if', 'not', 'switch', 'case', 'fn', 'builtin', 'cd', 'eval', 'exec', - 'exit', 'flag', 'rfork', 'shift', 'ulimit', 'umask', 'wait', 'whatis', '.', '~' + 'for', 'in', 'while', 'if', 'not', 'switch', 'case', 'fn', 'builtin', 'cd', 'eval', 'exec', + 'exit', 'flag', 'rfork', 'shift', 'ulimit', 'umask', 'wait', 'whatis', '.', '~' })) -- Identifiers. @@ -22,12 +22,12 @@ lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) -- Strings. local str = lexer.range("'", false, false) 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 + heredoc)) @@ -39,7 +39,7 @@ lex:add_rule('number', token(lexer.NUMBER, lexer.number)) -- 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')) |
