aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/c_grammar.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-04-08 10:38:30 +0200
committerGitHub <noreply@github.com>2023-04-08 10:38:30 +0200
commit72d5a13e55e94bdebfffab5f656f553bb76c7b10 (patch)
tree1d715a4a8fd80371775c46a5b82767c8a78580ed /src/nvim/generators/c_grammar.lua
parentbc66b755f61ba0e3383177b2866e05557ffa3966 (diff)
parentefb0896f21e03f64e3a14e7c09994e81956f47b9 (diff)
downloadrneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.tar.gz
rneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.tar.bz2
rneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.zip
Merge pull request #22873 from bfredl/keyset2
refactor(api): make typed dicts appear as real types in the source code
Diffstat (limited to 'src/nvim/generators/c_grammar.lua')
-rw-r--r--src/nvim/generators/c_grammar.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/generators/c_grammar.lua b/src/nvim/generators/c_grammar.lua
index 3e89b60b4a..17a224fd22 100644
--- a/src/nvim/generators/c_grammar.lua
+++ b/src/nvim/generators/c_grammar.lua
@@ -55,5 +55,11 @@ local c_proto = Ct(
fill * P(';')
)
-local grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
+local c_field = Ct(Cg(c_id, 'type') * ws * Cg(c_id, 'name') * fill * P(';') * fill)
+local c_keyset = Ct(
+ P('typedef') * ws * P('struct') * fill * P('{') * fill *
+ Cg(Ct(c_field ^ 1), 'fields') *
+ P('}') * fill * P('Dict') * fill * P('(') * Cg(c_id, 'keyset_name') * fill * P(')') * P(';'))
+
+local grammar = Ct((c_proto + c_comment + c_preproc + ws + c_keyset) ^ 1)
return {grammar=grammar, typed_container=typed_container}