Support nested if-prefixed conditionals, char, and SIVP math/preamble commands
This commit is contained in:
1 parent
64f4446113
commit
c1a7dedd6a
4 files changed
+149
-8
No files matched your search
+36
-4
@@ -159,7 +159,15 @@ fn false_case<S: HasComponent<Component>>(
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
if tag == Some(input.state().component().tags.if_tag) {
|
||||
let is_if_prefixed = match command_ref {
|
||||
token::CommandRef::ControlSequence(name) => input
|
||||
.vm()
|
||||
.cs_name_interner()
|
||||
.resolve(*name)
|
||||
.is_some_and(|name| name.starts_with("if")),
|
||||
_ => false,
|
||||
};
|
||||
if tag == Some(input.state().component().tags.if_tag) || is_if_prefixed {
|
||||
depth += 1;
|
||||
}
|
||||
if tag == Some(input.state().component().tags.fi_tag) {
|
||||
@@ -331,7 +339,15 @@ fn if_case_primitive_fn<S: HasComponent<Component>>(
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
if tag == Some(input.state().component().tags.if_tag) {
|
||||
let is_if_prefixed = match command_ref {
|
||||
token::CommandRef::ControlSequence(name) => input
|
||||
.vm()
|
||||
.cs_name_interner()
|
||||
.resolve(*name)
|
||||
.is_some_and(|name| name.starts_with("if")),
|
||||
_ => false,
|
||||
};
|
||||
if tag == Some(input.state().component().tags.if_tag) || is_if_prefixed {
|
||||
depth += 1;
|
||||
}
|
||||
if tag == Some(input.state().component().tags.fi_tag) {
|
||||
@@ -402,7 +418,15 @@ fn or_primitive_fn<S: HasComponent<Component>>(
|
||||
let token = input.unexpanded().next_or_err(OrEndOfInputError {})?;
|
||||
if let token::Value::CommandRef(command_ref) = &token.value() {
|
||||
let tag = input.commands_map().get_tag(command_ref);
|
||||
if tag == Some(input.state().component().tags.if_tag) {
|
||||
let is_if_prefixed = match command_ref {
|
||||
token::CommandRef::ControlSequence(name) => input
|
||||
.vm()
|
||||
.cs_name_interner()
|
||||
.resolve(*name)
|
||||
.is_some_and(|name| name.starts_with("if")),
|
||||
_ => false,
|
||||
};
|
||||
if tag == Some(input.state().component().tags.if_tag) || is_if_prefixed {
|
||||
depth += 1;
|
||||
}
|
||||
if tag == Some(input.state().component().tags.fi_tag) {
|
||||
@@ -463,7 +487,15 @@ fn else_primitive_fn<S: HasComponent<Component>>(
|
||||
let token = input.unexpanded().next_or_err(ElseEndOfInputError {})?;
|
||||
if let token::Value::CommandRef(command_ref) = &token.value() {
|
||||
let tag = input.commands_map().get_tag(command_ref);
|
||||
if tag == Some(input.state().component().tags.if_tag) {
|
||||
let is_if_prefixed = match command_ref {
|
||||
token::CommandRef::ControlSequence(name) => input
|
||||
.vm()
|
||||
.cs_name_interner()
|
||||
.resolve(*name)
|
||||
.is_some_and(|name| name.starts_with("if")),
|
||||
_ => false,
|
||||
};
|
||||
if tag == Some(input.state().component().tags.if_tag) || is_if_prefixed {
|
||||
depth += 1;
|
||||
}
|
||||
if tag == Some(input.state().component().tags.fi_tag) {
|
||||
|
||||
Reference in new issue
Block a user