Advance native LaTeX execution and preview
This commit is contained in:
1 parent
91f9d76b16
commit
2741546ca8
414 files changed
+99872
-933
No files matched your search
@@ -0,0 +1,45 @@
|
||||
//! Source provenance retained with measured paint, never reconstructed by text.
|
||||
use crate::execution::TokenOrigin;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub enum Derivation {
|
||||
FontProgram,
|
||||
Hyphenation,
|
||||
Fraction,
|
||||
Delimiter,
|
||||
Radical,
|
||||
Accent,
|
||||
MathVariant,
|
||||
MathRule,
|
||||
}
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PaintSource {
|
||||
pub tokens: Vec<TokenOrigin>,
|
||||
pub derivations: Vec<Derivation>,
|
||||
}
|
||||
impl PaintSource {
|
||||
pub fn token(origin: TokenOrigin) -> Self {
|
||||
Self {
|
||||
tokens: vec![origin],
|
||||
derivations: Vec::new(),
|
||||
}
|
||||
}
|
||||
pub fn merge(&mut self, other: &Self) {
|
||||
for token in &other.tokens {
|
||||
if !self.tokens.contains(token) {
|
||||
self.tokens.push(*token);
|
||||
}
|
||||
}
|
||||
for derivation in &other.derivations {
|
||||
if !self.derivations.contains(derivation) {
|
||||
self.derivations.push(*derivation);
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn derived(mut self, derivation: Derivation) -> Self {
|
||||
if !self.derivations.contains(&derivation) {
|
||||
self.derivations.push(derivation);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user