diff options
author | Norbert Preining <norbert@preining.info> | 2023-06-08 03:01:59 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-06-08 03:01:59 +0000 |
commit | 538e6d6e7c75b7cca5470604811205f9dbd55c03 (patch) | |
tree | 4807afb694acc9e4ecff2d466d5e37788127d6fb /support/texlab/crates/parser/src/latex | |
parent | 5c99135c06494b236cce7fd76e346851cf8c4408 (diff) |
CTAN sync 202306080301
Diffstat (limited to 'support/texlab/crates/parser/src/latex')
-rw-r--r-- | support/texlab/crates/parser/src/latex/lexer/commands.rs | 11 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex/lexer/types.rs | 10 |
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, } |