mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
Parsers: add reStructuredText
This commit is contained in:
parent
121c44a23b
commit
6f01384cb2
9 changed files with 186 additions and 4 deletions
81
queries/rst/highlights.scm
Normal file
81
queries/rst/highlights.scm
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
; Marks
|
||||
|
||||
[
|
||||
".."
|
||||
"|"
|
||||
"--"
|
||||
"__"
|
||||
"::"
|
||||
"bullet"
|
||||
"adornment"
|
||||
(transition)
|
||||
] @punctuation.special
|
||||
|
||||
; Directives
|
||||
|
||||
(directive
|
||||
name: (type) @function)
|
||||
|
||||
((directive
|
||||
name: (type) @include)
|
||||
(#match? @include "^include::$"))
|
||||
|
||||
; Blocks
|
||||
|
||||
[
|
||||
(literal_block)
|
||||
(line_block)
|
||||
(block_quote)
|
||||
(doctest_block)
|
||||
] @text.literal
|
||||
|
||||
(substitution_definition
|
||||
name: (substitution) @constant)
|
||||
|
||||
(footnote
|
||||
name: (label) @constant)
|
||||
|
||||
(citation
|
||||
name: (label) @constant)
|
||||
|
||||
(target
|
||||
name: (reference)? @constant
|
||||
link: (_) @text.literal)
|
||||
|
||||
; Inline markup
|
||||
|
||||
(emphasis) @text.emphasis
|
||||
|
||||
(strong) @text.strong
|
||||
|
||||
(standalone_hyperlink) @text.uri
|
||||
|
||||
[
|
||||
(interpreted_text)
|
||||
(literal)
|
||||
] @text.literal
|
||||
|
||||
[
|
||||
(target)
|
||||
(substitution_reference)
|
||||
(footnote_reference)
|
||||
(citation_reference)
|
||||
(reference)
|
||||
] @constant
|
||||
|
||||
; Embedded
|
||||
|
||||
(doctest_block) @embed
|
||||
(directive
|
||||
body: (body) @embed)
|
||||
|
||||
; Others
|
||||
|
||||
(title) @text.title
|
||||
|
||||
(attribution) @text.emphasis
|
||||
|
||||
(comment) @comment
|
||||
(comment "..") @comment
|
||||
|
||||
(ERROR) @error
|
||||
31
queries/rst/locals.scm
Normal file
31
queries/rst/locals.scm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
;; Scopes
|
||||
|
||||
(document) @scope
|
||||
|
||||
(directive) @scope
|
||||
|
||||
;; Definitions
|
||||
|
||||
(substitution_definition
|
||||
name: (substitution) @definition)
|
||||
|
||||
(footnote
|
||||
name: (label) @definition)
|
||||
|
||||
(citation
|
||||
name: (label) @definition)
|
||||
|
||||
(target
|
||||
name: (reference) @definition)
|
||||
|
||||
; Inline targets
|
||||
(target) @definition
|
||||
|
||||
;; References
|
||||
|
||||
[
|
||||
(substitution_reference)
|
||||
(footnote_reference)
|
||||
(citation_reference)
|
||||
(reference)
|
||||
] @reference
|
||||
2
queries/rst/textobjects.scm
Normal file
2
queries/rst/textobjects.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(directive
|
||||
body: (body) @function.inner) @function.outer
|
||||
Loading…
Add table
Add a link
Reference in a new issue