summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3regex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3regex.dtx75
1 files changed, 45 insertions, 30 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx
index 0c0434054d7..859763a12fb 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx
@@ -41,7 +41,7 @@
% }^^A
% }
%
-% \date{Released 2018-04-30}
+% \date{Released 2018-05-12}
%
% \maketitle
%
@@ -920,7 +920,7 @@
% Access the primitive: performance is key here, so we do not use
% the slower route \emph{via} \cs{int_eval:n}.
% \begin{macrocode}
-\cs_new_eq:NN \@@_int_eval:w \etex_numexpr:D
+\cs_new_eq:NN \@@_int_eval:w \tex_numexpr:D
% \end{macrocode}
% \end{macro}
%
@@ -1924,6 +1924,28 @@
%
% \subsubsection{Generic helpers used when compiling}
%
+% \begin{macro}{\@@_two_if_eq:NNNNTF}
+% Used to compare pairs of things like \cs{@@_compile_special:N} |?|
+% together. It's often inconvenient to get the catcodes of the
+% character to match so we just compare the character code.
+% Besides, the expanding behaviour of \cs{if:w} is very useful as that
+% means we can use \cs{c_left_brace_str} and the like.
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_two_if_eq:NNNN #1#2#3#4 { TF }
+ {
+ \if_meaning:w #1 #3
+ \if:w #2 #4
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_get_digits:NTFw}
% \begin{macro}[rEXP]{\@@_get_digits_loop:w}
% If followed by some raw digits, collect them one by one in the
@@ -2340,7 +2362,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_compile_quantifier_lazyness:nnNN #1#2#3#4
{
- \str_if_eq:nnTF { #3 #4 } { \@@_compile_special:N ? }
+ \@@_two_if_eq:NNNNTF #3 #4 \@@_compile_special:N ?
{
\tl_build_put_right:Nn \l_@@_build_tl
{ \if_false: { \fi: } { #1 } { #2 } \c_true_bool }
@@ -2421,8 +2443,7 @@
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxii:w #1#2
{
- \str_if_eq_x:nnTF
- { #1 #2 } { \@@_compile_special:N \c_right_brace_str }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N \c_right_brace_str
{
\exp_args:No \@@_compile_quantifier_lazyness:nnNN
{ \int_use:N \l_@@_internal_a_int } { -1 }
@@ -2435,8 +2456,7 @@
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxiii:w #1#2
{
- \str_if_eq_x:nnTF
- { #1 #2 } { \@@_compile_special:N \c_right_brace_str }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N \c_right_brace_str
{
\if_int_compare:w \l_@@_internal_a_int >
\l_@@_internal_b_int
@@ -2489,7 +2509,7 @@
{
\@@_if_in_class:TF
{
- \str_if_eq:nnTF {#2#3} { \@@_compile_special:N - }
+ \@@_two_if_eq:NNNNTF #2 #3 \@@_compile_special:N -
{ \@@_compile_range:Nw #1 }
{
\@@_compile_one:n
@@ -2785,7 +2805,7 @@
\cs_new_protected:Npn \@@_compile_class:TFNN #1#2#3#4
{
\l_@@_mode_int = \int_value:w \l_@@_mode_int 3 \exp_stop_f:
- \str_if_eq:nnTF { #3 #4 } { \@@_compile_special:N ^ }
+ \@@_two_if_eq:NNNNTF #3 #4 \@@_compile_special:N ^
{
\tl_build_put_right:Nn \l_@@_build_tl { #2 { \if_false: } \fi: }
\@@_compile_class:NN
@@ -2840,7 +2860,7 @@
}
\cs_new_protected:Npn \@@_compile_class_posix:NNNNw #1#2#3#4#5#6
{
- \str_if_eq:nnTF { #5 #6 } { \@@_compile_special:N ^ }
+ \@@_two_if_eq:NNNNTF #5 #6 \@@_compile_special:N ^
{
\bool_set_false:N \l_@@_internal_bool
\tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
@@ -2860,8 +2880,9 @@
}
\cs_new_protected:Npn \@@_compile_class_posix_end:w #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 #3 #4 }
- { \@@_compile_special:N : \@@_compile_special:N ] }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N :
+ { \@@_two_if_eq:NNNNTF #3 #4 \@@_compile_special:N ] }
+ { \use_ii:nn }
{
\cs_if_exist:cTF { @@_posix_ \l_@@_internal_a_tl : }
{
@@ -2956,7 +2977,7 @@
}
\cs_new_protected:Npn \@@_compile_lparen:w #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ? }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N ?
{
\cs_if_exist_use:cF
{ @@_compile_special_group_\token_to_str:N #4 :w }
@@ -3022,7 +3043,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_compile_special_group_i:w #1#2
{
- \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ) }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N )
{
\cs_set:Npn \@@_item_equal:n
{ \@@_item_caseless_equal:n }
@@ -3039,8 +3060,9 @@
}
\cs_new_protected:cpn { @@_compile_special_group_-:w } #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 #3 #4 }
- { \@@_compile_raw:N i \@@_compile_special:N ) }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_raw:N i
+ { \@@_two_if_eq:NNNNTF #3 #4 \@@_compile_special:N ) }
+ { \use_ii:nn }
{
\cs_set:Npn \@@_item_equal:n
{ \@@_item_caseful_equal:n }
@@ -3134,7 +3156,7 @@
\c_@@_catcode_in_class_mode_int
\fi:
\int_zero:N \l_@@_catcodes_int
- \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ^ }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N ^
{
\bool_set_false:N \l_@@_catcodes_bool
\@@_compile_c_lbrack_loop:NN
@@ -3304,8 +3326,7 @@
\@@_if_in_class_or_catcode:TF
{ \@@_compile_raw_error:N u #1 #2 }
{
- \str_if_eq_x:nnTF {#1#2}
- { \@@_compile_special:N \c_left_brace_str }
+ \@@_two_if_eq:NNNNTF #1 #2 \@@_compile_special:N \c_left_brace_str
{
\tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
\@@_compile_u_loop:NN
@@ -5356,9 +5377,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_replacement_g:w #1#2
{
- \str_if_eq_x:nnTF
- { #1#2 }
- { \@@_replacement_normal:n \c_left_brace_str }
+ \@@_two_if_eq:NNNNTF
+ #1 #2 \@@_replacement_normal:n \c_left_brace_str
{ \l_@@_internal_a_int = \@@_replacement_g_digits:NN }
{ \@@_replacement_error:NNN g #1 #2 }
}
@@ -5447,9 +5467,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_replacement_u:w #1#2
{
- \str_if_eq_x:nnTF
- { #1#2 }
- { \@@_replacement_normal:n \c_left_brace_str }
+ \@@_two_if_eq:NNNNTF
+ #1 #2 \@@_replacement_normal:n \c_left_brace_str
{ \@@_replacement_cu_aux:Nw \exp_not:V }
{ \@@_replacement_error:NNN u #1#2 }
}
@@ -5495,11 +5514,7 @@
#2 #3
}
{
- \str_if_eq:nnTF
- { #2#3 }
- {
- \@@_replacement_normal:n ( % )
- }
+ \@@_two_if_eq:NNNNTF #2 #3 \@@_replacement_normal:n (
{
\seq_push:NV \l_@@_replacement_category_seq
\l_@@_replacement_category_tl