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
94
95
96
97
98
99
100
101
102
#![doc(html_root_url = "https://docs.rs/syntect/5.0.0")]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde_derive;
#[cfg(test)]
#[macro_use]
extern crate pretty_assertions;
#[cfg(any(feature = "dump-load", feature = "dump-create"))]
pub mod dumps;
#[cfg(feature = "parsing")]
pub mod easy;
#[cfg(feature = "html")]
mod escape;
pub mod highlighting;
#[cfg(feature = "html")]
pub mod html;
pub mod parsing;
pub mod util;
mod utils;
use std::io::Error as IoError;
#[cfg(feature = "plist-load")]
use crate::highlighting::{ParseThemeError, SettingsError};
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("Loading error: {0}")]
LoadingError(#[from] LoadingError),
#[cfg(feature = "parsing")]
#[error("Parsing error: {0}")]
ParsingError(#[from] crate::parsing::ParsingError),
#[error("Scope error: {0}")]
ScopeError(#[from] crate::parsing::ScopeError),
#[error("Formatting error: {0}")]
Fmt(#[from] std::fmt::Error),
#[error("IO Error: {0}")]
Io(#[from] IoError),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum LoadingError {
#[error("error finding all the files in a directory: {0}")]
WalkDir(#[from] walkdir::Error),
#[error("error reading a file: {0}")]
Io(#[from] IoError),
#[cfg(all(feature = "yaml-load", feature = "parsing"))]
#[error("{1}: {0}")]
ParseSyntax(#[source] crate::parsing::ParseSyntaxError, String),
#[cfg(feature = "metadata")]
#[error("Failed to parse JSON")]
ParseMetadata(#[from] serde_json::Error),
#[cfg(feature = "plist-load")]
#[error("Invalid syntax theme")]
ParseTheme(#[from] ParseThemeError),
#[cfg(feature = "plist-load")]
#[error("Invalid syntax theme settings")]
ReadSettings(#[from] SettingsError),
#[error("Invalid path")]
BadPath,
}