1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
use super::types::{CommandName, SectionLevel};
pub fn classify(name: &str) -> CommandName {
match name {
"begin" => CommandName::BeginEnvironment,
"end" => CommandName::EndEnvironment,
"[" => CommandName::BeginEquation,
"]" => CommandName::EndEquation,
"part" | "part*" => CommandName::Section(SectionLevel::Part),
"chapter" | "chapter*" => CommandName::Section(SectionLevel::Chapter),
"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),
"item" => CommandName::EnumItem,
"caption" => CommandName::Caption,
"cite" | "cite*" | "Cite" | "nocite" | "citet" | "citet*" | "citep" | "citep*"
| "citeauthor" | "citeauthor*" | "Citeauthor" | "Citeauthor*" | "citetitle"
| "citetitle*" | "citeyear" | "citeyear*" | "citedate" | "citedate*" | "citeurl"
| "fullcite" | "citeyearpar" | "citealt" | "citealp" | "citetext" | "parencite"
| "parencite*" | "Parencite" | "footcite" | "footfullcite" | "footcitetext"
| "textcite" | "Textcite" | "smartcite" | "supercite" | "autocite" | "autocite*"
| "Autocite" | "Autocite*" | "volcite" | "Volcite" | "pvolcite" | "Pvolcite"
| "fvolcite" | "ftvolcite" | "svolcite" | "Svolcite" | "tvolcite" | "Tvolcite"
| "avolcite" | "Avolcite" | "notecite" | "pnotecite" | "Pnotecite" | "fnotecite"
| "citeA" | "citeA*" => CommandName::Citation,
"usepackage" | "RequirePackage" => CommandName::PackageInclude,
"documentclass" => CommandName::ClassInclude,
"include" | "subfileinclude" | "input" | "subfile" => CommandName::LatexInclude,
"addbibresource" => CommandName::BiblatexInclude,
"bibliography" => CommandName::BibtexInclude,
"includegraphics" => CommandName::GraphicsInclude,
"includesvg" => CommandName::SvgInclude,
"includeinkscape" => CommandName::InkscapeInclude,
"verbatiminput" | "VerbatimInput" => CommandName::VerbatimInclude,
"import" | "subimport" | "inputfrom" | "subinputfrom" | "subincludefrom" => {
CommandName::Import
}
"label" => CommandName::LabelDefinition,
"ref" | "vref" | "Vref" | "autoref" | "pageref" | "cref" | "cref*" | "Cref" | "Cref*"
| "namecref" | "nameCref" | "lcnamecref" | "namecrefs" | "nameCrefs" | "lcnamecrefs"
| "labelcref" | "labelcpageref" | "eqref" => CommandName::LabelReference,
"crefrange" | "crefrange*" | "Crefrange" | "Crefrange*" => CommandName::LabelReferenceRange,
"newlabel" => CommandName::LabelNumber,
"newcommand"
| "newcommand*"
| "renewcommand"
| "renewcommand*"
| "DeclareRobustCommand"
| "DeclareRobustCommand*" => CommandName::CommandDefinition,
"DeclareMathOperator" | "DeclareMathOperator*" => CommandName::MathOperator,
"newglossaryentry" => CommandName::GlossaryEntryDefinition,
"gls" | "Gls" | "GLS" | "glspl" | "Glspl" | "GLSpl" | "glsdisp" | "glslink" | "glstext"
| "Glstext" | "GLStext" | "glsfirst" | "Glsfirst" | "GLSfirst" | "glsplural"
| "Glsplural" | "GLSplural" | "glsfirstplural" | "Glsfirstplural" | "GLSfirstplural"
| "glsname" | "Glsname" | "GLSname" | "glssymbol" | "Glssymbol" | "glsdesc" | "Glsdesc"
| "GLSdesc" | "glsuseri" | "Glsuseri" | "GLSuseri" | "glsuserii" | "Glsuserii"
| "glsuseriii" | "glsuseriv" | "Glsuseriv" | "GLSuseriv" | "glsuserv" | "Glsuserv"
| "GLSuserv" | "glsuservi" | "Glsuservi" | "GLSuservi" => {
CommandName::GlossaryEntryReference
}
"newacronym" | "newacro" | "acrodef" | "acro" | "newacroindefinite"
| "acrodefindefinite" | "acroindefinite" | "acroplural" | "newacroplural"
| "acrodefplural" => CommandName::AcronymDefinition,
"DeclareAcronym" => CommandName::AcronymDeclaration,
"acrshort" | "Acrshort" | "ACRshort" | "acrshortpl" | "Acrshortpl" | "ACRshortpl"
| "acrlong" | "Acrlong" | "ACRlong" | "acrlongpl" | "Acrlongpl" | "ACRlongpl"
| "acrfull" | "Acrfull" | "ACRfull" | "acrfullpl" | "Acrfullpl" | "ACRfullpl" | "acs"
| "Acs" | "acsp" | "Acsp" | "acl" | "Acl" | "aclp" | "Aclp" | "acf" | "Acf" | "acfi"
| "Acfi" | "acfp" | "Acfp" | "ac" | "Ac" | "acp" | "Acp" | "acused" | "acsu" | "Aclu"
| "iac" | "Iac" | "acs*" | "Acs*" | "acsp*" | "Acsp*" | "acl*" | "Acl*" | "aclp*"
| "Aclp*" | "acf*" | "Acf*" | "acfi*" | "Acfi*" | "acfp*" | "Acfp*" | "ac*" | "Ac*"
| "acp*" | "Acp*" | "acused*" | "acsu*" | "Aclu*" | "iac*" | "Iac*" | "glsentrylong"
| "Glsentrylong" | "glsentrylongpl" | "Glsentrylongpl" | "glsentryshort"
| "Glsentryshort" | "glsentryshortpl" | "Glsentryshortpl" | "glsentryfullpl"
| "Glsentryfullpl" => CommandName::AcronymReference,
"newtheorem" | "newtheorem*" | "declaretheorem" | "declaretheorem*" => {
CommandName::TheoremDefinition
}
"color" | "colorbox" | "textcolor" | "pagecolor" => CommandName::ColorReference,
"definecolor" => CommandName::ColorDefinition,
"definecolorset" => CommandName::ColorSetDefinition,
"usepgflibrary" | "usetikzlibrary" => CommandName::TikzLibraryImport,
"newenvironment" | "newenvironment*" | "renewenvironment" | "renewenvironment*" => {
CommandName::EnvironmentDefinition
}
"graphicspath" => CommandName::GraphicsPath,
"iffalse" => CommandName::BeginBlockComment,
"fi" => CommandName::EndBlockComment,
_ => CommandName::Generic,
}
}
|