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,35 @@
|
||||
use super::*;
|
||||
impl Executor {
|
||||
pub(super) fn case_character(&self, value: i32) -> Result<char, Error> {
|
||||
self.check_input_character(value)?;
|
||||
u32::try_from(value)
|
||||
.ok()
|
||||
.and_then(char::from_u32)
|
||||
.ok_or_else(|| self.error("invalid case-code character number", self.current))
|
||||
}
|
||||
pub(super) fn change_case(
|
||||
&mut self,
|
||||
kind: CaseCode,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
let mut tokens = self.scan_group(files)?;
|
||||
for token in &mut tokens {
|
||||
self.tick()?;
|
||||
let c = match &mut token.kind {
|
||||
TokenKind::Character(c, _) | TokenKind::Command(CommandName::Active(c)) => c,
|
||||
TokenKind::Command(
|
||||
CommandName::Control(_) | CommandName::Font(_) | CommandName::FrozenRelax,
|
||||
) => continue,
|
||||
};
|
||||
self.reads.insert(Dependency::CaseCode(kind, *c));
|
||||
let value = self.state.case_code(kind, *c);
|
||||
if value != 0 {
|
||||
*c = char::from_u32(value).expect("validated case-code scalar");
|
||||
}
|
||||
}
|
||||
self.push_kind(
|
||||
tokens.into_iter().map(InputToken::from).collect(),
|
||||
TokenInputKind::BackedUp,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user