Reduce repeated macro tracing and input position work
This commit is contained in:
1 parent
70822cbd94
commit
b681f9791a
5 files changed
+64
-29
No files matched your search
@@ -635,12 +635,9 @@ impl Executor {
|
||||
call: &Token,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
if self.read_parameter(Parameter::Tracingmacros).width() > 0 {
|
||||
let command = self.message_token(call);
|
||||
let body = self.macro_token_text(definition, call.span)?;
|
||||
self.emit_macro_trace(&format!("{command}{body}"), true, files)?;
|
||||
}
|
||||
Ok(())
|
||||
let command = self.message_token(call);
|
||||
let body = self.macro_token_text(definition, call.span)?;
|
||||
self.emit_macro_trace(&format!("{command}{body}"), true, files)
|
||||
}
|
||||
|
||||
pub(super) fn trace_macro_argument(
|
||||
@@ -650,28 +647,24 @@ impl Executor {
|
||||
argument: &[Token],
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
if self.read_parameter(Parameter::Tracingmacros).width() > 0 {
|
||||
let mut body = format!("{}{}<-", definition.parameter_chars[index], index + 1);
|
||||
let mut tally = 0;
|
||||
for token in argument {
|
||||
if tally >= 1000 {
|
||||
body.push_str(
|
||||
&self
|
||||
.string_token(&TokenKind::Command(CommandName::Control("ETC.".into()))),
|
||||
);
|
||||
break;
|
||||
}
|
||||
let piece = self.message_token(token);
|
||||
tally += piece.chars().count();
|
||||
if let TokenKind::Character(c, CatCode::Parameter) = token.kind {
|
||||
body.push(c);
|
||||
tally += 1;
|
||||
}
|
||||
body.push_str(&piece);
|
||||
let mut body = format!("{}{}<-", definition.parameter_chars[index], index + 1);
|
||||
let mut tally = 0;
|
||||
for token in argument {
|
||||
if tally >= 1000 {
|
||||
body.push_str(
|
||||
&self.string_token(&TokenKind::Command(CommandName::Control("ETC.".into()))),
|
||||
);
|
||||
break;
|
||||
}
|
||||
self.emit_macro_trace(&body, false, files)?;
|
||||
let piece = self.message_token(token);
|
||||
tally += piece.chars().count();
|
||||
if let TokenKind::Character(c, CatCode::Parameter) = token.kind {
|
||||
body.push(c);
|
||||
tally += 1;
|
||||
}
|
||||
body.push_str(&piece);
|
||||
}
|
||||
Ok(())
|
||||
self.emit_macro_trace(&body, false, files)
|
||||
}
|
||||
|
||||
fn emit_macro_trace(
|
||||
|
||||
Reference in new issue
Block a user