From 622baacdc1b22cdfd73bc98c07bb5654a090bcac Mon Sep 17 00:00:00 2001 From: Matthew Gramigna Date: Wed, 18 Jan 2023 09:58:45 -0800 Subject: parsers: Add FHIR Shorthand (FSH) (#4052) --- README.md | 1 + lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 9 ++++ queries/fsh/highlights.scm | 91 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 queries/fsh/highlights.scm diff --git a/README.md b/README.md index e7f5c371d..268e83a00 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z) - [x] [foam](https://github.com/FoamScience/tree-sitter-foam) (experimental, maintained by @FoamScience) - [ ] [fortran](https://github.com/stadelmanma/tree-sitter-fortran) +- [x] [fsh](https://github.com/mgramigna/tree-sitter-fsh) (maintained by @mgramigna) - [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn) - [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @Shatur) - [x] [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) (maintained by @gbprod) diff --git a/lockfile.json b/lockfile.json index 49ae62789..3ff1d29f7 100644 --- a/lockfile.json +++ b/lockfile.json @@ -107,6 +107,9 @@ "fortran": { "revision": "edcb3374f4698aaedf24bc572f6b2f5ef0e89ac7" }, + "fsh": { + "revision": "f5b0489d44e588b0d5d77f5c5f50a20491c44441" + }, "fusion": { "revision": "19db2f47ba4c3a0f6238d4ae0e2abfca16e61dd6" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 96aeac08d..1bf5ea224 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -242,6 +242,15 @@ list.rust = { maintainers = { "@vigoux" }, } +list.fsh = { + install_info = { + url = "https://github.com/mgramigna/tree-sitter-fsh", + files = { "src/parser.c" }, + branch = "main", + }, + maintainers = { "@mgramigna" }, +} + list.fusion = { install_info = { url = "https://gitlab.com/jirgn/tree-sitter-fusion.git", diff --git a/queries/fsh/highlights.scm b/queries/fsh/highlights.scm new file mode 100644 index 000000000..ccc93fc56 --- /dev/null +++ b/queries/fsh/highlights.scm @@ -0,0 +1,91 @@ +[ + "(" + ")" +] @punctuation.bracket + +[ + "^" + "=" + ":" +] @operator + +[ + "#" + ".." + "*" + "->" +] @punctuation.special + +; Entities +[ + "Profile" + "Alias" + "Extension" + "Invariant" + "Instance" + "ValueSet" + "CodeSystem" + "Mapping" + "Logical" + "Resource" + "RuleSet" +] @keyword + +; Metadata Keywords +[ + "Parent" + "Title" + "Description" + "Id" + "Severity" + "InstanceOf" + "Usage" + "Source" + "XPath" + "Target" +] @keyword + +; Rule Keywords +[ + "contentReference" + "insert" + "and" + "or" + "contains" + "named" + "only" + "obeys" + "valueset" + "codes" + "from" + "include" + "exclude" + "where" + "system" + "exactly" +] @keyword.operator + +; Types +[ + "Reference" + "Canonical" +] @type.builtin + + +(sd_metadata (parent (name))) @type +(target_type (name)) @type + +; Strings +(string) @string @spell +(multiline_string) @string @spell + +; Constants +(strength_value) @constant +(bool) @constant.boolean +(flag) @constant + +; Special Params +(code_value) @parameter + +; Extras +(fsh_comment) @comment @spell -- cgit v1.2.3-70-g09d2