1
This commit is contained in:
Alex Yatskov 2024-04-21 17:20:57 -07:00
parent dd92d559c8
commit df5b365abf
2 changed files with 55 additions and 0 deletions

View File

@ -1,4 +1,5 @@
local config = require('argonaut.config') local config = require('argonaut.config')
local types = require('argonaut.types')
local function setup(opts, filetypes) local function setup(opts, filetypes)
config.set(opts, filetypes) config.set(opts, filetypes)

54
lua/argonaut/types.lua Normal file
View File

@ -0,0 +1,54 @@
Cursor = {}
function Cursor.new(x, y)
local cursor = {
x = x,
y = y,
}
return setmetatable(cursor, {__index = Cursor})
end
function Cursor:print()
print('x: ' .. self.x .. ' y: ' .. self.y)
end
BracePair = {}
function BracePair.new(brace)
local escape = function(brace_raw)
if brace_raw == '[' or brace_raw == ']' then
return '\\' .. brace_raw
else
return brace_raw
end
end
for _, brace_set in ipairs({{'(', ')'}, {'[', ']'}, {'{', '}'}, {'<', '>'}}) do
if brace_set[1] == brace or brace_set[2] == brace then
local brace_pair = {
open = brace_set[1],
close = brace_set[2],
escaped = {
open = escape(brace_set[1]),
closed = escape(brace_set[2]),
}
}
return setmetatable(brace_pair, {__index = BracePair})
end
end
end
BraceRange = {}
function BraceRange.new(start_cursor, stop_cursor, brace_pair, brace_params)
local brace_range = {
start_cursor = start_cursor,
stop_cursor = stop_cursor,
brace_pair = brace_pair,
brace_params = brace_params or {},
}
return setmetatable(brace_range, {__index = BraceRange})
end