diff options
| author | iceyrazor <iceyrazor@mailfence.com> | 2026-06-04 11:51:38 -0500 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2026-06-04 11:51:38 -0500 |
| commit | 4567ec7e1281cae3feba3f2fb827f8cfbabf48f1 (patch) | |
| tree | e50dcf6fb9706d7944f83389a175d3ea6fed2589 /env/.config/vis/lexers/asciidoc.lua | |
| parent | cffb4360557e74eb4ace93f9903965819c9b0689 (diff) | |
Squashed commit of the following:
ps1 change
vis bind to lf
cleaned up vis plugins
added greyscript language server
added asciidoc vis lexer
Diffstat (limited to 'env/.config/vis/lexers/asciidoc.lua')
| -rw-r--r-- | env/.config/vis/lexers/asciidoc.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/env/.config/vis/lexers/asciidoc.lua b/env/.config/vis/lexers/asciidoc.lua new file mode 100644 index 0000000..83d080b --- /dev/null +++ b/env/.config/vis/lexers/asciidoc.lua @@ -0,0 +1,33 @@ +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, S, B = lpeg.P, lpeg.S, lpeg.B + +local lex = lexer.new('asciidoc') + +-- AsciiDoc blocks: ==== and ---- +local adoc_block = lexer.range('====', '====', true, true, true) + lexer.range('----', '----', true, true, true) +lex:add_rule('block', token(lexer.PREPROCESSOR, lexer.range('====', '====', true, true, true) + lexer.range('----', '----', true, true, true))) +--lex:add_rule('block', token(lexer.EMPH, adoc_block)) + +-- Block: ---- must match full line +--lex:add_rule('block', token(lexer.EMPH, P('----') * P('\n') * (lexer.any - P('----'))^0 * P('----'))) + +-- Headers: Must be at start of line +lex:add_rule('header', token(lexer.KEYWORD, B('\n')^-1 * P('=')^1 * ' ' * lexer.nonnewline^1)) + +-- Bold: Prevent overlap with other syntax +lex:add_rule('bold', token(lexer.BOLD, P('*') * (lexer.any - S('*\n'))^1 * P('*'))) + +-- Italic +lex:add_rule('italic', token(lexer.ITALIC, P('_') * (lexer.any - S('_\n'))^1 * P('_'))) + +-- Links +lex:add_rule('link', token(lexer.CONSTANT, 'https?://' * lexer.nonnewline^1)) + +-- Comments +lex:add_rule('comment', token(lexer.COMMENT, P('//') * lexer.nonnewline^0)) + +-- Identifier (last) +lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) + +return lex |
