diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3regex.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3regex.dtx | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 7429b63ccf..7b12a6ecc8 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-06-16} +% \date{Released 2022-07-01} % % \maketitle % @@ -2883,7 +2883,7 @@ \cs_new_protected:cpx { @@_compile_/#2: } { \@@_compile_one:n - { \@@_item_reverse:n \exp_not:c { @@_prop_#1: } } + { \@@_item_reverse:n { \exp_not:c { @@_prop_#1: } } } } } \@@_tmp:w d D @@ -3080,7 +3080,8 @@ % raw characters until hopefully reaching |:]|. If that's missing, or % the \textsc{posix} class is unknown, abort. If all is right, add the % test to the current class, with an extra \cs{@@_item_reverse:n} -% for negative classes. +% for negative classes (we make sure to wrap its argument in braces +% otherwise \cs{regex_show:N} would not recognize the regex as valid). % \begin{macrocode} \cs_new_protected:Npn \@@_compile_class_posix_test:w #1#2 { @@ -3131,8 +3132,8 @@ { \@@_compile_one:n { - \bool_if:NF \l_@@_internal_bool \@@_item_reverse:n - \exp_not:c { @@_posix_ \l_@@_internal_a_tl : } + \bool_if:NTF \l_@@_internal_bool \use:n \@@_item_reverse:n + { \exp_not:c { @@_posix_ \l_@@_internal_a_tl : } } } } { @@ -3898,6 +3899,13 @@ } \cs_new:Npn \@@_clean_class:n #1 { \@@_clean_class_loop:nnn #1 ????? \prg_break_point: } +% \end{macrocode} +% When cleaning a class there are many cases, including a dozen or so +% like \cs{@@_prop_d:} or \cs{@@_posix_alpha:}. To avoid listing all of +% them we allow any command that starts with the +% $13$ characters |__regex_prop_| or |__regex_posix| (handily these have +% the same length, except for the trailing underscore). +% \begin{macrocode} \cs_new:Npn \@@_clean_class_loop:nnn #1#2#3 { \tl_if_single:nF {#1} { \prg_break: } @@ -3917,7 +3925,10 @@ \@@_item_caseless_range:nn { } \@@_item_exact:nn { } } - { #1 { \@@_clean_int:n {#2} } { \@@_clean_int:n {#3} } } + { + #1 { \@@_clean_int:n {#2} } { \@@_clean_int:n {#3} } + \@@_clean_class_loop:nnn + } { \token_case_meaning:NnTF #1 { @@ -3928,7 +3939,22 @@ #1 { \@@_clean_int:n {#2} } { \@@_clean_class:n {#3} } \@@_clean_class_loop:nnn } - { \prg_break: } + { + \exp_args:Nf \str_case:nnTF + { + \exp_args:Nf \str_range:nnn + { \cs_to_str:N #1 } { 1 } { 13 } + } + { + { @@_prop_ } { } + { @@_posix } { } + } + { + #1 + \@@_clean_class_loop:nnn {#2} {#3} + } + { \prg_break: } + } } } } @@ -4922,7 +4948,7 @@ \int_set_eq:NN \l_@@_curr_char_int \l_@@_last_char_int \@@_prop_w: \@@_break_point:TF - { \group_end: \@@_item_reverse:n \@@_prop_w: } + { \group_end: \@@_item_reverse:n { \@@_prop_w: } } { \group_end: \@@_prop_w: } } \cs_new_protected:Npn \@@_Z_test: |