aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJames Trew <j.trew10@gmail.com>2024-05-02 23:33:22 -0400
committerLewis Russell <me@lewisr.dev>2024-05-07 14:33:14 +0100
commit93940af1d456ec52f39cb2912b5ffb8445d26c98 (patch)
tree3aa4f9394120760fd022fef1576d4f10c4e0045f /scripts
parentc3c673cdeca25594454f8721e725e6ff1127e2a8 (diff)
downloadrneovim-93940af1d456ec52f39cb2912b5ffb8445d26c98.tar.gz
rneovim-93940af1d456ec52f39cb2912b5ffb8445d26c98.tar.bz2
rneovim-93940af1d456ec52f39cb2912b5ffb8445d26c98.zip
docs(luacats): support backtick captured generic type
Problem: While LuaCATS's generics system are still considered WIP by luals, they currently support type captured generics. See "Capture with Backtick" example: https://luals.github.io/wiki/annotations/#generic Solution: Add support for it in the LuaCATS grammar
Diffstat (limited to 'scripts')
-rw-r--r--scripts/luacats_grammar.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/luacats_grammar.lua b/scripts/luacats_grammar.lua
index ca26c70156..29f3bda5aa 100644
--- a/scripts/luacats_grammar.lua
+++ b/scripts/luacats_grammar.lua
@@ -170,7 +170,7 @@ local grammar = P {
ltype = parenOpt(v.ty_union),
ty_union = v.ty_opt * rep(Pf('|') * v.ty_opt),
- ty = v.ty_fun + ident + v.ty_table + literal + paren(v.ty),
+ ty = v.ty_fun + ident + v.ty_table + literal + paren(v.ty) + v.ty_generic,
ty_param = Pf('<') * comma1(v.ltype) * fill * P('>'),
ty_opt = v.ty * opt(v.ty_param) * opt(P('[]')) * opt(P('?')),
ty_index = (Pf('[') * (v.ltype + ident + rep1(num)) * fill * P(']')),
@@ -179,6 +179,7 @@ local grammar = P {
ty_table = Pf('{') * comma1(v.table_elem) * fill * P('}'),
fun_param = lname * opt(colon * v.ltype),
ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.ltype)),
+ ty_generic = P('`') * letter * P('`'),
}
return grammar --[[@as nvim.luacats.grammar]]