Tilde is often used as a non-breaking space, but what exactly that
means depends on context. Therefore, a tilde expands to itself by
default and the expansion can be changed via $T::tilde.
Inspired by a patch from KSP repository.
pos $t = 0;
for (;;) {
$current_pos = pos $t;
- if ($t =~ /\G([^\@]+)/cgs) {
+ # Scan for the first occurrence of an active character ("@", "~")
+ if ($t =~ /\G([^\@~]+)/cgs) {
out $1 if $cond[0] > 0;
+ } elsif ($t =~ /\G~/cgs) {
+ out $T::tilde if $cond[0] > 0;
+ } elsif ($t =~ /\G\@~/cgs) {
+ out "~" if $cond[0] > 0;
} elsif ($t =~ /\G\@\s*\n/cgs) {
# @ at end of line is ignored and eats the end of line
} elsif ($t =~ /\G\@#[^\n]*\n/cgs) {
our $temp;
our $out_func = sub { print @_; };
+our $tilde = '~';
sub include {
my $fn = shift @_;