From 4567ec7e1281cae3feba3f2fb827f8cfbabf48f1 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Thu, 4 Jun 2026 11:51:38 -0500 Subject: Squashed commit of the following: ps1 change vis bind to lf cleaned up vis plugins added greyscript language server added asciidoc vis lexer --- env/.config/vis/lexers/asciidoc.lua | 33 +++++++++++++++++++++++++++++++++ env/.config/vis/lexers/greyscript.lua | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 env/.config/vis/lexers/asciidoc.lua create mode 100644 env/.config/vis/lexers/greyscript.lua (limited to 'env/.config/vis/lexers') 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 diff --git a/env/.config/vis/lexers/greyscript.lua b/env/.config/vis/lexers/greyscript.lua new file mode 100644 index 0000000..93f8359 --- /dev/null +++ b/env/.config/vis/lexers/greyscript.lua @@ -0,0 +1,33 @@ +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, S = lpeg.P, lpeg.S + +-- Create the lexer object +local lex = lexer.new('greyscript') + +-- 1. Whitespace +lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) + +-- 2. Keywords (Add your language keywords here) +lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[ + if then else end function return local +]])) + +-- 3. Identifiers +lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) + +-- 4. Strings (Double and Single quoted) +local sq_str = lexer.range("'") +local dq_str = lexer.range('"') +lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) + +-- 5. Comments (Example: # style comments) +lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) + +-- 6. Numbers +lex:add_rule('number', token(lexer.NUMBER, lexer.number)) + +-- 7. Operators +lex:add_rule('operator', token(lexer.OPERATOR, S('+-*/%^=<>,.{}[]()'))) + +return lex -- cgit v1.3