latex: update queries

Make use of parser updates
* add `\{re}newenvironment`
* add `\DeclarePairedDelimiter{X}`
* add `\title` and `\author`
* add optional arguments to sectioning commands
* use builtin nodes for math environments
This commit is contained in:
Christian Clason 2022-04-14 11:06:08 +02:00 committed by Christian Clason
parent 6443a70e17
commit 94f19cad29
2 changed files with 42 additions and 61 deletions

View file

@ -8,6 +8,7 @@
(subparagraph)
(generic_environment)
(math_environment)
(comment_environment)
(displayed_equation)
] @fold

View file

@ -32,35 +32,11 @@
;; General environments
(begin
command: _ @text.environment
name: (curly_group_text
(text) @text.environment.name)
(#not-any-of? @text.environment.name
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
name: (curly_group_text (text) @text.environment.name))
(end
command: _ @text.environment
name: (curly_group_text
(text) @text.environment.name)
(#not-any-of? @text.environment.name
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
name: (curly_group_text (text) @text.environment.name))
;; Definitions and references
(new_command_definition
@ -73,10 +49,18 @@
command: _ @function.macro
declaration: (_) @function)
(environment_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
(theorem_definition
command: _ @function.macro
name: (curly_group_text (_) @text.environment.name))
(paired_delimiter_definition
command: _ @function.macro
declaration: (curly_group_command_name (_) @function))
(label_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
@ -121,69 +105,65 @@
[
(displayed_equation)
(inline_formula)
(math_set)
] @text.math
((generic_environment
(math_environment
(begin
command: _ @text.math
name: (curly_group_text
(text) @_env))) @text.math
(#any-of? @_env
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
((generic_environment
name: (curly_group_text (text) @text.math)))
(math_environment
(end
command: _ @text.math
name: (curly_group_text
(text) @_env))) @text.math
(#any-of? @_env
"displaymath" "displaymath*"
"equation" "equation*"
"multline" "multline*"
"eqnarray" "eqnarray*"
"align" "align*"
"array" "array*"
"split" "split*"
"alignat" "alignat*"
"gather" "gather*"
"flalign" "flalign*"))
name: (curly_group_text (text) @text.math)))
;; Sectioning
(title_declaration
command: _ @namespace
options: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(author_declaration
command: _ @namespace
authors: (curly_group_author_list
((command_name)? @function)
((author)+ @text.title)))
(chapter
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(part
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(section
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(subsection
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(subsubsection
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(paragraph
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
(subparagraph
command: _ @namespace
text: (curly_group) @text.title)
toc: (brack_group (_) @text.title)?
text: (curly_group (_) @text.title))
;; Beamer frames
(generic_environment