Bug
The GNU T command — branch to label if no s/// substitution has
been performed since the last input line was read — is not
implemented. It is the inverse of t.
Reproduction
$ echo a | /usr/bin/sed -n 'Tend; p; :end'
a
$ echo a | ./target/release/sed -n 'Tend; p; :end'
sed: <script argument 1>:1:1: error: invalid command code `T'
What it should do
From the GNU manual:
T LABEL If no s/// has done a successful substitution since the
last input line was read or branch was taken, branch to LABEL.
Same address/parsing rules as t. Already-implemented t lives in
compile_label_command (compiler.rs:1308); T should be parsed by the
same handler.
Suspected place to add it
src/sed/compiler.rs:1276 — get_cmd_spec:
'b' | 't' | 'T' => Ok(CommandSpec {
n_addr: 2,
handler: compile_label_command,
}),
…then in the execution side (look near the t handler in
processor.rs), branch when the substitution flag is false instead of
true, and clear it the same way t does.
Affected GNU testsuite tests
Indirect — the broader compile-tests/compile-errors suites assert
that T is rejected under --posix and accepted otherwise.
Bug
The GNU
Tcommand — branch to label if nos///substitution hasbeen performed since the last input line was read — is not
implemented. It is the inverse of
t.Reproduction
What it should do
From the GNU manual:
Same address/parsing rules as
t. Already-implementedtlives incompile_label_command(compiler.rs:1308);Tshould be parsed by thesame handler.
Suspected place to add it
src/sed/compiler.rs:1276—get_cmd_spec:…then in the execution side (look near the
thandler inprocessor.rs), branch when the substitution flag is false instead oftrue, and clear it the same way
tdoes.Affected GNU testsuite tests
Indirect — the broader
compile-tests/compile-errorssuites assertthat
Tis rejected under--posixand accepted otherwise.