$begun = "";
+# Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165.
+my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)';
+
while (<>) {
if ($cutting) {
next unless /^=/;
# first hide the escapes in case we need to
# intuit something and get it wrong due to fmting
- 1 while s/([A-Z]<[^<>]*>)/noremap($1)/ge;
+ 1 while s/([A-Z]<$nonest>)/noremap($1)/ge;
# func() is a reference to a perl function
s{
while ($maxnest-- && /[A-Z]</) {
# can't do C font here
- s/([BI])<([^<>]*)>/font($1) . $2 . font('R')/eg;
+ s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg;
# files and filelike refs in italics
- s/F<([^<>]*)>/I<$1>/g;
+ s/F<($nonest)>/I<$1>/g;
# no break -- usually we want C<> for this
- s/S<([^<>]*)>/nobreak($1)/eg;
+ s/S<($nonest)>/nobreak($1)/eg;
# LREF: a la HREF L<show this text|man/section>
s:L<([^|>]+)\|[^>]+>:$1:g;
s/Z<>/\\&/g;
# comes last because not subject to reprocessing
- s/C<([^<>]*)>/noremap("${CFont_embed}${1}\\fR")/eg;
+ s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg;
}
if (s/^=//) {