[latex3-commits] [latex3/latex3] main: Move str flags internal (see #1345) (af69d1186)
github at latex-project.org
github at latex-project.org
Sun Nov 26 21:27:39 CET 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/af69d11867215e32926197ce8b84c1dd8dbabfe8
>---------------------------------------------------------------
commit af69d11867215e32926197ce8b84c1dd8dbabfe8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Nov 26 20:27:39 2023 +0000
Move str flags internal (see #1345)
>---------------------------------------------------------------
af69d11867215e32926197ce8b84c1dd8dbabfe8
l3kernel/l3flag.dtx | 2 +-
l3kernel/l3str-convert.dtx | 170 ++++++++++++++++++++++-----------------------
2 files changed, 86 insertions(+), 86 deletions(-)
diff --git a/l3kernel/l3flag.dtx b/l3kernel/l3flag.dtx
index cecc72cee..a83a9ae56 100644
--- a/l3kernel/l3flag.dtx
+++ b/l3kernel/l3flag.dtx
@@ -61,7 +61,7 @@
% to zero requires non-expandable assignments.
%
% Flag variables are always local. They are referenced by a \meta{flag
-% name} such as \texttt{str_missing}. The \meta{flag name} is used as
+% name} such as \texttt{@@_missing}. The \meta{flag name} is used as
% part of \cs{use:c} constructions hence is expanded at point of use.
% It must expand to character tokens only, with no spaces.
%
diff --git a/l3kernel/l3str-convert.dtx b/l3kernel/l3str-convert.dtx
index 8d9deccbe..963ad48fa 100644
--- a/l3kernel/l3str-convert.dtx
+++ b/l3kernel/l3str-convert.dtx
@@ -343,13 +343,13 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{str_byte, str_error}
+% \begin{variable}{@@_byte, @@_error}
% Conversions from one \meta{encoding}/\meta{escaping} pair to another
% are done within \texttt{e}-expanding assignments. Errors are
% signalled by raising the relevant flag.
% \begin{macrocode}
-\flag_new:n { str_byte }
-\flag_new:n { str_error }
+\flag_new:n { @@_byte }
+\flag_new:n { @@_error }
% \end{macrocode}
% \end{variable}
%
@@ -893,7 +893,7 @@
% \begin{macro}[rEXP]{\@@_filter_bytes_aux:N}
% In the case of 8-bit engines, every character is a byte. For
% Unicode-aware engines, test the character code; non-bytes cause us
-% to raise the flag \texttt{str_byte}. Spaces have already been given
+% to raise the flag \texttt{@@_byte}. Spaces have already been given
% the correct category code when this function is called.
% \begin{macrocode}
\bool_lazy_any:nTF
@@ -914,7 +914,7 @@
\if_int_compare:w `#1 < 256 \exp_stop_f:
#1
\else:
- \flag_raise:n { str_byte }
+ \flag_raise:n { @@_byte }
\fi:
\@@_filter_bytes_aux:N
}
@@ -937,10 +937,10 @@
{
\cs_new_protected:Npn \@@_convert_unescape_:
{
- \flag_clear:n { str_byte }
+ \flag_clear:n { @@_byte }
\__kernel_tl_gset:Ne \g_@@_result_tl
{ \exp_args:No \@@_filter_bytes:n \g_@@_result_tl }
- \@@_if_flag_error:nne { str_byte } { non-byte } { bytes }
+ \@@_if_flag_error:nne { @@_byte } { non-byte } { bytes }
}
}
{ \cs_new_protected:Npn \@@_convert_unescape_: { } }
@@ -997,15 +997,15 @@
{
\cs_new_protected:Npn \@@_convert_encode_:
{
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\@@_convert_gmap_internal:N \@@_encode_native_char:n
- \@@_if_flag_error:nne { str_error }
+ \@@_if_flag_error:nne { @@_error }
{ native-overflow } { }
}
\cs_new:Npn \@@_encode_native_char:n #1
{
\if_int_compare:w #1 > \c_@@_max_byte_int
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
?
\else:
\char_generate:nn {#1} {12}
@@ -1186,9 +1186,9 @@
\exp_not:N \@@_decode_eight_bit_aux:Nn
\exp_not:c { g_@@_decode_#1_intarray }
}
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\@@_convert_gmap:N \@@_tmp:w
- \@@_if_flag_error:nne { str_error } { decode-8-bit } {#1}
+ \@@_if_flag_error:nne { @@_error } { decode-8-bit } {#1}
}
\cs_new:Npn \@@_decode_eight_bit_aux:Nn #1#2
{
@@ -1200,7 +1200,7 @@
\cs_new:Npn \@@_decode_eight_bit_aux:n #1
{
\if_int_compare:w #1 < \c_zero_int
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
\int_value:w \c_@@_replacement_char_int
\else:
#1
@@ -1230,9 +1230,9 @@
\exp_not:c { g_@@_encode_#1_intarray }
\exp_not:c { g_@@_decode_#1_intarray }
}
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\@@_convert_gmap_internal:N \@@_tmp:w
- \@@_if_flag_error:nne { str_error } { encode-8-bit } {#1}
+ \@@_if_flag_error:nne { @@_error } { encode-8-bit } {#1}
}
\cs_new:Npn \@@_encode_eight_bit_aux:NNn #1#2#3
{
@@ -1248,7 +1248,7 @@
{
\int_compare:nNnTF { \intarray_item:Nn #3 { 1 + #1 } } = {#2}
{ \@@_output_byte:n {#1} }
- { \flag_raise:n { str_error } }
+ { \flag_raise:n { @@_error } }
}
% \end{macrocode}
% \end{macro}
@@ -1349,7 +1349,7 @@
\cs_new_protected:Npn \@@_convert_unescape_hex:
{
\group_begin:
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\int_set:Nn \tex_escapechar:D { 92 }
\__kernel_tl_gset:Ne \g_@@_result_tl
{
@@ -1360,7 +1360,7 @@
\prg_break_point:
\@@_output_end:
}
- \@@_if_flag_error:nne { str_error } { unescape-hex } { }
+ \@@_if_flag_error:nne { @@_error } { unescape-hex } { }
\group_end:
}
\cs_new:Npn \@@_unescape_hex_auxi:N #1
@@ -1369,7 +1369,7 @@
\@@_hexadecimal_use:NTF #1
{ \@@_unescape_hex_auxii:N }
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
\@@_unescape_hex_auxi:N
}
}
@@ -1382,7 +1382,7 @@
\@@_output_byte:w " \@@_unescape_hex_auxi:N
}
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
\@@_unescape_hex_auxii:N
}
}
@@ -1427,8 +1427,8 @@
\cs_new_protected:cpn { @@_convert_unescape_#2: }
{
\group_begin:
- \flag_clear:n { str_byte }
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_byte }
+ \flag_clear:n { @@_error }
\int_set:Nn \tex_escapechar:D { 92 }
\__kernel_tl_gset:Ne \g_@@_result_tl
{
@@ -1436,8 +1436,8 @@
#1 ? { ? \prg_break: }
\prg_break_point:
}
- \@@_if_flag_error:nne { str_byte } { non-byte } { #2 }
- \@@_if_flag_error:nne { str_error } { unescape-#2 } { }
+ \@@_if_flag_error:nne { @@_byte } { non-byte } { #2 }
+ \@@_if_flag_error:nne { @@_error } { unescape-#2 } { }
\group_end:
}
\cs_new:Npn #3 ##1#1##2##3
@@ -1450,12 +1450,12 @@
\@@_hexadecimal_use:NTF ##3
{ }
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
* 0 + `#1 \use_i:nn
}
}
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
0 + `#1 \use_i:nn
}
\@@_output_end:
@@ -1513,8 +1513,8 @@
\cs_new_protected:Npn \@@_convert_unescape_string:
{
\group_begin:
- \flag_clear:n { str_byte }
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_byte }
+ \flag_clear:n { @@_error }
\int_set:Nn \tex_escapechar:D { 92 }
\__kernel_tl_gset:Ne \g_@@_result_tl
{
@@ -1528,8 +1528,8 @@
\g_@@_result_tl #1 ?? { ? \prg_break: }
\prg_break_point:
}
- \@@_if_flag_error:nne { str_byte } { non-byte } { string }
- \@@_if_flag_error:nne { str_error } { unescape-string } { }
+ \@@_if_flag_error:nne { @@_byte } { non-byte } { string }
+ \@@_if_flag_error:nne { @@_error } { unescape-string } { }
\group_end:
}
}
@@ -1569,7 +1569,7 @@
{ ^^J } { 0 - 1 }
}
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
0 - 1 \use_i:nn
}
}
@@ -1846,19 +1846,19 @@
% first remind the user what a correct \textsc{utf-8} string should
% look like, then add error-specific information.
% \begin{macrocode}
-\flag_clear_new:n { str_missing }
-\flag_clear_new:n { str_extra }
-\flag_clear_new:n { str_overlong }
-\flag_clear_new:n { str_overflow }
+\flag_clear_new:n { @@_missing }
+\flag_clear_new:n { @@_extra }
+\flag_clear_new:n { @@_overlong }
+\flag_clear_new:n { @@_overflow }
\msg_new:nnnn { str } { utf8-decode }
{
Invalid~UTF-8~string:
\exp_last_unbraced:Nf \use_none:n
{
- \@@_if_flag_times:nT { str_missing } { ,~missing~continuation~byte }
- \@@_if_flag_times:nT { str_extra } { ,~extra~continuation~byte }
- \@@_if_flag_times:nT { str_overlong } { ,~overlong~form }
- \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ \@@_if_flag_times:nT { @@_missing } { ,~missing~continuation~byte }
+ \@@_if_flag_times:nT { @@_extra } { ,~extra~continuation~byte }
+ \@@_if_flag_times:nT { @@_overlong } { ,~overlong~form }
+ \@@_if_flag_times:nT { @@_overflow } { ,~code~point~too~large }
}
.
}
@@ -1873,25 +1873,25 @@
Code~point~ <~1114112:~11110xxx~10xxxxxx~10xxxxxx~10xxxxxx \\
}
Bytes~of~the~form~10xxxxxx~are~called~continuation~bytes.
- \flag_if_raised:nT { str_missing }
+ \flag_if_raised:nT { @@_missing }
{
\\\\
A~leading~byte~(in~the~range~[192,255])~was~not~followed~by~
the~appropriate~number~of~continuation~bytes.
}
- \flag_if_raised:nT { str_extra }
+ \flag_if_raised:nT { @@_extra }
{
\\\\
LaTeX~came~across~a~continuation~byte~when~it~was~not~expected.
}
- \flag_if_raised:nT { str_overlong }
+ \flag_if_raised:nT { @@_overlong }
{
\\\\
Every~Unicode~code~point~must~be~expressed~in~the~shortest~
possible~form.~For~instance,~'0xC0'~'0x83'~is~not~a~valid~
representation~for~the~code~point~3.
}
- \flag_if_raised:nT { str_overflow }
+ \flag_if_raised:nT { @@_overflow }
{
\\\\
Unicode~limits~code~points~to~the~range~[0,1114111].
@@ -1970,18 +1970,18 @@
% \begin{macrocode}
\cs_new_protected:cpn { @@_convert_decode_utf8: }
{
- \flag_clear:n { str_error }
- \flag_clear:n { str_missing }
- \flag_clear:n { str_extra }
- \flag_clear:n { str_overlong }
- \flag_clear:n { str_overflow }
+ \flag_clear:n { @@_error }
+ \flag_clear:n { @@_missing }
+ \flag_clear:n { @@_extra }
+ \flag_clear:n { @@_overlong }
+ \flag_clear:n { @@_overflow }
\__kernel_tl_gset:Ne \g_@@_result_tl
{
\exp_after:wN \@@_decode_utf_viii_start:N \g_@@_result_tl
{ \prg_break: \@@_decode_utf_viii_end: }
\prg_break_point:
}
- \@@_if_flag_error:nne { str_error } { utf8-decode } { }
+ \@@_if_flag_error:nne { @@_error } { utf8-decode } { }
}
\cs_new:Npn \@@_decode_utf_viii_start:N #1
{
@@ -1991,8 +1991,8 @@
\if_int_compare:w `#1 < "80 \exp_stop_f:
\int_value:w `#1
\else:
- \flag_raise:n { str_extra }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_extra }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
\fi:
\else:
@@ -2015,8 +2015,8 @@
\int_value:w \int_eval:n { #1 * "40 + `#3 - "80 } \exp_after:wN
\else:
\s_@@
- \flag_raise:n { str_missing }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_missing }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
\fi:
\s_@@
@@ -2029,8 +2029,8 @@
\if_int_compare:w #1 < #4 \exp_stop_f:
\s_@@
\if_int_compare:w #1 < #3 \exp_stop_f:
- \flag_raise:n { str_overlong }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_overlong }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
\else:
#1
@@ -2049,15 +2049,15 @@
\cs_new:Npn \@@_decode_utf_viii_overflow:w #1 \fi: #2 \fi:
{
\fi: \fi:
- \flag_raise:n { str_overflow }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_overflow }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
}
\cs_new:Npn \@@_decode_utf_viii_end:
{
\s_@@
- \flag_raise:n { str_missing }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_missing }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int \s_@@
\prg_break:
}
@@ -2119,10 +2119,10 @@
{ \@@_encode_utf_xvi_aux:N \@@_output_byte_pair_le:n }
\cs_new_protected:Npn \@@_encode_utf_xvi_aux:N #1
{
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\cs_set_eq:NN \@@_tmp:w #1
\@@_convert_gmap_internal:N \@@_encode_utf_xvi_char:n
- \@@_if_flag_error:nne { str_error } { utf16-encode } { }
+ \@@_if_flag_error:nne { @@_error } { utf16-encode } { }
}
\cs_new:Npn \@@_encode_utf_xvi_char:n #1
{
@@ -2131,7 +2131,7 @@
\else:
\if_int_compare:w #1 < "10000 \exp_stop_f:
\if_int_compare:w #1 < "E000 \exp_stop_f:
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
\@@_tmp:w { \c_@@_replacement_char_int }
\else:
\@@_tmp:w {#1}
@@ -2162,8 +2162,8 @@
% an unexpected trail surrogate, and a string containing an odd number
% of bytes.
% \begin{macrocode}
- \flag_clear_new:n { str_missing }
- \flag_clear_new:n { str_extra }
+ \flag_clear_new:n { @@_missing }
+ \flag_clear_new:n { @@_extra }
\flag_clear_new:n { str_end }
\msg_new:nnnn { str } { utf16-encode }
{ Unicode~string~cannot~be~expressed~in~UTF-16:~surrogate. }
@@ -2177,8 +2177,8 @@
Invalid~UTF-16~string:
\exp_last_unbraced:Nf \use_none:n
{
- \@@_if_flag_times:nT { str_missing } { ,~missing~trail~surrogate }
- \@@_if_flag_times:nT { str_extra } { ,~extra~trail~surrogate }
+ \@@_if_flag_times:nT { @@_missing } { ,~missing~trail~surrogate }
+ \@@_if_flag_times:nT { @@_extra } { ,~extra~trail~surrogate }
\@@_if_flag_times:nT { str_end } { ,~odd~number~of~bytes }
}
.
@@ -2196,12 +2196,12 @@
}
Lead~surrogates~are~pairs~of~bytes~in~the~range~[0xD800,~0xDBFF],~
and~trail~surrogates~are~in~the~range~[0xDC00,~0xDFFF].
- \flag_if_raised:nT { str_missing }
+ \flag_if_raised:nT { @@_missing }
{
\\\\
A~lead~surrogate~was~not~followed~by~a~trail~surrogate.
}
- \flag_if_raised:nT { str_extra }
+ \flag_if_raised:nT { @@_extra }
{
\\\\
LaTeX~came~across~a~trail~surrogate~when~it~was~not~expected.
@@ -2260,9 +2260,9 @@
}
\cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s_@@_stop
{
- \flag_clear:n { str_error }
- \flag_clear:n { str_missing }
- \flag_clear:n { str_extra }
+ \flag_clear:n { @@_error }
+ \flag_clear:n { @@_missing }
+ \flag_clear:n { @@_extra }
\flag_clear:n { str_end }
\cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
\__kernel_tl_gset:Ne \g_@@_result_tl
@@ -2271,7 +2271,7 @@
#2 \q_@@_nil \q_@@_nil
\prg_break_point:
}
- \@@_if_flag_error:nne { str_error } { utf16-decode } { }
+ \@@_if_flag_error:nne { @@_error } { utf16-decode } { }
}
% \end{macrocode}
% \end{macro}
@@ -2377,7 +2377,7 @@
{ \@@_decode_utf_xvi_error:nNN { extra } #1#2 }
\cs_new:Npn \@@_decode_utf_xvi_error:nNN #1#2#3
{
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
\flag_raise:n { str_#1 }
#2 #3 \s_@@
\int_use:N \c_@@_replacement_char_int \s_@@
@@ -2456,21 +2456,21 @@
% \end{macro}
% \end{macro}
%
-% \begin{variable}{str_overflow, str_end}
+% \begin{variable}{@@_overflow, str_end}
% There can be no error when encoding in \textsc{utf-32}. When
% decoding, the string may not have length $4n$, or it may contain
% code points larger than \hexnum{10FFFF}. The latter case often
% happens if the encoding was in fact not \textsc{utf-32}, because
% most arbitrary strings are not valid in \textsc{utf-32}.
% \begin{macrocode}
- \flag_clear_new:n { str_overflow }
+ \flag_clear_new:n { @@_overflow }
\flag_clear_new:n { str_end }
\msg_new:nnnn { str } { utf32-decode }
{
Invalid~UTF-32~string:
\exp_last_unbraced:Nf \use_none:n
{
- \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ \@@_if_flag_times:nT { @@_overflow } { ,~code~point~too~large }
\@@_if_flag_times:nT { str_end } { ,~truncated~string }
}
.
@@ -2478,7 +2478,7 @@
{
In~the~UTF-32~encoding,~every~Unicode~character~
(in~the~range~[U+0000,~U+10FFFF])~is~encoded~as~4~bytes.
- \flag_if_raised:nT { str_overflow }
+ \flag_if_raised:nT { @@_overflow }
{
\\\\
LaTeX~came~across~a~code~point~larger~than~1114111,~
@@ -2549,9 +2549,9 @@
}
\cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s_@@_stop
{
- \flag_clear:n { str_overflow }
+ \flag_clear:n { @@_overflow }
\flag_clear:n { str_end }
- \flag_clear:n { str_error }
+ \flag_clear:n { @@_error }
\cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
\__kernel_tl_gset:Ne \g_@@_result_tl
{
@@ -2559,7 +2559,7 @@
#2 \s_@@_stop \s_@@_stop \s_@@_stop \s_@@_stop
\prg_break_point:
}
- \@@_if_flag_error:nne { str_error } { utf32-decode } { }
+ \@@_if_flag_error:nne { @@_error } { utf32-decode } { }
}
\cs_new:Npn \@@_decode_utf_xxxii_loop:NNNN #1#2#3#4
{
@@ -2568,13 +2568,13 @@
\fi:
#1#2#3#4 \s_@@
\if_int_compare:w \@@_tmp:w #1#4 > \c_zero_int
- \flag_raise:n { str_overflow }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_overflow }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
\else:
\if_int_compare:w \@@_tmp:w #2#3 > 16 \exp_stop_f:
- \flag_raise:n { str_overflow }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_overflow }
+ \flag_raise:n { @@_error }
\int_use:N \c_@@_replacement_char_int
\else:
\int_eval:n
@@ -2589,7 +2589,7 @@
\tl_if_empty:nF {#1}
{
\flag_raise:n { str_end }
- \flag_raise:n { str_error }
+ \flag_raise:n { @@_error }
#1 \s_@@
\int_use:N \c_@@_replacement_char_int \s_@@
}
More information about the latex3-commits
mailing list.