Initial texrra engine
Rename the crate, binary, core crate, font families, env vars, and internal commands from texcraft/tex-engine to texrra. Serve the separately versioned texrra-web frontend from TEXRRA_WEB_DIR, ../web, or ./web instead of embedding index.html. Add starred section heading support and an arXiv template conformance fixture.
This commit is contained in:
commit
bb1d9e0561
147 files changed
+66719
No files matched your search
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
use crate::prelude as txl;
|
||||
use crate::traits::*;
|
||||
use crate::*;
|
||||
|
||||
/// When parsed, this type consumes an optional equals from the token stream.
|
||||
pub struct OptionalEquals;
|
||||
|
||||
impl Parsable for OptionalEquals {
|
||||
fn parse_impl<S: TexlangState>(input: &mut vm::ExpandedStream<S>) -> txl::Result<Self> {
|
||||
// scan_optional_equals
|
||||
parse_optional_equals(input)?;
|
||||
Ok(OptionalEquals {})
|
||||
}
|
||||
}
|
||||
|
||||
/// When parsed, this type consumes an optional equals from the token stream without performing expansion.
|
||||
pub struct OptionalEqualsUnexpanded;
|
||||
|
||||
impl Parsable for OptionalEqualsUnexpanded {
|
||||
fn parse_impl<S: TexlangState>(input: &mut vm::ExpandedStream<S>) -> txl::Result<Self> {
|
||||
parse_optional_equals(input.unexpanded())?;
|
||||
Ok(OptionalEqualsUnexpanded {})
|
||||
}
|
||||
}
|
||||
|
||||
// Corresponds to the `scan_optional_equals` procedure in Knuth's TeX (405)
|
||||
fn parse_optional_equals<S: TexlangState, I: TokenStream<S = S>>(input: &mut I) -> txl::Result<()> {
|
||||
while let Some(found_equals) = get_optional_element![
|
||||
input,
|
||||
token::Value::Other('=') => true,
|
||||
token::Value::Space(_) => false,
|
||||
] {
|
||||
if found_equals {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// TODO: this is not correct: this function should not scan spaces after the equals.
|
||||
// A separate routine corresponding to Knuth TeX 404 needs to be added and used instead
|
||||
// at the right call sites.
|
||||
while get_optional_element![
|
||||
input,
|
||||
token::Value::Space(_) => (),
|
||||
]
|
||||
.is_some()
|
||||
{}
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user