From 8256ca7bc3a81eba08a18caa9df15833608e6584 Mon Sep 17 00:00:00 2001 From: Alexis-Lapierre <128792625+Alexis-Lapierre@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:33:50 +0000 Subject: [PATCH] Add support for Xena OpenAutomation files (#10448) Add support for .xtc/.xoa/.xpc files * XTC stand for Xena Traffic Configuration * XOA stand for Xena OpenAutomation * XPC stand for Xena Port Configuration Theses three file time seems to be the most common file extension I encountered in the wild --- book/src/generated/lang-support.md | 1 + languages.toml | 11 +++++++++++ runtime/queries/xtc/highlights.scm | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 runtime/queries/xtc/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 24bf3eece..d00d65623 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -215,6 +215,7 @@ | wren | ✓ | ✓ | ✓ | | | xit | ✓ | | | | | xml | ✓ | | ✓ | | +| xtc | ✓ | | | | | yaml | ✓ | | ✓ | `yaml-language-server`, `ansible-language-server` | | yuck | ✓ | | | | | zig | ✓ | ✓ | ✓ | `zls` | diff --git a/languages.toml b/languages.toml index ea1607d84..cd6386713 100644 --- a/languages.toml +++ b/languages.toml @@ -3531,3 +3531,14 @@ comment-token = "#" [[grammar]] name = "ldif" source = { git = "https://github.com/kepet19/tree-sitter-ldif", rev = "0a917207f65ba3e3acfa9cda16142ee39c4c1aaa" } + +[[language]] +name = "xtc" +scope = "source.xtc" +# Accept Xena Traffic Configuration, Xena Port Configuration and Xena OpenAutomation +file-types = [ "xtc", "xpc", "xoa" ] +comment-token = ";" + +[[grammar]] +name = "xtc" +source = { git = "https://github.com/Alexis-Lapierre/tree-sitter-xtc", rev = "7bc11b736250c45e25cfb0215db2f8393779957e" } diff --git a/runtime/queries/xtc/highlights.scm b/runtime/queries/xtc/highlights.scm new file mode 100644 index 000000000..cb0bec6ae --- /dev/null +++ b/runtime/queries/xtc/highlights.scm @@ -0,0 +1,27 @@ +(parameter) @keyword + +(change_port) @function.special + +(template) @variable + +[ + (hex_argument) + (ipv4_argument) +] @attribute + +(numeric_argument) @constant.numeric + +(index) @tag + +(string_literal_argument) @string + +(string_argument) @constant.character + +(comment) @comment + +(port_comment) @label + +[ +("[") +("]") +] @punctuation.bracket