on master help sign in
add tree-sitter-edoc (#2640)

* add tree-sitter-edoc * fix escape character capture in markdown queries * add field negation operator "!" to tsq highlights

commit42d780b1037f36bd37e2a8dc40b5e9bb95fb5be7 authorMichael Davis <mcarsondavis@gmail.com> dateThu 2 Jun 2022, 18:41 (4 years ago) parent4f3d0a7
7 files changed+88−4
book/src/generated/lang-support.md+1 languages.toml+13−1 runtime/queries/edoc/highlights.scm+50 runtime/queries/edoc/injections.scm+20 runtime/queries/erlang/injections.scm+2−2 runtime/queries/markdown/highlights.scm+1−1 runtime/queries/tsq/highlights.scm+1
book/src/generated/lang-support.md+1
@@ -12,6 +12,7 @@
1212| dart | ✓ | | ✓ | `dart` |
1313| devicetree | ✓ | | ✓ | |
1414| dockerfile | ✓ | | | `docker-langserver` |
15+| edoc | ✓ | | | |
1516| eex | ✓ | | | |
1617| ejs | ✓ | | | |
1718| elixir | ✓ | | | `elixir-ls` |
languages.toml+13−1
@@ -1049,7 +1049,7 @@ language-server = { command = "erlang_ls" }
10491049
10501050[[grammar]]
10511051name = "erlang"
1052−source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "6cd8f956ada445b277de1581b5328ae8e8be9aac" }
1052+source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "481e7f8ddf27f07a47d1531b6e2b154b89ece31d" }
10531053
10541054[[language]]
10551055name = "kotlin"
@@ -1409,3 +1409,15 @@ injection-regex = "verilog"
14091409[[grammar]]
14101410name = "verilog"
14111411source = { git = "https://github.com/andreytkachenko/tree-sitter-verilog", rev = "514d8d70593d29ef3ef667fa6b0e504ae7c977e3" }
1412+
1413+[[language]]
1414+name = "edoc"
1415+scope = "source.edoc"
1416+file-types = ["edoc", "edoc.in"]
1417+injection-regex = "edoc"
1418+roots = []
1419+indent = { tab-width = 4, unit = " " }
1420+
1421+[[grammar]]
1422+name = "edoc"
1423+source = { git = "https://github.com/the-mikedavis/tree-sitter-edoc", rev = "1691ec0aa7ad1ed9fa295590545f27e570d12d60" }
runtime/queries/edoc/highlights.scmnew file+50
@@ -0,0 +1,50 @@
1+((section
2+ (section_marker) @markup.heading.marker
3+ (section_content) @markup.heading.1
4+ (section_marker) @markup.heading.marker)
5+ (#eq? @markup.heading.marker "=="))
6+
7+((section
8+ (section_marker) @markup.heading.marker
9+ (section_content) @markup.heading.2
10+ (section_marker) @markup.heading.marker)
11+ (#eq? @markup.heading.marker "==="))
12+
13+((section
14+ (section_marker) @markup.heading.marker
15+ (section_content) @markup.heading.3
16+ (section_marker) @markup.heading.marker)
17+ (#eq? @markup.heading.marker "===="))
18+
19+(macro (tag) @function.macro)
20+(tag) @keyword
21+(macro_escape) @constant.character.escape
22+(inline_quote) @markup.raw.inline
23+(email_address) @markup.link.url
24+
25+(em_xhtml_tag
26+ (open_xhtml_tag) @tag
27+ (xhtml_tag_content) @markup.italic
28+ (close_xhtml_tag) @tag)
29+
30+(strong_xhtml_tag
31+ (open_xhtml_tag) @tag
32+ (xhtml_tag_content) @markup.bold
33+ (close_xhtml_tag) @tag)
34+
35+(module) @namespace
36+(function) @function
37+(type) @type
38+
39+; could be @constant.numeric.integer but this looks similar to a capture
40+(arity) @operator
41+
42+[":" "/"] @operator
43+["(" ")"] @punctuation.delimiter
44+["{" "}"] @function.macro
45+
46+[
47+ (quote_marker)
48+ (language_identifier)
49+ (quote_content)
50+] @markup.raw.block
runtime/queries/edoc/injections.scmnew file+20
@@ -0,0 +1,20 @@
1+((xhtml_tag) @injection.content
2+ (#set! injection.combined)
3+ (#set! injection.include-children)
4+ (#set! injection.language "html"))
5+
6+((block_quote
7+ !language
8+ (quote_content) @injection.content)
9+ (#set! injection.language "erlang"))
10+
11+(block_quote
12+ language: (language_identifier) @injection.language
13+ (quote_content) @injection.content)
14+
15+((macro
16+ (tag) @_tag
17+ (argument) @injection.content)
18+ (#eq? @_tag "@type")
19+ (#set injection.language "erlang")
20+ (#set injection.include-children))
runtime/queries/erlang/injections.scm+2−2
@@ -1,2 +1,2 @@
1−((comment) @injection.content
2− (#set! injection.language "comment"))
1+((comment_content) @injection.content
2+ (#set! injection.language "edoc"))
runtime/queries/markdown/highlights.scm+1−1
@@ -45,5 +45,5 @@
4545[
4646 (backslash_escape)
4747 (hard_line_break)
48−] @string.character.escape
48+] @constant.character.escape
4949
runtime/queries/tsq/highlights.scm+1
@@ -16,6 +16,7 @@
1616] @punctuation.bracket
1717
1818":" @punctuation.delimiter
19+"!" @operator
1920
2021[
2122 (one_or_more)