diff options
| author | Santos Gallegos <stsewd@protonmail.com> | 2021-08-08 12:37:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-08 12:37:08 -0500 |
| commit | 9a98ed1f96558c80e079c03635b9317bcb7ef24c (patch) | |
| tree | ce312eaaeef97a3130c223c5fb98d25a30610f46 | |
| parent | RST: add code-block to injections (#1677) (diff) | |
| download | nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar.gz nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar.bz2 nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar.lz nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar.xz nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.tar.zst nvim-treesitter-9a98ed1f96558c80e079c03635b9317bcb7ef24c.zip | |
RST: use `any-of?` instead of `match?` (#1678)
| -rw-r--r-- | queries/rst/highlights.scm | 32 | ||||
| -rw-r--r-- | queries/rst/injections.scm | 20 |
2 files changed, 42 insertions, 10 deletions
diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm index 470fa80f9..093891026 100644 --- a/queries/rst/highlights.scm +++ b/queries/rst/highlights.scm @@ -30,10 +30,18 @@ ((directive name: (type) @function.builtin) - (#match? + (#any-of? @function.builtin ; https://docutils.sourceforge.io/docs/ref/rst/directives.html - "^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(image|figure)|(topic|sidebar|line-block|parsed-literal|code|math|rubric|epigraph|highlights|pull-quote|compound|container)|(table|csv-table|list-table)|(contents|sectnum|section-numbering|header|footer)|(target-notes)|(meta)|(replace|unicode|date)|(raw|class|role|default-role|title|restructuredtext-test-directive)$")) + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "image" "figure" + "topic" "sidebar" "line-block" "parsed-literal" "code" "math" "rubric" "epigraph" "highlights" "pull-quote" "compound" "container" + "table" "csv-table" "list-table" + "contents" "sectnum" "section-numbering" "header" "footer" + "target-notes" + "meta" + "replace" "unicode" "date" + "raw" "class" "role" "default-role" "title" "restructuredtext-test-directive")) ;; Blocks @@ -79,10 +87,26 @@ (role) @function ((role) @function.builtin - (#match? + (#any-of? @function.builtin ; https://docutils.sourceforge.io/docs/ref/rst/roles.html - "^:(emphasis|literal|code|math|pep-reference|PEP|rfc-reference|RFC|strong|subscript|sub|superscript|sup|title-reference|title|t|raw):$")) + ":emphasis:" + ":literal:" + ":code:" + ":math:" + ":pep-reference:" + ":PEP:" + ":rfc-reference:" + ":RFC:" + ":strong:" + ":subscript:" + ":sub:" + ":superscript:" + ":sup:" + ":title-reference:" + ":title:" + ":t:" + ":raw:")) [ "interpreted_text" diff --git a/queries/rst/injections.scm b/queries/rst/injections.scm index a93ee0725..1d576ef6a 100644 --- a/queries/rst/injections.scm +++ b/queries/rst/injections.scm @@ -4,25 +4,33 @@ ((directive name: (type) @_type body: (body) @rst) - (#match? + (#any-of? @_type - "^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(line-block|parsed-literal|epigraph|highlights|pull-quote|compound)|(header|footer)|(meta)|(replace)$")) + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound" + "header" "footer" + "meta" + "replace")) ;; Directives with nested content without arguments, but with options ((directive name: (type) @_type body: (body (options) (content) @rst)) - (#match? + (#any-of? @_type - "^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(line-block|parsed-literal|compound)$")) + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "line-block" "parsed-literal" "compound")) ;; Directives with nested content with arguments and options ((directive name: (type) @_type body: (body (content) @rst)) - (#match? + (#any-of? @_type - "^(figure)|(topic|sidebar|container)|(table|list-table)|(class|role|restructuredtext-test-directive)$")) + "figure" + "topic" "sidebar" "container" + "table" "list-table" + "class" "role" "restructuredtext-test-directive")) ;; Special directives ((directive |
