From aeb5ad8ae1c7f0165128b0be889fae967d46844d Mon Sep 17 00:00:00 2001 From: aMOPel <36712072+aMOPel@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:35:51 +0100 Subject: feat(nim): added nim parser and queries (#5556) * feat(nim): added nim parser and queries * correct scanner.cc to scanner.c Co-authored-by: Christian Clason * fix(nim): corrected capture for @function.macro * feat(nim highlights): added @field capture for discriminator field in object variant * bumped parser version, adapted highlights.scm and condensed injections.scm * improved nim_format_string highlights.scm * bump nim parser version again * removed overlap between queries for generalized strings in injections.scm * improved formattin] in nim_format_string/injections.scm Co-authored-by: ObserverOfTime * corrected asm parser name in injections.scm Co-authored-by: ObserverOfTime * improved formatting in highlights.scm Co-authored-by: ObserverOfTime * removed @error capture from highlights.scm Co-authored-by: ObserverOfTime * improved wording in comment in highlights.scm Co-authored-by: ObserverOfTime * removed priority from (dot_expression left: @none) capture, since it's at the end of the file anyways * removed comments listing unused captures * reverted @error capture in nim_format_string/highlights.scm back to @none * condensed string alternatives in injections.scm Co-authored-by: ObserverOfTime * condensed string alternatives in injections.scm (second part) Co-authored-by: ObserverOfTime * added comment to explain reasoning behind priority use * swapped order of @punctuation.delimiter and @operator to get rid of superfluous comment * moved macro and template keywords to @preproc capture * removed priorities in highlights.scm and shifted @parameter capture behind @type capture * improved formatting in locals.scm * added queries for missing cases of @definition.namespace capture in locals.scm * removed some trailing whitespace * added @namespace queries for highlights.scm * bumped parser version again * removed superfluous @type capture * removed `@type`s `has-ancestor` and removed `(_ (_ ...` structures, but added priorities * added missing @constant capture to some queries in highlights.scm * fixed priority numbers so they work when injecting nim (in markdown) * added @none captures back to injection targets * added (assembly_statement) injection query * added indent queries * removed indents.scm again * added some missing queries for dot_generic_call, concept_declaration and pragma_statement --------- Co-authored-by: Christian Clason Co-authored-by: ObserverOfTime --- lua/nvim-treesitter/parsers.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lua') diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 58796506c..ac0cda658 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1146,6 +1146,22 @@ list.nickel = { }, } +list.nim = { + install_info = { + url = "https://github.com/alaviss/tree-sitter-nim", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@aMOPel" }, +} + +list.nim_format_string = { + install_info = { + url = "https://github.com/aMOPel/tree-sitter-nim-format-string", + files = { "src/parser.c" }, + }, + maintainers = { "@aMOPel" }, +} + list.ninja = { install_info = { url = "https://github.com/alemuller/tree-sitter-ninja", -- cgit v1.2.3-70-g09d2