diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx | 470 |
1 files changed, 289 insertions, 181 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx index 548486edcd5..9586e3f57d1 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/02/10] -%<package>\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +%<package>\@ifpackagelater{expl3}{2017/03/07} %<package> {} %<package> {% %<package> \PackageError{l3regex}{Support package l3kernel too old} @@ -36,7 +36,7 @@ %<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: l3regex.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3regex.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental regular expressions} %</driver|package> %<*driver> @@ -740,7 +740,7 @@ %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} %</package> % \end{macrocode} % @@ -1028,17 +1028,15 @@ \cs_new_protected:Npn \@@_compute_case_changed_char: { \int_set_eq:NN \l_@@_case_changed_char_int \l_@@_current_char_int - \if_int_compare:w \l_@@_current_char_int < \c_ninety_one - \if_int_compare:w \l_@@_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l_@@_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l_@@_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l_@@_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l_@@_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l_@@_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l_@@_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l_@@_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l_@@_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l_@@_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l_@@_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -1071,7 +1069,7 @@ 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 - \or: 1000000 \or: 4000000 \else: 1*\c_zero + \or: 1000000 \or: 4000000 \else: 1*0 \fi: } \cs_new_protected:Npn \@@_item_catcode:nT #1 @@ -1088,9 +1086,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_item_exact:nn, \@@_item_exact_cs:c} +% \begin{macro}[int]{\@@_item_exact:nn, \@@_item_exact_cs:n} % This matches an exact \meta{category}-\meta{character code} pair, or -% an exact control sequence. +% an exact control sequence, more precisely one of several possible control sequences. % \begin{macrocode} \cs_new_protected:Npn \@@_item_exact:nn #1#2 { @@ -1100,16 +1098,18 @@ \fi: \fi: } -\cs_new_protected:Npn \@@_item_exact_cs:c #1 +\cs_new_protected:Npn \@@_item_exact_cs:n #1 { - \int_compare:nNnTF \l_@@_current_catcode_int = \c_zero + \int_compare:nNnTF \l_@@_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l_@@_internal_a_tl { + \scan_stop: \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N \tex_the:D \tex_toks:D \l_@@_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l_@@_internal_a_tl { \@@_break_true:w } { } } { } @@ -1129,7 +1129,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_cs:n #1 { - \int_compare:nNnT \l_@@_current_catcode_int = \c_zero + \int_compare:nNnT \l_@@_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l_@@_cs_name_tl @@ -1170,31 +1170,34 @@ % mostly lower case letter text. % \begin{macrocode} \cs_new_protected:Npn \@@_prop_d: - { \@@_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \@@_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \@@_prop_h: { - \@@_item_caseful_equal:n \c_thirty_two % space - \@@_item_caseful_equal:n \c_nine % tab + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \@@_prop_s: { - \@@_item_caseful_equal:n \c_thirty_two % space - \@@_item_caseful_equal:n \c_nine % tab - \@@_item_caseful_equal:n \c_ten % lf - \@@_item_caseful_equal:n \c_twelve % ff - \@@_item_caseful_equal:n \c_thirteen % cr + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_equal:n { `\^^I } + \@@_item_caseful_equal:n { `\^^J } + \@@_item_caseful_equal:n { `\^^L } + \@@_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \@@_prop_v: - { \@@_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \@@_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \@@_prop_w: { - \@@_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \@@_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \@@_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \@@_item_caseful_equal:n { 95 } % _ + \@@_item_caseful_range:nn { `a } { `z } + \@@_item_caseful_range:nn { `A } { `Z } + \@@_item_caseful_range:nn { `0 } { `9 } + \@@_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \@@_prop_N: - { \@@_item_reverse:n { \@@_item_caseful_equal:n \c_ten } } + { + \@@_item_reverse:n + { \@@_item_caseful_equal:n { `\^^J } } + } % \end{macrocode} % \end{macro} % @@ -1213,40 +1216,46 @@ \cs_new_protected:Npn \@@_posix_alpha: { \@@_posix_lower: \@@_posix_upper: } \cs_new_protected:Npn \@@_posix_ascii: - { \@@_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \@@_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \@@_posix_blank: \@@_prop_h: \cs_new_protected:Npn \@@_posix_cntrl: { - \@@_item_caseful_range:nn \c_zero { 31 } - \@@_item_caseful_equal:n \c_one_hundred_twenty_seven + \@@_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \@@_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \@@_posix_digit: \@@_prop_d: \cs_new_protected:Npn \@@_posix_graph: - { \@@_item_caseful_range:nn { 33 } { 126 } } + { \@@_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \@@_posix_lower: - { \@@_item_caseful_range:nn \c_ninety_seven { 122 } } + { \@@_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \@@_posix_print: - { \@@_item_caseful_range:nn \c_thirty_two { 126 } } + { \@@_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \@@_posix_punct: { - \@@_item_caseful_range:nn { 33 } { 47 } - \@@_item_caseful_range:nn { 58 } { 64 } - \@@_item_caseful_range:nn { 91 } { 96 } - \@@_item_caseful_range:nn { 123 } { 126 } + \@@_item_caseful_range:nn { `! } { `/ } + \@@_item_caseful_range:nn { `: } { `@ } + \@@_item_caseful_range:nn { `[ } { `` } + \@@_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \@@_posix_space: { - \@@_item_caseful_equal:n \c_thirty_two - \@@_item_caseful_range:nn \c_nine \c_thirteen + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \@@_posix_upper: - { \@@_item_caseful_range:nn \c_sixty_five { 90 } } + { \@@_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \@@_posix_word: \@@_prop_w: \cs_new_protected:Npn \@@_posix_xdigit: { \@@_posix_digit: - \@@_item_caseful_range:nn \c_sixty_five { 70 } - \@@_item_caseful_range:nn \c_ninety_seven { 102 } + \@@_item_caseful_range:nn { `A } { `F } + \@@_item_caseful_range:nn { `a } { `f } } % \end{macrocode} % \end{macro} @@ -1296,7 +1305,7 @@ \cs_set:Npn \@@_escape_unescaped:N ##1 { #1 } \cs_set:Npn \@@_escape_escaped:N ##1 { #2 } \cs_set:Npn \@@_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g_@@_internal_tl { #4 } \tl_set:Nx \l_@@_internal_b_tl { @@ -1398,12 +1407,12 @@ } \cs_new:Npn \@@_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \@@_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \@@_escape_raw:N { \__str_output_byte:n {#1} } } - { \@@_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -1418,7 +1427,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l_@@_internal_b_tl @@ -1542,42 +1551,42 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_char_if_special:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \if_int_compare:w `#1 < \c_thirty_two - \prg_return_false: \else: \prg_return_true: \fi: - \else: \prg_return_false: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \if_int_compare:w `#1 < \c__str_ascii_max_int + \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_seven - \prg_return_true: \else: \prg_return_false: \fi: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \if_int_compare:w `#1 < `\ \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \else: \prg_return_false: \fi: \fi: \fi: } \prg_new_conditional:Npnn \@@_char_if_alphanumeric:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \prg_return_false: \else: \prg_return_true: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \prg_return_false: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \else: - \prg_return_false: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: \fi: \fi: } @@ -1613,7 +1622,9 @@ % \item \cs{@@_item_catcode_reverse:nT} \Arg{catcode bitmap} \Arg{tests} % \item \cs{@@_item_reverse:n} \Arg{tests} % \item \cs{@@_item_exact:nn} \Arg{catcode} \Arg{char code} -% \item \cs{@@_item_exact_cs:c} \Arg{csname} +% \item \cs{@@_item_exact_cs:n} \Arg{csnames}, more precisely given as +% \meta{csname} \cs{scan_stop:} \meta{csname} \cs{scan_stop:} +% \meta{csname} and so on in a brace group. % \item \cs{@@_item_cs:n} \Arg{compiled regex} % \end{itemize} % @@ -1627,13 +1638,30 @@ % \end{variable} % % \begin{variable}{\l_@@_mode_int} +% \begin{variable} +% { +% \c_@@_cs_in_class_mode_int, +% \c_@@_cs_mode_int, +% \c_@@_outer_mode_int, +% \c_@@_catcode_mode_int, +% \c_@@_class_mode_int, +% \c_@@_catcode_in_class_mode_int +% } % While compiling, ten modes are recognized, labelled $-63$, $-23$, % $-6$, $-2$, $0$, $2$, $3$, $6$, $23$, $63$. See -% section~\ref{sec:regex-modes}. +% section~\ref{sec:regex-modes}. We only define some of these as +% constants. % \begin{macrocode} \int_new:N \l_@@_mode_int +\int_const:Nn \c_@@_cs_in_class_mode_int { -6 } +\int_const:Nn \c_@@_cs_mode_int { -2 } +\int_const:Nn \c_@@_outer_mode_int { 0 } +\int_const:Nn \c_@@_catcode_mode_int { 2 } +\int_const:Nn \c_@@_class_mode_int { 3 } +\int_const:Nn \c_@@_catcode_in_class_mode_int { 6 } % \end{macrocode} % \end{variable} +% \end{variable} % % \begin{variable}{\l_@@_catcodes_int, \l_@@_default_catcodes_int} % \begin{variable}{\l_@@_catcodes_bool} @@ -1738,7 +1766,7 @@ \prg_new_conditional:Npnn \@@_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \@@_compile_raw:N #1 - \if_int_compare:w \c_one < 1 #2 \exp_stop_f: + \if_int_compare:w 1 < 1 #2 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -1763,7 +1791,7 @@ % \item[6] |[\c...]| catcode test in a class, % \item[-63] |[\c{[...]}]| class inside mode $-6$, % \item[-23] |\c{[...]}| class inside mode $-2$, -% \item[3] |[...]| class inside mode $-3$, +% \item[3] |[...]| class inside mode $0$, % \item[23] |\c[...]| class inside mode $2$, % \item[63] |[\c[...]]| class inside mode $6$. % \end{itemize} @@ -1819,7 +1847,7 @@ \if_int_odd:w \l_@@_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l_@@_mode_int < \c_zero + \if_int_compare:w \l_@@_mode_int < \c_@@_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -1838,7 +1866,7 @@ \if_int_odd:w \l_@@_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l_@@_mode_int > \c_zero + \if_int_compare:w \l_@@_mode_int > \c_@@_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -1856,7 +1884,7 @@ % \begin{macrocode} \cs_new:Npn \@@_if_within_catcode:TF { - \if_int_compare:w \l_@@_mode_int > \c_zero + \if_int_compare:w \l_@@_mode_int > \c_@@_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -1871,10 +1899,10 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_chk_c_allowed:T { - \if_int_compare:w \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l_@@_mode_int = \c_three + \if_int_compare:w \l_@@_mode_int = \c_@@_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -1891,11 +1919,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_mode_quit_c: { - \if_int_compare:w \l_@@_mode_int = \c_two - \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_mode_int + \int_set_eq:NN \l_@@_mode_int \c_@@_outer_mode_int \else: - \if_int_compare:w \l_@@_mode_int = \c_six - \l_@@_mode_int = \c_three + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_in_class_mode_int + \int_set_eq:NN \l_@@_mode_int \c_@@_class_mode_int \fi: \fi: } @@ -1931,7 +1959,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l_@@_group_level_int > \c_zero + \if_int_compare:w \l_@@_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l_@@_group_level_int } \prg_replicate:nn @@ -1967,8 +1995,8 @@ \cs_new_protected:Npn \@@_compile:n #1 { \@@_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l_@@_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l_@@_mode_int \c_@@_outer_mode_int \@@_escape_use:nnnn { \@@_char_if_special:NTF ##1 @@ -1982,14 +2010,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l_@@_mode_int = \c_two + \int_compare:nNnT \l_@@_mode_int = \c_@@_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l_@@_mode_int < \c_zero + \int_compare:nNnT \l_@@_mode_int < \c_@@_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \@@_compile_end: - \@@_compile_one:x - { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } } + \@@_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -2343,7 +2369,7 @@ } \cs_new_protected:cpn { @@_prop_.: } { - \if_int_compare:w \l_@@_current_char_int > - \c_two + \if_int_compare:w \l_@@_current_char_int > - 2 \exp_stop_f: \exp_after:wN \@@_break_true:w \fi: } @@ -2467,11 +2493,11 @@ { \@@_if_in_class:TF { - \if_int_compare:w \l_@@_mode_int > \c_sixteen + \if_int_compare:w \l_@@_mode_int > \c_@@_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l_@@_mode_int - \c_fifteen - \tex_divide:D \l_@@_mode_int \c_thirteen + \tex_advance:D \l_@@_mode_int - 15 \exp_stop_f: + \tex_divide:D \l_@@_mode_int 13 \exp_stop_f: \if_int_odd:w \l_@@_mode_int \else: \exp_after:wN \@@_compile_quantifier:w \fi: @@ -2531,7 +2557,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_compile_class_catcode:w #1; { - \if_int_compare:w \l_@@_mode_int = \c_two + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_mode_int \__tl_build_one:n { \@@_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -2678,7 +2704,7 @@ } \cs_new_protected:Npn \@@_compile_group_end: { - \if_int_compare:w \l_@@_group_level_int > \c_zero + \if_int_compare:w \l_@@_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int @@ -2821,7 +2847,11 @@ { \int_set_eq:Nc \l_@@_catcodes_int { c_@@_catcode_#2_int } \l_@@_mode_int - = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_catcode_mode_int + \else: + \c_@@_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { @@_compile_c_#2:w } } @@ -2847,7 +2877,11 @@ \cs_new_protected:cpn { @@_compile_c_[:w } #1#2 { \l_@@_mode_int - = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_catcode_mode_int + \else: + \c_@@_catcode_in_class_mode_int + \fi: \int_zero:N \l_@@_catcodes_int \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ^ } { @@ -2909,32 +2943,93 @@ \@@_compile:w \@@_disable_submatches: \l_@@_mode_int - = - \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_cs_mode_int + \else: + \c_@@_cs_in_class_mode_int + \fi: } % \end{macrocode} % \end{macro} % % \begin{macro}+\@@_compile_}:+ +% \begin{macro}{\@@_compile_end_cs:} +% \begin{macro}[EXP,aux]{\@@_compile_cs_aux:Nn, \@@_compile_cs_aux:NNnnnN} % Non-escaped right braces are only special if they appear when % compiling the regular expression for a csname, but not within a -% class: |\c{[}{]}| matches the control sequences |\}| and -% |\{|\ldots{} Admittedly, that would be better done as -% |\c{[{}]}|. So, end compiling the inner regex (this closes any -% dangling class or group). Then insert the corresponding test in the -% outer regex. -% \begin{macrocode} +% class: |\c{[{}]}| matches the control sequences |\{| and |\}|. So, +% end compiling the inner regex (this closes any dangling class or +% group). Then insert the corresponding test in the outer regex. As +% an optimization, if the control sequence test simply consists of +% several explicit possibilities (branches) then use +% \cs{@@_item_exact_cs:n} with an argument consisting of all +% possibilities separated by \cs{scan_stop:}. +% \begin{macrocode} +\flag_new:n { @@_cs } \cs_new_protected:cpn { @@_compile_ \c_right_brace_str : } { \@@_if_in_cs:TF + { \@@_compile_end_cs: } + { \exp_after:wN \@@_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \@@_compile_end_cs: + { + \@@_compile_end: + \flag_clear:n { @@_cs } + \tl_set:Nx \l_@@_internal_a_tl { - \@@_compile_end: - \@@_compile_one:x + \exp_after:wN \@@_compile_cs_aux:Nn \l_@@_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \@@_compile_one:x + { + \flag_if_raised:nTF { @@_cs } { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } } + { \@@_item_exact_cs:n { \tl_tail:N \l_@@_internal_a_tl } } + } + } +\cs_new:Npn \@@_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \@@_branch:n + { + \scan_stop: + \@@_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \@@_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { @@_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \@@_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \@@_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \@@_item_caseful_equal:n } + { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } + { \int_compare_p:nNn {#5} = { 0 } } + } + { + \prg_replicate:nn {#4} + { \char_generate:nn { \use_ii:nn #3 } {12} } + \@@_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { @@_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \@@_compile_raw:N \c_right_brace_str } } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \subsubsection{Raw token lists with \cs{u}} % @@ -2998,7 +3093,7 @@ \cs_new_protected:Npn \@@_compile_u_end: { \tl_set:Nv \l_@@_internal_a_tl { \l_@@_internal_a_tl } - \if_int_compare:w \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_outer_mode_int \@@_compile_u_not_cs: \else: \@@_compile_u_in_cs: @@ -3045,8 +3140,8 @@ { \@@_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \@@_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \@@_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \@@_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -3068,7 +3163,7 @@ % \begin{macrocode} \cs_new_protected:cpn { @@_compile_/K: } { - \int_compare:nNnTF \l_@@_mode_int = \c_zero + \int_compare:nNnTF \l_@@_mode_int = \c_@@_outer_mode_int { \__tl_build_one:n { \@@_command_K: } } { \@@_compile_raw_error:N K } } @@ -3077,12 +3172,12 @@ % % \subsubsection{Showing regexes} % -% \begin{macro}[aux]{\@@_show:Nx} +% \begin{macro}[aux]{\@@_show:Nn} % Within a \cs{__tl_build:Nw} \ldots{} \cs{__tl_build_end:} group, we % redefine all the function that can appear in a compiled regex, then % run the regex. The result is then shown. % \begin{macrocode} -\cs_new_protected:Npn \@@_show:Nx #1#2 +\cs_new_protected:Npn \@@_show:Nn #1#2 { \__tl_build:Nw \l_@@_internal_a_tl \cs_set_protected:Npn \@@_branch:n @@ -3124,16 +3219,16 @@ { \@@_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \@@_item_exact:nn ##1##2 { \@@_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \@@_item_exact_cs:c ##1 - { \@@_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \@@_item_exact_cs:n \@@_show_item_exact_cs:n \cs_set_protected:Npn \@@_item_cs:n { \@@_show_scope:nn { control~sequence } } \cs_set:cpn { @@_prop_.: } { \@@_show_one:n { any~token } } \seq_clear:N \l_@@_show_prefix_seq \@@_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l_@@_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l_@@_internal_a_tl } } % \end{macrocode} % \end{macro} @@ -3285,6 +3380,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[aux]{\@@_show_item_exact_cs:n} +% \begin{macrocode} +\cs_new_protected:Npn \@@_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l_@@_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l_@@_internal_seq + \l_@@_internal_seq { \iow_char:N\\##1 } + \@@_show_one:n + { control~sequence~ \seq_use:Nn \l_@@_internal_seq { ~or~ } } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Building} % % \subsubsection{Variables used while building} @@ -3385,7 +3493,7 @@ \cs_new_protected:Npn \@@_build:N #1 { %<trace> \trace_push:nnn { regex } { 1 } { @@_build } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l_@@_capturing_group_int \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int \@@_build_new_state: @@ -3513,7 +3621,7 @@ L=\int_use:N \l_@@_left_state_int ~ -> ~ R=\int_use:N \l_@@_right_state_int ~ -> ~ M=\int_use:N \l_@@_max_state_int ~ -> ~ - \int_eval:n { \l_@@_max_state_int + \c_one } + \int_eval:n { \l_@@_max_state_int + 1 } } %</trace> \tex_toks:D \l_@@_max_state_int { } @@ -3610,7 +3718,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \@@_build_transitions_lazyness:NNNNN #2 \@@_action_free:n \l_@@_right_state_int \@@_tests_action_cost:n \l_@@_left_state_int @@ -3638,7 +3746,7 @@ { \@@_class_repeat:n {#1} \int_set:Nn \l_@@_internal_a_int - { \l_@@_max_state_int + #2 - \c_one } + { \l_@@_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \@@_build_transitions_lazyness:NNNNN #3 @@ -3671,7 +3779,7 @@ \cs_new_protected:Npn \@@_group_aux:nnnnN #1#2#3#4#5 { %<trace> \trace_push:nnn { regex } { 1 } { @@_group } - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \@@_build_new_state: %<assert>\assert_int:n { \l_@@_max_state_int = \l_@@_right_state_int + 1 } \@@_build_transition_right:nNn \@@_action_free_group:n @@ -3779,9 +3887,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_repeat:nn #1#2 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l_@@_max_state_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \@@_build_new_state: \else: \@@_group_repeat_aux:n {#2} @@ -3799,7 +3907,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \@@_toks_put_left:Nx #2 { \@@_action_submatch:n { #1 < } } \@@_toks_put_left:Nx #3 { \@@_action_submatch:n { #1 > } } \fi: @@ -3823,10 +3931,10 @@ \l_@@_right_state_int \l_@@_max_state_int \int_set_eq:NN \l_@@_internal_a_int \l_@@_left_state_int \int_set_eq:NN \l_@@_internal_b_int \l_@@_max_state_int - \if_int_compare:w \__int_eval:w #1 > \c_one + \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: \int_set:Nn \l_@@_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l_@@_internal_b_int - \l_@@_internal_a_int ) } \tex_advance:D \l_@@_right_state_int \l_@@_internal_c_int @@ -3835,8 +3943,8 @@ { \tex_toks:D \l_@@_internal_b_int = \tex_toks:D \l_@@_internal_a_int - \tex_advance:D \l_@@_internal_a_int \c_one - \tex_advance:D \l_@@_internal_b_int \c_one + \int_incr:N \l_@@_internal_a_int + \int_incr:N \l_@@_internal_b_int } \fi: } @@ -3865,11 +3973,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \@@_group_submatches:nNN {#1} \l_@@_left_state_int \l_@@_right_state_int \int_set:Nn \l_@@_internal_a_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \@@_build_transition_right:nNn \@@_action_free:n \l_@@_right_state_int \l_@@_internal_a_int \@@_build_new_state: @@ -3929,16 +4037,16 @@ \l_@@_left_state_int \l_@@_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l_@@_right_state_int { \l_@@_internal_b_int - \l_@@_internal_a_int } \@@_build_transition_right:nNn \@@_action_free:n \l_@@_right_state_int \l_@@_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l_@@_right_state_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \else: \int_sub:Nn \l_@@_right_state_int { \l_@@_internal_b_int - \l_@@_internal_a_int } @@ -4243,7 +4351,7 @@ %<trace> \trace_push:nnx { regex } { 1 } { @@_match } %<trace> \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l_@@_balance_int - \int_set:Nn \l_@@_current_pos_int { \c_two * \l_@@_max_state_int } + \int_set:Nn \l_@@_current_pos_int { 2 * \l_@@_max_state_int } \@@_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l_@@_min_pos_int \l_@@_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -4253,13 +4361,13 @@ %<trace> \trace:nnx { regex } { 1 } { initializing } \bool_gset_false:N \g_@@_success_bool \int_step_inline:nnnn - \l_@@_min_state_int \c_one { \l_@@_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l_@@_min_state_int { 1 } { \l_@@_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l_@@_min_active_int \l_@@_max_state_int - \int_set_eq:NN \l_@@_step_int \c_zero + \int_zero:N \l_@@_step_int \int_set_eq:NN \l_@@_success_pos_int \l_@@_min_pos_int \int_set:Nn \l_@@_submatch_int - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \bool_set_false:N \l_@@_empty_success_bool \@@_match_once: %<trace> \trace_pop:nnx { regex } { 1 } { @@_match } @@ -4295,7 +4403,7 @@ \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int \@@_store_state:n { \l_@@_min_state_int } \int_set:Nn \l_@@_current_pos_int - { \l_@@_start_pos_int - \c_one } + { \l_@@_start_pos_int - 1 } \@@_query_get: \@@_match_loop: \l_@@_every_match_tl @@ -4344,7 +4452,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_match_loop: { - \tex_advance:D \l_@@_step_int \c_two + \tex_advance:D \l_@@_step_int 2 \exp_stop_f: \int_incr:N \l_@@_current_pos_int \int_set_eq:NN \l_@@_last_char_int \l_@@_current_char_int \int_set_eq:NN \l_@@_case_changed_char_int \c_max_int @@ -4370,7 +4478,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \@@_match_one_active:w - \__int_value:w \__int_eval:w #1 + \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #1 + 1 \exp_after:wN ; \fi: } % \end{macrocode} @@ -4437,7 +4545,7 @@ = \l_@@_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l_@@_current_state_int \tex_dimen:D \l_@@_current_state_int - = \__int_eval:w \l_@@_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l_@@_step_int + 1 \__int_eval_end: sp \scan_stop: } % \end{macrocode} % \end{macro} @@ -4714,7 +4822,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \@@_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } % \end{macrocode} % \end{macro} @@ -4788,7 +4896,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l_@@_replacement_csnames_int } \__tl_build_one:x @@ -4828,7 +4936,7 @@ { \cs_if_exist_use:cF { @@_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \@@_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -4854,7 +4962,7 @@ { \if_int_compare:w #1 < \l_@@_capturing_group_int \__tl_build_one:n { \@@_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l_@@_balance_tl { + \@@_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -4880,9 +4988,9 @@ { \token_if_eq_meaning:NNTF #1 \__tl_build_one:n { - \if_int_compare:w \c_one < 1#2 \exp_stop_f: + \if_int_compare:w 1 < 1#2 \exp_stop_f: \int_set:Nn \l_@@_internal_a_int - { \c_ten * \l_@@_internal_a_int + #2 } + { 10 * \l_@@_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \@@_replacement_g_digits:NN \else: @@ -4968,7 +5076,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_replacement_rbrace:N #1 { - \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l_@@_replacement_csnames_int \else: @@ -5002,7 +5110,7 @@ \if_meaning:w \prg_do_nothing: #3 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \tex_lccode:D \c_zero = `#3 \scan_stop: + \tex_lccode:D 0 = `#3 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {#1} } \fi: } @@ -5032,7 +5140,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \@@_replacement_c_B:w { - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l_@@_balance_int \fi: \@@_replacement_char:nNN @@ -5069,7 +5177,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \@@_replacement_c_E:w { - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l_@@_balance_int \fi: \@@_replacement_char:nNN @@ -5133,10 +5241,10 @@ \if_meaning:w \prg_do_nothing: #2 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \if_int_compare:w `#2 = \c_zero + \if_int_compare:w `#2 = 0 \exp_stop_f: \__msg_kernel_error:nn { regex } { replacement-null-space } \fi: - \tex_lccode:D 32 = `#2 \scan_stop: + \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } \fi: } @@ -5225,11 +5333,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \@@_compile:n {#1} - \@@_show:Nx \l_@@_internal_regex + \@@_show:Nn \l_@@_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \@@_show:Nx #1 { variable~\token_to_str:N #1 } } + { \@@_show:Nn #1 { variable~\token_to_str:N #1 } } % \end{macrocode} % \end{macro} % @@ -5489,14 +5597,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } - \c_one - { \l_@@_submatch_int - \c_one } + { 2 * \l_@@_max_state_int } + { 1 } + { \l_@@_submatch_int - 1 } \@@_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { @@_begin } + \flag_height:n { @@_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -5528,12 +5636,12 @@ } \cs_new:Npn \@@_extract_seq_aux:ww #1; #2; { - \if_int_compare:w #1 < \c_zero + \if_int_compare:w #1 < 0 \exp_stop_f: \flag_raise:n { @@_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \@@_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { @@_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -5560,12 +5668,12 @@ \int_set_eq:NN \l_@@_zeroth_submatch_int \l_@@_submatch_int \prg_replicate:nn \l_@@_capturing_group_int { - \tex_skip:D \l_@@_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l_@@_submatch_int 0 sp \scan_stop: \int_incr:N \l_@@_submatch_int } \prop_map_inline:Nn \l_@@_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \@@_extract_e:wn \__int_value:w \else: \exp_after:wN \@@_extract_b:wn \__int_value:w @@ -5659,17 +5767,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \l_@@_capturing_group_int - { \l_@@_submatch_int - \c_one } + { \l_@@_submatch_int - 1 } \@@_replacement_balance_one_match:n } \tl_set:Nx \l_@@_internal_a_tl { \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \l_@@_capturing_group_int - { \l_@@_submatch_int - \c_one } + { \l_@@_submatch_int - 1 } \@@_replacement_do_one_match:n \@@_query_range:nn \l_@@_start_pos_int \l_@@_max_pos_int @@ -5687,24 +5795,24 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_end_replace:N #1 { - \if_int_compare:w \l_@@_balance_int = \c_zero + \if_int_compare:w \l_@@_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l_@@_balance_int } { \c_zero } } - { \int_max:nn { \l_@@_balance_int } { \c_zero } } + { \int_max:nn { - \l_@@_balance_int } { 0 } } + { \int_max:nn { \l_@@_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l_@@_balance_int < \c_zero + \if_int_compare:w \l_@@_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l_@@_balance_int } { { \if_false: } \fi: } \fi: \l_@@_internal_a_tl - \if_int_compare:w \l_@@_balance_int > \c_zero + \if_int_compare:w \l_@@_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l_@@_balance_int } { \if_false: { \fi: } } \fi: @@ -6028,7 +6136,7 @@ { \int_step_inline:nnnn \l_@@_min_state_int - \c_one + { 1 } { \l_@@_max_state_int - 1 } { \trace:nnx { regex } { #1 } |