mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
RST: use any-of? instead of match? (#1678)
This commit is contained in:
parent
1e8016d92d
commit
9a98ed1f96
2 changed files with 42 additions and 10 deletions
|
|
@ -30,10 +30,18 @@
|
||||||
|
|
||||||
((directive
|
((directive
|
||||||
name: (type) @function.builtin)
|
name: (type) @function.builtin)
|
||||||
(#match?
|
(#any-of?
|
||||||
@function.builtin
|
@function.builtin
|
||||||
; https://docutils.sourceforge.io/docs/ref/rst/directives.html
|
; 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
|
;; Blocks
|
||||||
|
|
||||||
|
|
@ -79,10 +87,26 @@
|
||||||
(role) @function
|
(role) @function
|
||||||
|
|
||||||
((role) @function.builtin
|
((role) @function.builtin
|
||||||
(#match?
|
(#any-of?
|
||||||
@function.builtin
|
@function.builtin
|
||||||
; https://docutils.sourceforge.io/docs/ref/rst/roles.html
|
; 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"
|
"interpreted_text"
|
||||||
|
|
|
||||||
|
|
@ -4,25 +4,33 @@
|
||||||
((directive
|
((directive
|
||||||
name: (type) @_type
|
name: (type) @_type
|
||||||
body: (body) @rst)
|
body: (body) @rst)
|
||||||
(#match?
|
(#any-of?
|
||||||
@_type
|
@_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
|
;; Directives with nested content without arguments, but with options
|
||||||
((directive
|
((directive
|
||||||
name: (type) @_type
|
name: (type) @_type
|
||||||
body: (body (options) (content) @rst))
|
body: (body (options) (content) @rst))
|
||||||
(#match?
|
(#any-of?
|
||||||
@_type
|
@_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
|
;; Directives with nested content with arguments and options
|
||||||
((directive
|
((directive
|
||||||
name: (type) @_type
|
name: (type) @_type
|
||||||
body: (body (content) @rst))
|
body: (body (content) @rst))
|
||||||
(#match?
|
(#any-of?
|
||||||
@_type
|
@_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
|
;; Special directives
|
||||||
((directive
|
((directive
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue