summaryrefslogtreecommitdiff
path: root/support/texlab/crates/parser/src/latex
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/parser/src/latex')
-rw-r--r--support/texlab/crates/parser/src/latex/lexer/commands.rs11
-rw-r--r--support/texlab/crates/parser/src/latex/lexer/types.rs10
2 files changed, 13 insertions, 8 deletions
diff --git a/support/texlab/crates/parser/src/latex/lexer/commands.rs b/support/texlab/crates/parser/src/latex/lexer/commands.rs
index c5fe48e0c9..b6e1d11737 100644
--- a/support/texlab/crates/parser/src/latex/lexer/commands.rs
+++ b/support/texlab/crates/parser/src/latex/lexer/commands.rs
@@ -1,6 +1,6 @@
use crate::SyntaxConfig;
-use super::types::{CommandName, SectionLevel};
+use super::types::{CommandName, ParagraphLevel, SectionLevel};
pub fn classify(name: &str, config: &SyntaxConfig) -> CommandName {
match name {
@@ -13,8 +13,8 @@ pub fn classify(name: &str, config: &SyntaxConfig) -> CommandName {
"section" | "section*" => CommandName::Section(SectionLevel::Section),
"subsection" | "subsection*" => CommandName::Section(SectionLevel::Subsection),
"subsubsection" | "subsubsection*" => CommandName::Section(SectionLevel::Subsubsection),
- "paragraph" | "paragraph*" => CommandName::Section(SectionLevel::Paragraph),
- "subparagraph" | "subparagraph*" => CommandName::Section(SectionLevel::Subparagraph),
+ "paragraph" | "paragraph*" => CommandName::Paragraph(ParagraphLevel::Paragraph),
+ "subparagraph" | "subparagraph*" => CommandName::Paragraph(ParagraphLevel::Subparagraph),
"item" => CommandName::EnumItem,
"caption" => CommandName::Caption,
"usepackage" | "RequirePackage" => CommandName::PackageInclude,
@@ -67,9 +67,8 @@ pub fn classify(name: &str, config: &SyntaxConfig) -> CommandName {
| "Glsentrylong" | "glsentrylongpl" | "Glsentrylongpl" | "glsentryshort"
| "Glsentryshort" | "glsentryshortpl" | "Glsentryshortpl" | "glsentryfullpl"
| "Glsentryfullpl" => CommandName::AcronymReference,
- "newtheorem" | "newtheorem*" | "declaretheorem" | "declaretheorem*" => {
- CommandName::TheoremDefinition
- }
+ "newtheorem" | "newtheorem*" => CommandName::TheoremDefinitionAmsThm,
+ "declaretheorem" | "declaretheorem*" => CommandName::TheoremDefinitionThmTools,
"color" | "colorbox" | "textcolor" | "pagecolor" => CommandName::ColorReference,
"definecolor" => CommandName::ColorDefinition,
"definecolorset" => CommandName::ColorSetDefinition,
diff --git a/support/texlab/crates/parser/src/latex/lexer/types.rs b/support/texlab/crates/parser/src/latex/lexer/types.rs
index eea6ea3b44..607138a448 100644
--- a/support/texlab/crates/parser/src/latex/lexer/types.rs
+++ b/support/texlab/crates/parser/src/latex/lexer/types.rs
@@ -58,7 +58,7 @@ fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName {
return CommandName::Generic;
}
- while let Some(c) = chars.next() {
+ for c in chars {
match c {
'*' => {
lexer.bump(c.len_utf8());
@@ -87,6 +87,7 @@ pub enum CommandName {
BeginEquation,
EndEquation,
Section(SectionLevel),
+ Paragraph(ParagraphLevel),
EnumItem,
Caption,
Citation,
@@ -111,7 +112,8 @@ pub enum CommandName {
AcronymDefinition,
AcronymDeclaration,
AcronymReference,
- TheoremDefinition,
+ TheoremDefinitionAmsThm,
+ TheoremDefinitionThmTools,
ColorReference,
ColorDefinition,
ColorSetDefinition,
@@ -130,6 +132,10 @@ pub enum SectionLevel {
Section,
Subsection,
Subsubsection,
+}
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
+pub enum ParagraphLevel {
Paragraph,
Subparagraph,
}