From 42d780b1037f36bd37e2a8dc40b5e9bb95fb5be7 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 2 Jun 2022 18:41:17 -0500 Subject: add tree-sitter-edoc (#2640) * add tree-sitter-edoc * fix escape character capture in markdown queries * add field negation operator "!" to tsq highlights--- runtime/queries/edoc/highlights.scm | 50 +++++++++++++++++++++++++++++++++++++ runtime/queries/edoc/injections.scm | 20 +++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 runtime/queries/edoc/highlights.scm create mode 100644 runtime/queries/edoc/injections.scm (limited to 'runtime/queries/edoc') diff --git a/runtime/queries/edoc/highlights.scm b/runtime/queries/edoc/highlights.scm new file mode 100644 index 00000000..3a309960 --- /dev/null +++ b/runtime/queries/edoc/highlights.scm @@ -0,0 +1,50 @@ +((section + (section_marker) @markup.heading.marker + (section_content) @markup.heading.1 + (section_marker) @markup.heading.marker) + (#eq? @markup.heading.marker "==")) + +((section + (section_marker) @markup.heading.marker + (section_content) @markup.heading.2 + (section_marker) @markup.heading.marker) + (#eq? @markup.heading.marker "===")) + +((section + (section_marker) @markup.heading.marker + (section_content) @markup.heading.3 + (section_marker) @markup.heading.marker) + (#eq? @markup.heading.marker "====")) + +(macro (tag) @function.macro) +(tag) @keyword +(macro_escape) @constant.character.escape +(inline_quote) @markup.raw.inline +(email_address) @markup.link.url + +(em_xhtml_tag + (open_xhtml_tag) @tag + (xhtml_tag_content) @markup.italic + (close_xhtml_tag) @tag) + +(strong_xhtml_tag + (open_xhtml_tag) @tag + (xhtml_tag_content) @markup.bold + (close_xhtml_tag) @tag) + +(module) @namespace +(function) @function +(type) @type + +; could be @constant.numeric.integer but this looks similar to a capture +(arity) @operator + +[":" "/"] @operator +["(" ")"] @punctuation.delimiter +["{" "}"] @function.macro + +[ + (quote_marker) + (language_identifier) + (quote_content) +] @markup.raw.block diff --git a/runtime/queries/edoc/injections.scm b/runtime/queries/edoc/injections.scm new file mode 100644 index 00000000..9630995b --- /dev/null +++ b/runtime/queries/edoc/injections.scm @@ -0,0 +1,20 @@ +((xhtml_tag) @injection.content + (#set! injection.combined) + (#set! injection.include-children) + (#set! injection.language "html")) + +((block_quote + !language + (quote_content) @injection.content) + (#set! injection.language "erlang")) + +(block_quote + language: (language_identifier) @injection.language + (quote_content) @injection.content) + +((macro + (tag) @_tag + (argument) @injection.content) + (#eq? @_tag "@type") + (#set injection.language "erlang") + (#set injection.include-children)) -- cgit v1.2.3-70-g09d2