diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
commit | 6fca20c09474a7f6a3559af1c984243a83669f61 (patch) | |
tree | cbfda048c91853241ef903a84a088c1e3a66fd50 /Master/texmf-dist/tex/latex/l3experimental | |
parent | ddbc1f2a5f193876d6f1df544e286029c6d671f8 (diff) |
l3 (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental')
31 files changed, 695 insertions, 629 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty deleted file mode 100644 index b38ece3d01d..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty +++ /dev/null @@ -1,92 +0,0 @@ -%% -%% This is file `l3flag.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3flag.dtx (with options: `package') -%% -%% Copyright (C) 2011-2016 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 license or (at your option) any later version. The latest -%% version of this license is in the file: -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3flag.dtx Copyright (C) 2011-2012,2014-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} - {} - {% - \PackageError{l3flag}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3flag will abort!% - }% - \endinput - } -\GetIdInfo$Id: l3flag.dtx 6878 2017-02-10 07:40:59Z joseph $ - {L3 Experimental flags} -\ProvidesExplPackage - {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\cs_new_protected:Npn \flag_new:n #1 - { - \cs_new:cpn { __flag_trap_#1:w } ##1 ; - { \exp_after:wN \use_none:n \cs:w __flag_#1_##1: \cs_end: } - } -\cs_new_protected:Npn \flag_clear:n #1 - { \__flag_clear:ww 0 ; #1 \q_stop } -\cs_new_protected:Npn \__flag_clear:ww #1 ; #2 \q_stop - { - \if_cs_exist:w __flag_#2_#1: \cs_end: - \else: - \exp_after:wN \use_none_delimit_by_q_stop:w - \fi: - \cs_set_eq:cN { __flag_#2_#1: } \tex_undefined:D - \exp_after:wN \__flag_clear:ww - \__int_value:w \__int_eval:w \c_one + #1 ; - #2 \q_stop - } -\cs_new_protected:Npn \flag_clear_new:n #1 - { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} } -\cs_new_protected:Npn \flag_set_trap:nn #1#2 - { \cs_set:cpn { __flag_trap_#1:w } ##1 ; {#2} } -\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } - { - \cs_if_exist:cTF { __flag_trap_#1:w } - { \prg_return_true: } { \prg_return_false: } - } -\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \if_cs_exist:w __flag_#1_0: \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:ww 0; #1 \q_stop } -\cs_new:Npn \__flag_height_loop:ww #1 ; #2 \q_stop - { - \if_cs_exist:w __flag_#2_#1: \cs_end: - \exp_after:wN \__flag_height_loop:ww \__int_value:w \__int_eval:w \c_one + - \else: - \exp_after:wN \__flag_height_end:ww - \fi: - #1 ; #2 \q_stop - } -\cs_new:Npn \__flag_height_end:ww #1 ; #2 \q_stop { #1 } -\cs_new:Npn \flag_raise:n #1 - { - \cs:w __flag_trap_#1:w \exp_after:wN \cs_end: - \__int_value:w \flag_height:n {#1} ; - } -%% -%% -%% End of file `l3flag.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty index 5c1c9b8be80..7c49cc0c059 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty @@ -18,9 +18,9 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -32,11 +32,11 @@ }% \endinput } -\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} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} \cs_generate_variant:Nn \tl_to_str:n { V } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -107,17 +107,15 @@ \cs_new_protected:Npn \__regex_compute_case_changed_char: { \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int < \c_ninety_one - \if_int_compare:w \l__regex_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -130,7 +128,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 \__regex_item_catcode:nT #1 @@ -151,23 +149,25 @@ \fi: \fi: } -\cs_new_protected:Npn \__regex_item_exact_cs:c #1 +\cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero + \int_compare:nNnTF \l__regex_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l__regex_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__regex_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } { } } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = \c_zero + \int_compare:nNnT \l__regex_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l__regex_cs_name_tl @@ -189,70 +189,79 @@ } } \cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \__regex_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \__regex_prop_h: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \__regex_prop_s: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab - \__regex_item_caseful_equal:n \c_ten % lf - \__regex_item_caseful_equal:n \c_twelve % ff - \__regex_item_caseful_equal:n \c_thirteen % cr + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + \__regex_item_caseful_equal:n { `\^^J } + \__regex_item_caseful_equal:n { `\^^L } + \__regex_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \__regex_prop_w: { - \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \__regex_item_caseful_equal:n { 95 } % _ + \__regex_item_caseful_range:nn { `a } { `z } + \__regex_item_caseful_range:nn { `A } { `Z } + \__regex_item_caseful_range:nn { `0 } { `9 } + \__regex_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \__regex_prop_N: - { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } } + { + \__regex_item_reverse:n + { \__regex_item_caseful_equal:n { `\^^J } } + } \cs_new_protected:Npn \__regex_posix_alnum: { \__regex_posix_alpha: \__regex_posix_digit: } \cs_new_protected:Npn \__regex_posix_alpha: { \__regex_posix_lower: \__regex_posix_upper: } \cs_new_protected:Npn \__regex_posix_ascii: - { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: \cs_new_protected:Npn \__regex_posix_cntrl: { - \__regex_item_caseful_range:nn \c_zero { 31 } - \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \__regex_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: \cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { 33 } { 126 } } + { \__regex_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } } + { \__regex_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn \c_thirty_two { 126 } } + { \__regex_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \__regex_posix_punct: { - \__regex_item_caseful_range:nn { 33 } { 47 } - \__regex_item_caseful_range:nn { 58 } { 64 } - \__regex_item_caseful_range:nn { 91 } { 96 } - \__regex_item_caseful_range:nn { 123 } { 126 } + \__regex_item_caseful_range:nn { `! } { `/ } + \__regex_item_caseful_range:nn { `: } { `@ } + \__regex_item_caseful_range:nn { `[ } { `` } + \__regex_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \__regex_posix_space: { - \__regex_item_caseful_equal:n \c_thirty_two - \__regex_item_caseful_range:nn \c_nine \c_thirteen + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn \c_sixty_five { 90 } } + { \__regex_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: \cs_new_protected:Npn \__regex_posix_xdigit: { \__regex_posix_digit: - \__regex_item_caseful_range:nn \c_sixty_five { 70 } - \__regex_item_caseful_range:nn \c_ninety_seven { 102 } + \__regex_item_caseful_range:nn { `A } { `F } + \__regex_item_caseful_range:nn { `a } { `f } } \cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 { @@ -261,7 +270,7 @@ \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g__regex_internal_tl { #4 } \tl_set:Nx \l__regex_internal_b_tl { @@ -316,12 +325,12 @@ } \cs_new:Npn \__regex_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \__regex_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \__regex_escape_raw:N { \__str_output_byte:n {#1} } } - { \__regex_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -336,7 +345,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl @@ -407,47 +416,53 @@ } \prg_new_conditional:Npnn \__regex_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 \__regex_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: } \int_new:N \l__regex_group_level_int \int_new:N \l__regex_mode_int +\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } +\int_const:Nn \c__regex_cs_mode_int { -2 } +\int_const:Nn \c__regex_outer_mode_int { 0 } +\int_const:Nn \c__regex_catcode_mode_int { 2 } +\int_const:Nn \c__regex_class_mode_int { 3 } +\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } \int_new:N \l__regex_catcodes_int \int_new:N \l__regex_default_catcodes_int \bool_new:N \l__regex_catcodes_bool @@ -482,7 +497,7 @@ \prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \__regex_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: @@ -504,7 +519,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l__regex_mode_int < \c_zero + \if_int_compare:w \l__regex_mode_int < \c__regex_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 @@ -516,7 +531,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_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 @@ -525,7 +540,7 @@ } \cs_new:Npn \__regex_if_within_catcode:TF { - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -533,10 +548,10 @@ } \cs_new_protected:Npn \__regex_chk_c_allowed:T { - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -546,11 +561,11 @@ } \cs_new_protected:Npn \__regex_mode_quit_c: { - \if_int_compare:w \l__regex_mode_int = \c_two - \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \else: - \if_int_compare:w \l__regex_mode_int = \c_six - \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int \fi: \fi: } @@ -573,7 +588,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn @@ -594,8 +609,8 @@ \cs_new_protected:Npn \__regex_compile:n #1 { \__regex_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l__regex_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \__regex_escape_use:nnnn { \__regex_char_if_special:NTF ##1 @@ -609,14 +624,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c_two + \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c_zero + \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end: - \__regex_compile_one:x - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -839,7 +852,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - \c_two + \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -906,11 +919,11 @@ { \__regex_if_in_class:TF { - \if_int_compare:w \l__regex_mode_int > \c_sixteen + \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l__regex_mode_int - \c_fifteen - \tex_divide:D \l__regex_mode_int \c_thirteen + \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: + \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: \if_int_odd:w \l__regex_mode_int \else: \exp_after:wN \__regex_compile_quantifier:w \fi: @@ -938,7 +951,7 @@ } \cs_new_protected:Npn \__regex_compile_class_catcode:w #1; { - \if_int_compare:w \l__regex_mode_int = \c_two + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int \__tl_build_one:n { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -1040,7 +1053,7 @@ } \cs_new_protected:Npn \__regex_compile_group_end: { - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int @@ -1132,7 +1145,11 @@ { \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } @@ -1144,7 +1161,11 @@ \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: \int_zero:N \l__regex_catcodes_int \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } { @@ -1197,17 +1218,72 @@ \__regex_compile:w \__regex_disable_submatches: \l__regex_mode_int - = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_cs_mode_int + \else: + \c__regex_cs_in_class_mode_int + \fi: } +\flag_new:n { __regex_cs } \cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } { \__regex_if_in_cs:TF + { \__regex_compile_end_cs: } + { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \__regex_compile_end_cs: + { + \__regex_compile_end: + \flag_clear:n { __regex_cs } + \tl_set:Nx \l__regex_internal_a_tl { - \__regex_compile_end: - \__regex_compile_one:x + \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \__regex_compile_one:x + { + \flag_if_raised:nTF { __regex_cs } { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } + } + } +\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \__regex_branch:n + { + \scan_stop: + \__regex_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \__regex_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \__regex_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} } + \__regex_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { __regex_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } } \cs_new_protected:cpn { __regex_compile_/u: } #1#2 { @@ -1247,7 +1323,7 @@ \cs_new_protected:Npn \__regex_compile_u_end: { \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \__regex_compile_u_not_cs: \else: \__regex_compile_u_in_cs: @@ -1277,8 +1353,8 @@ { \__regex_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -1289,11 +1365,11 @@ } \cs_new_protected:cpn { __regex_compile_/K: } { - \int_compare:nNnTF \l__regex_mode_int = \c_zero + \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int { \__tl_build_one:n { \__regex_command_K: } } { \__regex_compile_raw_error:N K } } -\cs_new_protected:Npn \__regex_show:Nx #1#2 +\cs_new_protected:Npn \__regex_show:Nn #1#2 { \__tl_build:Nw \l__regex_internal_a_tl \cs_set_protected:Npn \__regex_branch:n @@ -1335,16 +1411,16 @@ { \__regex_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \__regex_item_exact_cs:c ##1 - { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n \cs_set_protected:Npn \__regex_item_cs:n { \__regex_show_scope:nn { control~sequence } } \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } \seq_clear:N \l__regex_show_prefix_seq \__regex_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l__regex_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l__regex_internal_a_tl } } \cs_new_protected:Npn \__regex_show_one:n #1 { @@ -1439,6 +1515,14 @@ \bool_if:NF #1 { negative~ } class } } +\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l__regex_internal_seq + \l__regex_internal_seq { \iow_char:N\\##1 } + \__regex_show_one:n + { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } + } \int_new:N \l__regex_min_state_int \int_new:N \l__regex_max_state_int \int_new:N \l__regex_left_state_int @@ -1454,7 +1538,7 @@ \cs_new_protected:Npn \__regex_build:N #1 { \trace_push:nnn { regex } { 1 } { __regex_build } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l__regex_capturing_group_int \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int \__regex_build_new_state: @@ -1525,7 +1609,7 @@ L=\int_use:N \l__regex_left_state_int ~ -> ~ R=\int_use:N \l__regex_right_state_int ~ -> ~ M=\int_use:N \l__regex_max_state_int ~ -> ~ - \int_eval:n { \l__regex_max_state_int + \c_one } + \int_eval:n { \l__regex_max_state_int + 1 } } \tex_toks:D \l__regex_max_state_int { } \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int @@ -1573,7 +1657,7 @@ } \cs_new_protected:Npn \__regex_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__regex_build_transitions_lazyness:NNNNN #2 \__regex_action_free:n \l__regex_right_state_int \__regex_tests_action_cost:n \l__regex_left_state_int @@ -1589,7 +1673,7 @@ { \__regex_class_repeat:n {#1} \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - \c_one } + { \l__regex_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \__regex_build_transitions_lazyness:NNNNN #3 @@ -1600,7 +1684,7 @@ \cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 { \trace_push:nnn { regex } { 1 } { __regex_group } - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \__regex_build_new_state: \__regex_build_transition_right:nNn \__regex_action_free_group:n \l__regex_left_state_int \l__regex_right_state_int @@ -1664,9 +1748,9 @@ } \cs_new_protected:Npn \__regex_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__regex_max_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_new_state: \else: \__regex_group_repeat_aux:n {#2} @@ -1677,7 +1761,7 @@ } \cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } \fi: @@ -1688,10 +1772,10 @@ \l__regex_right_state_int \l__regex_max_state_int \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int \int_set_eq:NN \l__regex_internal_b_int \l__regex_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__regex_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) } \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int @@ -1700,18 +1784,18 @@ { \tex_toks:D \l__regex_internal_b_int = \tex_toks:D \l__regex_internal_a_int - \tex_advance:D \l__regex_internal_a_int \c_one - \tex_advance:D \l__regex_internal_b_int \c_one + \int_incr:N \l__regex_internal_a_int + \int_incr:N \l__regex_internal_b_int } \fi: } \cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \__regex_group_submatches:nNN {#1} \l__regex_left_state_int \l__regex_right_state_int \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_internal_a_int \__regex_build_new_state: @@ -1751,16 +1835,16 @@ \l__regex_left_state_int \l__regex_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \else: \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } @@ -1842,7 +1926,7 @@ \trace_push:nnx { regex } { 1 } { __regex_match } \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { \c_two * \l__regex_max_state_int } + \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } \__regex_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -1852,13 +1936,13 @@ \trace:nnx { regex } { 1 } { initializing } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn - \l__regex_min_state_int \c_one { \l__regex_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_step_int \c_zero + \int_zero:N \l__regex_step_int \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int \int_set:Nn \l__regex_submatch_int - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \bool_set_false:N \l__regex_empty_success_bool \__regex_match_once: \trace_pop:nnx { regex } { 1 } { __regex_match } @@ -1877,7 +1961,7 @@ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int \__regex_store_state:n { \l__regex_min_state_int } \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - \c_one } + { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: \l__regex_every_match_tl @@ -1900,7 +1984,7 @@ } \cs_new_protected:Npn \__regex_match_loop: { - \tex_advance:D \l__regex_step_int \c_two + \tex_advance:D \l__regex_step_int 2 \exp_stop_f: \int_incr:N \l__regex_current_pos_int \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int @@ -1926,7 +2010,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \__regex_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: } \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 @@ -1958,7 +2042,7 @@ = \l__regex_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l__regex_current_state_int \tex_dimen:D \l__regex_current_state_int - = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l__regex_step_int + 1 \__int_eval_end: sp \scan_stop: } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { @@ -2063,7 +2147,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } \cs_new:Npn \__regex_query_submatch:n #1 { @@ -2093,7 +2177,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x @@ -2123,7 +2207,7 @@ { \cs_if_exist_use:cF { __regex_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \__regex_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -2134,7 +2218,7 @@ { \if_int_compare:w #1 < \l__regex_capturing_group_int \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l__regex_balance_tl { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -2153,9 +2237,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__regex_internal_a_int - { \c_ten * \l__regex_internal_a_int + #2 } + { 10 * \l__regex_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \__regex_replacement_g_digits:NN \else: @@ -2209,7 +2293,7 @@ } \cs_new_protected:Npn \__regex_replacement_rbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l__regex_replacement_csnames_int \else: @@ -2222,7 +2306,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: } @@ -2232,7 +2316,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_B:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2246,7 +2330,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_E:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2272,10 +2356,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: } @@ -2311,11 +2395,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \__regex_compile:n {#1} - \__regex_show:Nx \l__regex_internal_regex + \__regex_show:Nn \l__regex_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } } + { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } \prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } { \__regex_if_match:nn { \__regex_build:n {#1} } {#2} @@ -2432,14 +2516,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } - \c_one - { \l__regex_submatch_int - \c_one } + { 2 * \l__regex_max_state_int } + { 1 } + { \l__regex_submatch_int - 1 } \__regex_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -2462,12 +2546,12 @@ } \cs_new:Npn \__regex_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 { __regex_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { __regex_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -2478,12 +2562,12 @@ \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int \prg_replicate:nn \l__regex_capturing_group_int { - \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l__regex_submatch_int 0 sp \scan_stop: \int_incr:N \l__regex_submatch_int } \prop_map_inline:Nn \l__regex_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \__regex_extract_e:wn \__int_value:w \else: \exp_after:wN \__regex_extract_b:wn \__int_value:w @@ -2542,17 +2626,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_balance_one_match:n } \tl_set:Nx \l__regex_internal_a_tl { \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_do_one_match:n \__regex_query_range:nn \l__regex_start_pos_int \l__regex_max_pos_int @@ -2561,24 +2645,24 @@ } \cs_new_protected:Npn \__regex_group_end_replace:N #1 { - \if_int_compare:w \l__regex_balance_int = \c_zero + \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l__regex_balance_int } { \c_zero } } - { \int_max:nn { \l__regex_balance_int } { \c_zero } } + { \int_max:nn { - \l__regex_balance_int } { 0 } } + { \int_max:nn { \l__regex_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l__regex_balance_int < \c_zero + \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l__regex_balance_int } { { \if_false: } \fi: } \fi: \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > \c_zero + \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l__regex_balance_int } { \if_false: { \fi: } } \fi: @@ -2832,7 +2916,7 @@ { \int_step_inline:nnnn \l__regex_min_state_int - \c_one + { 1 } { \l__regex_max_state_int - 1 } { \trace:nnx { regex } { #1 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty index fd864d2f41b..26066be4102 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty @@ -18,9 +18,9 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -32,11 +32,11 @@ }% \endinput } -\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} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} \cs_generate_variant:Nn \tl_to_str:n { V } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -107,17 +107,15 @@ \cs_new_protected:Npn \__regex_compute_case_changed_char: { \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int < \c_ninety_one - \if_int_compare:w \l__regex_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -130,7 +128,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 \__regex_item_catcode:nT #1 @@ -151,23 +149,25 @@ \fi: \fi: } -\cs_new_protected:Npn \__regex_item_exact_cs:c #1 +\cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero + \int_compare:nNnTF \l__regex_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l__regex_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__regex_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } { } } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = \c_zero + \int_compare:nNnT \l__regex_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l__regex_cs_name_tl @@ -189,70 +189,79 @@ } } \cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \__regex_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \__regex_prop_h: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \__regex_prop_s: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab - \__regex_item_caseful_equal:n \c_ten % lf - \__regex_item_caseful_equal:n \c_twelve % ff - \__regex_item_caseful_equal:n \c_thirteen % cr + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + \__regex_item_caseful_equal:n { `\^^J } + \__regex_item_caseful_equal:n { `\^^L } + \__regex_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \__regex_prop_w: { - \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \__regex_item_caseful_equal:n { 95 } % _ + \__regex_item_caseful_range:nn { `a } { `z } + \__regex_item_caseful_range:nn { `A } { `Z } + \__regex_item_caseful_range:nn { `0 } { `9 } + \__regex_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \__regex_prop_N: - { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } } + { + \__regex_item_reverse:n + { \__regex_item_caseful_equal:n { `\^^J } } + } \cs_new_protected:Npn \__regex_posix_alnum: { \__regex_posix_alpha: \__regex_posix_digit: } \cs_new_protected:Npn \__regex_posix_alpha: { \__regex_posix_lower: \__regex_posix_upper: } \cs_new_protected:Npn \__regex_posix_ascii: - { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: \cs_new_protected:Npn \__regex_posix_cntrl: { - \__regex_item_caseful_range:nn \c_zero { 31 } - \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \__regex_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: \cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { 33 } { 126 } } + { \__regex_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } } + { \__regex_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn \c_thirty_two { 126 } } + { \__regex_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \__regex_posix_punct: { - \__regex_item_caseful_range:nn { 33 } { 47 } - \__regex_item_caseful_range:nn { 58 } { 64 } - \__regex_item_caseful_range:nn { 91 } { 96 } - \__regex_item_caseful_range:nn { 123 } { 126 } + \__regex_item_caseful_range:nn { `! } { `/ } + \__regex_item_caseful_range:nn { `: } { `@ } + \__regex_item_caseful_range:nn { `[ } { `` } + \__regex_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \__regex_posix_space: { - \__regex_item_caseful_equal:n \c_thirty_two - \__regex_item_caseful_range:nn \c_nine \c_thirteen + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn \c_sixty_five { 90 } } + { \__regex_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: \cs_new_protected:Npn \__regex_posix_xdigit: { \__regex_posix_digit: - \__regex_item_caseful_range:nn \c_sixty_five { 70 } - \__regex_item_caseful_range:nn \c_ninety_seven { 102 } + \__regex_item_caseful_range:nn { `A } { `F } + \__regex_item_caseful_range:nn { `a } { `f } } \cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 { @@ -260,7 +269,7 @@ \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g__regex_internal_tl { #4 } \tl_set:Nx \l__regex_internal_b_tl { @@ -314,12 +323,12 @@ } \cs_new:Npn \__regex_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \__regex_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \__regex_escape_raw:N { \__str_output_byte:n {#1} } } - { \__regex_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -334,7 +343,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl @@ -405,47 +414,53 @@ } \prg_new_conditional:Npnn \__regex_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 \__regex_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: } \int_new:N \l__regex_group_level_int \int_new:N \l__regex_mode_int +\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } +\int_const:Nn \c__regex_cs_mode_int { -2 } +\int_const:Nn \c__regex_outer_mode_int { 0 } +\int_const:Nn \c__regex_catcode_mode_int { 2 } +\int_const:Nn \c__regex_class_mode_int { 3 } +\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } \int_new:N \l__regex_catcodes_int \int_new:N \l__regex_default_catcodes_int \bool_new:N \l__regex_catcodes_bool @@ -480,7 +495,7 @@ \prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \__regex_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: @@ -502,7 +517,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l__regex_mode_int < \c_zero + \if_int_compare:w \l__regex_mode_int < \c__regex_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 @@ -514,7 +529,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_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 @@ -523,7 +538,7 @@ } \cs_new:Npn \__regex_if_within_catcode:TF { - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -531,10 +546,10 @@ } \cs_new_protected:Npn \__regex_chk_c_allowed:T { - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -544,11 +559,11 @@ } \cs_new_protected:Npn \__regex_mode_quit_c: { - \if_int_compare:w \l__regex_mode_int = \c_two - \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \else: - \if_int_compare:w \l__regex_mode_int = \c_six - \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int \fi: \fi: } @@ -571,7 +586,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn @@ -592,8 +607,8 @@ \cs_new_protected:Npn \__regex_compile:n #1 { \__regex_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l__regex_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \__regex_escape_use:nnnn { \__regex_char_if_special:NTF ##1 @@ -607,14 +622,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c_two + \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c_zero + \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end: - \__regex_compile_one:x - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -837,7 +850,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - \c_two + \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -904,11 +917,11 @@ { \__regex_if_in_class:TF { - \if_int_compare:w \l__regex_mode_int > \c_sixteen + \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l__regex_mode_int - \c_fifteen - \tex_divide:D \l__regex_mode_int \c_thirteen + \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: + \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: \if_int_odd:w \l__regex_mode_int \else: \exp_after:wN \__regex_compile_quantifier:w \fi: @@ -936,7 +949,7 @@ } \cs_new_protected:Npn \__regex_compile_class_catcode:w #1; { - \if_int_compare:w \l__regex_mode_int = \c_two + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int \__tl_build_one:n { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -1038,7 +1051,7 @@ } \cs_new_protected:Npn \__regex_compile_group_end: { - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int @@ -1130,7 +1143,11 @@ { \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } @@ -1142,7 +1159,11 @@ \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: \int_zero:N \l__regex_catcodes_int \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } { @@ -1195,17 +1216,72 @@ \__regex_compile:w \__regex_disable_submatches: \l__regex_mode_int - = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_cs_mode_int + \else: + \c__regex_cs_in_class_mode_int + \fi: } +\flag_new:n { __regex_cs } \cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } { \__regex_if_in_cs:TF + { \__regex_compile_end_cs: } + { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \__regex_compile_end_cs: + { + \__regex_compile_end: + \flag_clear:n { __regex_cs } + \tl_set:Nx \l__regex_internal_a_tl { - \__regex_compile_end: - \__regex_compile_one:x + \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \__regex_compile_one:x + { + \flag_if_raised:nTF { __regex_cs } { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } + } + } +\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \__regex_branch:n + { + \scan_stop: + \__regex_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \__regex_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \__regex_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} } + \__regex_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { __regex_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } } \cs_new_protected:cpn { __regex_compile_/u: } #1#2 { @@ -1245,7 +1321,7 @@ \cs_new_protected:Npn \__regex_compile_u_end: { \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \__regex_compile_u_not_cs: \else: \__regex_compile_u_in_cs: @@ -1275,8 +1351,8 @@ { \__regex_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -1287,11 +1363,11 @@ } \cs_new_protected:cpn { __regex_compile_/K: } { - \int_compare:nNnTF \l__regex_mode_int = \c_zero + \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int { \__tl_build_one:n { \__regex_command_K: } } { \__regex_compile_raw_error:N K } } -\cs_new_protected:Npn \__regex_show:Nx #1#2 +\cs_new_protected:Npn \__regex_show:Nn #1#2 { \__tl_build:Nw \l__regex_internal_a_tl \cs_set_protected:Npn \__regex_branch:n @@ -1333,16 +1409,16 @@ { \__regex_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \__regex_item_exact_cs:c ##1 - { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n \cs_set_protected:Npn \__regex_item_cs:n { \__regex_show_scope:nn { control~sequence } } \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } \seq_clear:N \l__regex_show_prefix_seq \__regex_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l__regex_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l__regex_internal_a_tl } } \cs_new_protected:Npn \__regex_show_one:n #1 { @@ -1437,6 +1513,14 @@ \bool_if:NF #1 { negative~ } class } } +\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l__regex_internal_seq + \l__regex_internal_seq { \iow_char:N\\##1 } + \__regex_show_one:n + { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } + } \int_new:N \l__regex_min_state_int \int_new:N \l__regex_max_state_int \int_new:N \l__regex_left_state_int @@ -1451,7 +1535,7 @@ } \cs_new_protected:Npn \__regex_build:N #1 { - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l__regex_capturing_group_int \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int \__regex_build_new_state: @@ -1557,7 +1641,7 @@ } \cs_new_protected:Npn \__regex_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__regex_build_transitions_lazyness:NNNNN #2 \__regex_action_free:n \l__regex_right_state_int \__regex_tests_action_cost:n \l__regex_left_state_int @@ -1573,7 +1657,7 @@ { \__regex_class_repeat:n {#1} \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - \c_one } + { \l__regex_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \__regex_build_transitions_lazyness:NNNNN #3 @@ -1583,7 +1667,7 @@ } \cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 { - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \__regex_build_new_state: \__regex_build_transition_right:nNn \__regex_action_free_group:n \l__regex_left_state_int \l__regex_right_state_int @@ -1644,9 +1728,9 @@ } \cs_new_protected:Npn \__regex_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__regex_max_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_new_state: \else: \__regex_group_repeat_aux:n {#2} @@ -1657,7 +1741,7 @@ } \cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } \fi: @@ -1668,10 +1752,10 @@ \l__regex_right_state_int \l__regex_max_state_int \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int \int_set_eq:NN \l__regex_internal_b_int \l__regex_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__regex_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) } \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int @@ -1680,18 +1764,18 @@ { \tex_toks:D \l__regex_internal_b_int = \tex_toks:D \l__regex_internal_a_int - \tex_advance:D \l__regex_internal_a_int \c_one - \tex_advance:D \l__regex_internal_b_int \c_one + \int_incr:N \l__regex_internal_a_int + \int_incr:N \l__regex_internal_b_int } \fi: } \cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \__regex_group_submatches:nNN {#1} \l__regex_left_state_int \l__regex_right_state_int \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_internal_a_int \__regex_build_new_state: @@ -1731,16 +1815,16 @@ \l__regex_left_state_int \l__regex_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \else: \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } @@ -1820,7 +1904,7 @@ \cs_new_protected:Npn \__regex_match:n #1 { \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { \c_two * \l__regex_max_state_int } + \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } \__regex_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -1829,13 +1913,13 @@ \__regex_query_set:nnn { } { -1 } { -2 } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn - \l__regex_min_state_int \c_one { \l__regex_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_step_int \c_zero + \int_zero:N \l__regex_step_int \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int \int_set:Nn \l__regex_submatch_int - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \bool_set_false:N \l__regex_empty_success_bool \__regex_match_once: } @@ -1853,7 +1937,7 @@ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int \__regex_store_state:n { \l__regex_min_state_int } \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - \c_one } + { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: \l__regex_every_match_tl @@ -1876,7 +1960,7 @@ } \cs_new_protected:Npn \__regex_match_loop: { - \tex_advance:D \l__regex_step_int \c_two + \tex_advance:D \l__regex_step_int 2 \exp_stop_f: \int_incr:N \l__regex_current_pos_int \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int @@ -1902,7 +1986,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \__regex_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: } \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 @@ -1933,7 +2017,7 @@ = \l__regex_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l__regex_current_state_int \tex_dimen:D \l__regex_current_state_int - = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l__regex_step_int + 1 \__int_eval_end: sp \scan_stop: } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { @@ -2038,7 +2122,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } \cs_new:Npn \__regex_query_submatch:n #1 { @@ -2067,7 +2151,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x @@ -2096,7 +2180,7 @@ { \cs_if_exist_use:cF { __regex_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \__regex_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -2107,7 +2191,7 @@ { \if_int_compare:w #1 < \l__regex_capturing_group_int \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l__regex_balance_tl { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -2126,9 +2210,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__regex_internal_a_int - { \c_ten * \l__regex_internal_a_int + #2 } + { 10 * \l__regex_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \__regex_replacement_g_digits:NN \else: @@ -2182,7 +2266,7 @@ } \cs_new_protected:Npn \__regex_replacement_rbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l__regex_replacement_csnames_int \else: @@ -2195,7 +2279,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: } @@ -2205,7 +2289,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_B:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2219,7 +2303,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_E:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2245,10 +2329,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: } @@ -2284,11 +2368,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \__regex_compile:n {#1} - \__regex_show:Nx \l__regex_internal_regex + \__regex_show:Nn \l__regex_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } } + { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } \prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } { \__regex_if_match:nn { \__regex_build:n {#1} } {#2} @@ -2405,14 +2489,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } - \c_one - { \l__regex_submatch_int - \c_one } + { 2 * \l__regex_max_state_int } + { 1 } + { \l__regex_submatch_int - 1 } \__regex_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -2435,12 +2519,12 @@ } \cs_new:Npn \__regex_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 { __regex_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { __regex_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -2451,12 +2535,12 @@ \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int \prg_replicate:nn \l__regex_capturing_group_int { - \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l__regex_submatch_int 0 sp \scan_stop: \int_incr:N \l__regex_submatch_int } \prop_map_inline:Nn \l__regex_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \__regex_extract_e:wn \__int_value:w \else: \exp_after:wN \__regex_extract_b:wn \__int_value:w @@ -2515,17 +2599,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_balance_one_match:n } \tl_set:Nx \l__regex_internal_a_tl { \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_do_one_match:n \__regex_query_range:nn \l__regex_start_pos_int \l__regex_max_pos_int @@ -2534,24 +2618,24 @@ } \cs_new_protected:Npn \__regex_group_end_replace:N #1 { - \if_int_compare:w \l__regex_balance_int = \c_zero + \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l__regex_balance_int } { \c_zero } } - { \int_max:nn { \l__regex_balance_int } { \c_zero } } + { \int_max:nn { - \l__regex_balance_int } { 0 } } + { \int_max:nn { \l__regex_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l__regex_balance_int < \c_zero + \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l__regex_balance_int } { { \if_false: } \fi: } \fi: \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > \c_zero + \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l__regex_balance_int } { \if_false: { \fi: } } \fi: diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty index ba989f071c7..77f2c83eaa9 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty @@ -18,13 +18,13 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-convert.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-convert.dtx 6969 2017-02-20 18:32:23Z bruno $ {L3 Experimental string encoding conversions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-analysis,l3tl-build,l3flag} +\RequirePackage{l3tl-analysis,l3tl-build} \cs_if_exist:NF \use_ii_i:nn { \cs_new:Npn \use_ii_i:nn #1#2 { #2 #1 } } \cs_new_protected:Npn \__str_tmp:w { } @@ -32,13 +32,11 @@ \int_new:N \l__str_internal_int \tl_new:N \g__str_result_tl \int_const:Nn \c__str_replacement_char_int { "FFFD } -\int_const:Nn \c_forty_eight { 48 } -\int_const:Nn \c_fifty_eight { 58 } -\int_const:Nn \c_sixty_five { 65 } -\int_const:Nn \c_ninety_one { 91 } -\int_const:Nn \c_ninety_seven { 97 } -\int_const:Nn \c_one_hundred_twenty_three { 123 } -\int_const:Nn \c_one_hundred_twenty_seven { 127 } +\int_const:Nn \c__str_max_byte_int { 255 } +\int_const:Nn \c__str_ascii_min_int { 0 } +\int_const:Nn \c__str_ascii_max_control_int { 31 } +\int_const:Nn \c__str_ascii_max_int { 127 } +\int_const:Nn \c__str_ascii_lower_int { `a - `A } \prop_new:N \g__str_alias_prop \prop_gput:Nnn \g__str_alias_prop { latin1 } { iso88591 } \prop_gput:Nnn \g__str_alias_prop { latin2 } { iso88592 } @@ -108,7 +106,7 @@ { \__prg_break:n { \prg_return_true: \use_none:n } } \prg_new_conditional:Npnn \__str_octal_use:N #1 { TF } { - \if_int_compare:w \c_one < '1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 1 < '1 \token_to_str:N #1 \exp_stop_f: #1 \prg_return_true: \else: \prg_return_false: @@ -116,7 +114,7 @@ } \prg_new_conditional:Npnn \__str_hexadecimal_use:N #1 { TF } { - \if_int_compare:w \c_two < "1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f: #1 \prg_return_true: \else: \if_case:w \__int_eval:w @@ -327,20 +325,19 @@ \cs_new:Npn \__str_convert_lowercase_alphanum_loop:N #1 { \use_none:n #1 - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_sixty_five - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: \else: + \if_int_compare:w `#1 < `a \exp_stop_f: \else: #1 \fi: - \else: - \__str_output_byte:n { `#1 + \c_thirty_two } \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven - \else: + \if_int_compare:w `#1 < `A \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: #1 \fi: + \else: + \__str_output_byte:n { `#1 + \c__str_ascii_lower_int } \fi: \fi: \__str_convert_lowercase_alphanum_loop:N @@ -363,9 +360,9 @@ \char_set_catcode_comment:N \% \int_set:Nn \tex_endlinechar:D {32} } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -387,9 +384,9 @@ } } { \cs_new_eq:NN \__str_filter_bytes:n \use:n } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -411,9 +408,9 @@ { #1 \s__tl \__int_value:w `#1 \s__tl } \group_begin: \char_set_catcode_other:n { 0 } - \bool_if:nTF + \bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -443,11 +440,11 @@ } \cs_new:Npn \__str_encode_native_char:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } ? + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow } @@ -509,7 +506,7 @@ \tex_dimen:D "#1 = \l__str_internal_int sp \scan_stop: \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \__int_value:w "#2 } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load:nn } \cs_new_protected:Npn \__str_decode_eight_bit_load_missing:n #1 @@ -519,7 +516,7 @@ \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \int_use:N \c__str_replacement_char_int } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load_missing:n } \cs_new:Npn \__str_decode_eight_bit_char:N #1 @@ -552,7 +549,7 @@ \tex_skip:D \l__str_internal_int = "#2 sp \scan_stop: \exp_args:NNf \tex_toks:D \l__str_internal_int { \__str_output_byte:n { "#1 } } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_encode_eight_bit_load:nn } \cs_new:Npn \__str_encode_eight_bit_char:n #1 @@ -571,10 +568,10 @@ } \cs_new:Npn \__str_encode_eight_bit_char_aux:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnn { str } { unknown-esc } @@ -590,9 +587,9 @@ } \__msg_kernel_new:nnn { str } { file-not-found } { File~'l3str-#1.def'~not~found. } -\bool_if:nT +\bool_lazy_any:nT { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def index 526bd896aa7..4ec7d5c8d75 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88591 } { } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def index 082fec6653a..6aed0dcb9ef 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885910 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def index e51840885bf..f551a2ac4ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885911 } { { A1 } { 0E01 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def index 83718b2a1b0..1c44066f1af 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885913 } { { A1 } { 201D } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def index 90ddd22915c..75814fbb8ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885914 } { { A1 } { 1E02 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def index c7980a0cf71..fb0bba2e5ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885915 } { { A4 } { 20AC } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def index 1fc3dfa0ad0..89d59900f77 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885916 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def index 655d5dfbb12..584fb3de28b 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88592 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def index ffcca4890a7..3ec8d60de3f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88593 } { { A1 } { 0126 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def index 5a92daf3827..c2c3aaf7ed3 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88594 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def index f43c25b1da1..9a22152f36e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88595 } { { A1 } { 0401 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def index bae2edd75f3..37d058df1ac 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88596 } { { AC } { 060C } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def index 798746d98d7..101b2225c5c 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88597 } { { A1 } { 2018 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def index 7478b313e58..8183ea85048 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88598 } { { AA } { 00D7 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def index 6cccd45605a..0f6bf25306e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88599 } { { D0 } { 011E } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def index 0ce28efe7c7..431b242f550 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_catcode_other:N \^^fe \char_set_catcode_other:N \^^ff @@ -144,7 +144,7 @@ \__str_decode_utf_xvi_pair_end:Nw #1 \fi: \if_case:w - \__int_eval:w ( \__str_tmp:w #1#2 - "D6 ) / \c_four \__int_eval_end: + \__int_eval:w ( \__str_tmp:w #1#2 - "D6 ) / 4 \__int_eval_end: \or: \exp_after:wN \__str_decode_utf_xvi_quad:NNwNN \or: \exp_after:wN \__str_decode_utf_xvi_extra:NNw \fi: @@ -161,10 +161,11 @@ \fi: \if_int_compare:w \if_int_compare:w \__str_tmp:w #4#5 < "DC \exp_stop_f: - \c_zero = \c_one + 0 = 1 \else: - \__str_tmp:w #4#5 < "E0 \exp_stop_f: + \__str_tmp:w #4#5 < "E0 \fi: + \exp_stop_f: #1 #2 #4 #5 \s__tl \int_eval:n { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def index f0fb7f2514d..6f466ba400d 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_catcode_other:N \^^00 \char_set_catcode_other:N \^^fe @@ -119,12 +119,12 @@ \exp_after:wN \__str_decode_utf_xxxii_end:w \fi: #1#2#3#4 \s__tl - \if_int_compare:w \__str_tmp:w #1#4 > \c_zero + \if_int_compare:w \__str_tmp:w #1#4 > 0 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c__str_replacement_char_int \else: - \if_int_compare:w \__str_tmp:w #2#3 > \c_sixteen + \if_int_compare:w \__str_tmp:w #2#3 > 16 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c__str_replacement_char_int diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def index ae851882149..4518878b883 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def @@ -18,13 +18,13 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_new_protected:cpn { __str_convert_encode_utf8: } { \__str_convert_gmap_internal:N \__str_encode_utf_viii_char:n } \cs_new:Npn \__str_encode_utf_viii_char:n #1 { - \__str_encode_utf_viii_loop:wwnnw #1 ; - \c_one + \c_zero * ; - { 128 } { \c_zero } + \__str_encode_utf_viii_loop:wwnnw #1 ; - 1 + 0 * ; + { 128 } { 0 } { 32 } { 192 } { 16 } { 224 } { 8 } { 240 } @@ -39,7 +39,7 @@ \exp_after:wN \__str_encode_utf_viii_loop:wwnnw \__int_value:w \int_div_truncate:nn {#1} {64} ; #1 ; #5 \q_stop - \__str_output_byte:n { #2 - 64 * ( #1 - \c_two ) } + \__str_output_byte:n { #2 - 64 * ( #1 - 2 ) } } \flag_clear_new:n { str_missing } \flag_clear_new:n { str_extra } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def index 7e2ab8b8db9..3a5e52a5fdc 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_new_protected:Npn \__str_convert_unescape_hex: { \group_begin: @@ -29,7 +29,7 @@ \__str_output_byte:w " \exp_last_unbraced:Nf \__str_unescape_hex_auxi:N { \tl_to_str:N \g__str_result_tl } - 0 { ? 0 - \c_one \__prg_break: } + 0 { ? 0 - 1 \__prg_break: } \__prg_break_point: \__str_output_end: } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def index 23c77ecc650..b01837f7369 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_set_protected:Npn \__str_tmp:w #1#2#3 { \cs_new_protected:cpn { __str_convert_unescape_#2: } @@ -48,7 +48,7 @@ { } { \flag_raise:n { str_error } - * \c_zero + `#1 \use_i:nn + * 0 + `#1 \use_i:nn } } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def index d40866bfb99..83982d00b9f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_lccode:nn {`\*} {`\\} \char_set_catcode_other:N \^^J @@ -59,7 +59,7 @@ { \__str_octal_use:NTF #4 { - \if_int_compare:w #2 > \c_three + \if_int_compare:w #2 > 3 \exp_stop_f: - 256 \fi: \__str_unescape_string_repeat:NNNNNN @@ -79,11 +79,11 @@ { n } { 12 } { t } { 11 } { b } { 10 } - { ^^J } { 0 - \c_one } + { ^^J } { 0 - 1 } } { \flag_raise:n { str_error } - 0 - \c_one \use_i:nn + 0 - 1 \use_i:nn } } \__str_output_end: @@ -122,8 +122,8 @@ { \c_backslash_str \int_div_truncate:nn {`#1} {64} - \int_mod:nn { \int_div_truncate:nn {`#1} \c_eight } \c_eight - \int_mod:nn {`#1} \c_eight + \int_mod:nn { \int_div_truncate:nn {`#1} { 8 } } { 8 } + \int_mod:nn {`#1} { 8 } } } \prg_new_conditional:Npnn \__str_if_escape_string:N #1 { TF } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def index 347d8cfeaf3..8176cf9106e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_set_protected:Npn \__str_tmp:w #1#2#3 { \cs_new_protected:cpn { __str_convert_unescape_#2: } @@ -48,7 +48,7 @@ { } { \flag_raise:n { str_error } - * \c_zero + `#1 \use_i:nn + * 0 + `#1 \use_i:nn } } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index 850ff9f61a0..53429eff945 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx Copyright (C) 2012-2013,2015,2016 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-format.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-format.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental string formatting} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -30,7 +30,7 @@ \cs_generate_variant:Nn \tl_to_str:n { f } \prg_new_conditional:Npnn \__str_format_if_digit:N #1 { TF } { - \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \if_int_compare:w 9 < 1 #1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } @@ -129,9 +129,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero - { #3 - \__str_count:n { #2 #1 } - \c_one } - / \c_two + \int_max:nn { 0 } + { #3 - \__str_count:n { #2 #1 } - 1 } + / 2 } {#4} } @@ -139,9 +139,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero + \int_max:nn { 0 } { #3 - \__str_count:n { #2 #1 } } - / \c_two + / 2 } {#4} } @@ -249,7 +249,7 @@ \token_if_eq_charcode:NNTF #2 ? { \__str_format_put:nw { #1 > } } { \__str_format_put:nw { #1 #2 } } - \int_compare:nNnTF {#7} < \c_zero + \int_compare:nNnTF {#7} < 0 { \__str_format_put:nw { - } } { \str_case:nnF {#3} @@ -364,9 +364,9 @@ { \__str_format_put:fw { \int_eval:n { #3 - 1 } } \__str_format_put:nw { e } - \int_compare:nNnTF {#8} > \c_sixteen + \int_compare:nNnTF {#8} > \c__fp_prec_int { - \__str_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \__str_format_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } \__str_format_put:fw { \use_none:n #4#5#6#7 } } { @@ -417,14 +417,20 @@ \cs_new:Npn \__str_format_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } +\cs_new:Npn \__str_format_to_scientific:n + { + \exp_after:wN \__str_format_fp_trim:w + \exp:w \exp_end_continue_f:w \fp_to_scientific:n + } +\cs_new:Npn \__str_format_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } \__msg_kernel_new:nnn { str } { invalid-format } { Invalid~format~'#1'. } \__msg_kernel_new:nnn { str } { invalid-align-format } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty index 04d811b352f..ca781f2c6e1 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty @@ -20,7 +20,7 @@ %% %% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015,2016 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3tl-analysis.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3tl-analysis.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental token lists analysis} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -42,7 +42,7 @@ \cs_new:Npn \__tl_analysis_cs_space_count:NN #1 #2 { \exp_after:wN #1 - \__int_value:w \__int_eval:w \c_zero + \__int_value:w \__int_eval:w 0 \exp_after:wN \__tl_analysis_cs_space_count:w \token_to_str:N #2 \fi: \__tl_analysis_cs_space_count_end:w ; ~ ! @@ -50,7 +50,7 @@ \cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~ { \if_false: #1 #1 \fi: - + \c_one + + 1 \__tl_analysis_cs_space_count:w } \cs_new:Npn \__tl_analysis_cs_space_count_end:w ; #1 \fi: #2 ! @@ -67,7 +67,7 @@ } \cs_new_protected:Npn \__tl_analysis_setup:n #1 { - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \exp_after:wN \__tl_analysis_disable_loop:N \tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: } \__prg_break_point: @@ -76,7 +76,7 @@ \char_set_catcode_active:N \^^@ \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1 { - \tex_lccode:D \c_zero `#1 ~ + \tex_lccode:D 0 = `#1 ~ \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \__tl_analysis_disable_loop:N } @@ -96,18 +96,19 @@ { \l__tl_analysis_type_int = \if_meaning:w \l__tl_analysis_token \c_space_token - \c_zero + 0 \else: \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token - \c_one + 1 \else: \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token - - \c_one + - 1 \else: - \c_two + 2 \fi: \fi: \fi: + \exp_stop_f: \if_case:w \l__tl_analysis_type_int \exp_after:wN \__tl_analysis_a_space:w \or: \exp_after:wN \__tl_analysis_a_bgroup:w @@ -144,9 +145,9 @@ \group_end: \cs_new_protected:Npn \__tl_analysis_a_group:nw #1 { - \tex_lccode:D \c_zero = \__tl_analysis_extract_charcode: \scan_stop: + \tex_lccode:D 0 = \__tl_analysis_extract_charcode: \scan_stop: \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} } - \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D + \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } \fi: \tex_afterassignment:D \__tl_analysis_a_group_test:w @@ -166,14 +167,14 @@ \cs_new_protected:Npn \__tl_analysis_a_store: { \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int - \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two - \tex_multiply:D \l__tl_analysis_type_int \c_two + \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: + \tex_multiply:D \l__tl_analysis_type_int 2 \exp_stop_f: \fi: \tex_skip:D \l__tl_analysis_index_int = \l__tl_analysis_normal_int sp plus \l__tl_analysis_type_int sp \scan_stop: \int_incr:N \l__tl_analysis_index_int \int_zero:N \l__tl_analysis_normal_int - \if_int_compare:w \l__tl_analysis_nesting_int = - \c_one + \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f: \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop: \fi: } @@ -191,9 +192,9 @@ } \cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2; { - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \tex_skip:D \l__tl_analysis_index_int - = \__int_eval:w \l__tl_analysis_normal_int + \c_one sp \scan_stop: + = \__int_eval:w \l__tl_analysis_normal_int + 1 sp \scan_stop: \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f: \l__tl_analysis_normal_int #2 \exp_stop_f: \else: @@ -215,7 +216,7 @@ } \cs_new:Npn \__tl_analysis_b_normals:ww #1; { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__tl_analysis_b_special:w \fi: \__tl_analysis_b_normal:wwN #1; @@ -251,7 +252,7 @@ \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } \exp_not:N \__int_value:w `#1 \s__tl \exp_not:N \exp_after:wN \exp_not:N \__tl_analysis_b_normals:ww - \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - \c_one + + \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - 1 + } \cs_new:Npn \__tl_analysis_b_cs:Nww #1 { @@ -262,7 +263,7 @@ { \exp_after:wN \__tl_analysis_b_normals:ww \__int_value:w \__int_eval:w - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: #3 \else: \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end: @@ -292,7 +293,7 @@ \else: \exp_after:wN \__tl_analysis_b_special_space:w \__int_value:w \fi: - \__int_eval:w \c_one + #1 \exp_after:wN ; + \__int_eval:w 1 + #1 \exp_after:wN ; \token_to_str:N } \group_end: @@ -360,10 +361,10 @@ { \use_none:n #2 \exp_not:n { \\ > \ \ } - \if_int_compare:w "#2 = \c_zero + \if_int_compare:w "#2 = 0 \exp_stop_f: \exp_after:wN \__tl_analysis_show_cs:n \else: - \if_int_compare:w "#2 = \c_thirteen + \if_int_compare:w "#2 = 13 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__tl_analysis_show_active:n \else: @@ -391,7 +392,7 @@ \token_if_toks_register:NTF #1 \__prg_break: { } \use_none:nnn \__prg_break_point: - \use:n { = \tex_the:D #1 } + \use:n { \exp_after:wN = \tex_the:D #1 } } } \cs_new:Npn \__tl_analysis_show_cs:n #1 @@ -409,11 +410,11 @@ { \int_compare:nNnTF { \str_count:n { #1 ~ ( #4 #2 #3 ) } } - > { \l_iow_line_count_int - \c_three } + > { \l_iow_line_count_int - 3 } { - \str_range:nnn { #1 ~ ( #4 #2 #3 ) } \c_one + \str_range:nnn { #1 ~ ( #4 #2 #3 ) } { 1 } { - \l_iow_line_count_int - \c_three + \l_iow_line_count_int - 3 - \str_count:N \c__tl_analysis_show_etc_str } \c__tl_analysis_show_etc_str diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty index f70277c6b00..aae4b87553e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3tl-build.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3tl-build}{Support package l3kernel too old} @@ -32,7 +32,7 @@ }% \endinput } -\GetIdInfo$Id: l3tl-build.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3tl-build.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental token list construction} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -55,7 +55,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__tl_build_unpack_loop:w - \int_use:N \__int_eval:w #1 + \c_one ; + \int_use:N \__int_eval:w #1 + 1 ; } \cs_new_protected:Npn \__tl_build:Nw { \__tl_build_aux:NNw \tl_set:Nn } @@ -84,7 +84,7 @@ \cs_new_protected:Npn \__tl_build_one:n #1 { \tex_toks:D \l__tl_build_index_int {#1} - \tex_advance:D \l__tl_build_index_int \c_one + \int_incr:N \l__tl_build_index_int \if_int_compare:w \l__tl_build_index_int > \c_max_register_int \__tl_build_unpack: \l__tl_build_index_int \l__tl_build_start_index_int @@ -93,7 +93,7 @@ \cs_new_protected:Npn \__tl_build_one:o #1 { \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1} - \tex_advance:D \l__tl_build_index_int \c_one + \int_incr:N \l__tl_build_index_int \if_int_compare:w \l__tl_build_index_int > \c_max_register_int \__tl_build_unpack: \l__tl_build_index_int \l__tl_build_start_index_int diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 31619c5f811..926e1dfb2ac 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -19,9 +19,9 @@ %% and all files in that bundle must be distributed together. %% %% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach -%% (C) 2010-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% (C) 2010-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -33,7 +33,7 @@ }% \endinput } -\GetIdInfo$Id: l3galley.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3galley.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental galley code} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -85,6 +85,7 @@ \tl_new:N \l__galley_interpar_penalty_user_tl \tl_new:N \g__galley_interpar_vspace_user_tl \tl_new:N \l__galley_interpar_vspace_user_tl +\int_const:Nn \c__galley_max_penalty_int { 10000 } \int_new:N \l__galley_group_level_int \cs_new_protected:Npn \__galley_initialise_variables: { @@ -249,15 +250,13 @@ } \g_galley_par_reset_hook_tl \tl_gclear:N \g_galley_par_reset_hook_tl - \tex_penalty:D \c_ten_thousand + \tex_penalty:D \c__galley_max_penalty_int } \cs_new_protected:Npn \__galley_par_update_cutout: { - \bool_if:nF - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \prg_replicate:nn \tex_prevgraf:D { @@ -268,11 +267,9 @@ } \int_compare:nNnT \l__galley_group_level_int = \etex_currentgrouplevel:D { - \bool_if:nT - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnT + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \bool_gset_false:N \g__galley_cutout_active_bool } } } @@ -410,7 +407,7 @@ \tl_if_empty:NTF \g__galley_interpar_penalty_user_tl { \bool_if:NTF \g_galley_no_break_next_bool - { \tex_penalty:D \c_ten_thousand } + { \tex_penalty:D \c__galley_max_penalty_int } { \tex_penalty:D \l_galley_interpar_penalty_int } } { @@ -540,26 +537,22 @@ } \cs_new_protected:Npn \__galley_parshape_set_margins: { - \bool_if:nTF - { - \dim_compare_p:nNn \l_galley_total_left_margin_dim = \c_zero_dim - && \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim - } - { \tex_parshape:D \c_zero } + \bool_lazy_and:nnTF + { \dim_compare_p:nNn \l_galley_total_left_margin_dim = \c_zero_dim } + { \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim } + { \tex_parshape:D 0 \exp_stop_f: } { \tex_parshape:D - \c_one + 1 \exp_stop_f: \l_galley_total_left_margin_dim \l_galley_text_width_dim } } \cs_new_protected:Npn \__galley_parshape_set_indents: { - \bool_if:nF - { - \seq_if_empty_p:N \l__galley_parshape_left_indent_seq - && \seq_if_empty_p:N \l__galley_parshape_right_indent_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \l__galley_parshape_left_indent_seq } + { \seq_if_empty_p:N \l__galley_parshape_right_indent_seq } { \__galley_parshape_set_indents:NN \l__galley_parshape_left_indent_seq @@ -584,11 +577,9 @@ } \cs_new_protected:Npn \__galley_parshape_set_cutouts: { - \bool_if:nF - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \__galley_parshape_set_cutouts:n { left } \__galley_parshape_set_cutouts:n { right } @@ -597,7 +588,7 @@ \seq_count:N \l__galley_cutout_left_indent_seq - \seq_count:N \l__galley_cutout_right_indent_seq } - \int_compare:nNnTF \l__galley_tmp_int > \c_zero + \int_compare:nNnTF \l__galley_tmp_int > 0 { \__galley_parshape_set_cutouts:N \l__galley_cutout_right_indent_seq } { \__galley_parshape_set_cutouts:N \l__galley_cutout_left_indent_seq } \__galley_parshape_set_indents:NN @@ -623,9 +614,9 @@ { \seq_count:N \g__galley_tmpa_seq - \seq_count:N \g__galley_tmpb_seq - + \c_one + + 1 } - \int_compare:nNnT \l__galley_tmp_int > \c_zero + \int_compare:nNnT \l__galley_tmp_int > 0 { \prg_replicate:nn { \l__galley_tmp_int } @@ -696,10 +687,10 @@ { \bool_if:NTF #1 { % TODO Hook for font changes required! - \dim_compare:nNnTF { \tex_fontdimen:D \c_three \tex_font:D } + \dim_compare:nNnTF { \tex_fontdimen:D 3 \tex_font:D } = \c_zero_dim { \tex_spaceskip:D \c_zero_dim } - { \tex_spaceskip:D \tex_fontdimen:D \c_two \tex_font:D } + { \tex_spaceskip:D \tex_fontdimen:D 2 \tex_font:D } } { \tex_spaceskip:D \c_zero_dim } } @@ -723,12 +714,12 @@ { \tex_unskip:D \bool_if:NF #1 - { \tex_vadjust:D { \tex_penalty:D \c_ten_thousand } } + { \tex_vadjust:D { \tex_penalty:D \c__galley_max_penalty_int } } \dim_compare:nNnF {#2} = \c_zero_dim { \tex_vadjust:D { \skip_vertical:n {#2} } } - \tex_penalty:D \c_ten_thousand + \tex_penalty:D \c__galley_max_penalty_int \tex_hfil:D - \tex_penalty:D -\c_ten_thousand + \tex_penalty:D - \c__galley_max_penalty_int } } \cs_new_eq:NN \l_galley_broken_penalty_int \tex_brokenpenalty:D @@ -742,17 +733,17 @@ \cs_new_protected:Npn \galley_display_widow_penalties_set:n #1 { \etex_displaywidowpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: } \cs_generate_variant:Nn \galley_display_widow_penalties_set:n { V , v } \cs_new_protected:Npn \galley_widow_penalties_set:n #1 { \etex_widowpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: } \cs_generate_variant:Nn \galley_widow_penalties_set:n { V , v } \cs_new:Npn \__galley_set_aux:n #1 { \int_eval:n {#1} ~ } @@ -771,17 +762,17 @@ \cs_new_protected:Npn \galley_display_club_penalties_set:n #1 { \etex_clubpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: \__galley_calc_interline_penalties: } \cs_generate_variant:Nn \galley_display_club_penalties_set:n { V , v } \cs_new_protected:Npn \galley_interline_penalty_set:n #1 { - \int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero + \int_compare:nNnTF { \etex_interlinepenalties:D 0 } = 0 { - \etex_interlinepenalties:D \c_one \__int_eval:w #1 \__int_eval_end: + \etex_interlinepenalties:D 1 = \__int_eval:w #1 \__int_eval_end: \__galley_calc_interline_penalties: } { @@ -789,7 +780,7 @@ { \__int_eval:w \etex_interlinepenalties:D ##1 - - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + - \etex_interlinepenalties:D \etex_interlinepenalties:D 0 + #1 \__int_eval_end: } @@ -800,11 +791,11 @@ \cs_new_protected:Npn \__galley_set_interline_penalty:nn #1#2 { \etex_interlinepenalties:D - \etex_interlinepenalties:D \c_zero - \int_step_function:nnnN \c_one \c_one {#1} + \etex_interlinepenalties:D 0 \exp_stop_f: + \int_step_function:nnnN { 1 } { 1 } {#1} \__galley_set_interline_penalty_auxi:n - \int_step_function:nnnN { #1 + \c_one } \c_one - { \etex_interlinepenalties:D \c_zero - \c_one } + \int_step_function:nnnN { #1 + 1 } { 1 } + { \etex_interlinepenalties:D 0 - 1 } \__galley_set_interline_penalty_auxii:n \__int_eval:w #2 \__int_eval_end: } @@ -816,17 +807,11 @@ \exp_args:Nff \__galley_calc_interline_penalties:nn { \int_max:nn - { - \clist_count:N \l_galley_club_penalties_clist - + \c_one - } + { \clist_count:N \l_galley_club_penalties_clist + 1 } { \int_max:nn - { - \clist_count:N \l_galley_line_penalties_clist - + \c_one - } - { \etex_clubpenalties:D \c_zero } + { \clist_count:N \l_galley_line_penalties_clist + 1 } + { \etex_clubpenalties:D 0 } } } { \clist_count:N \l_galley_line_penalties_clist } @@ -834,11 +819,11 @@ \cs_new_protected:Npn \__galley_calc_interline_penalties:nn #1#2 { \etex_interlinepenalties:D #1 ~ - \int_step_function:nnnN \c_one \c_one {#2} + \int_step_function:nnnN { 1 } { 1 } {#2} \__galley_calc_interline_penalties_auxi:n - \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one } + \int_step_function:nnnN { #2 + 1 } { 1 } { #1 - 1 } \__galley_calc_interline_penalties_auxii:n - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } \cs_new:Npn \__galley_calc_interline_penalties_auxi:n #1 { @@ -851,7 +836,7 @@ \cs_new:Npn \__galley_calc_interline_penalties_auxii:n #1 { \__int_eval:w - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ \__int_eval_end: @@ -864,8 +849,8 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_clubpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_clubpenalties:D 0 - 1 } \__galley_save_display_club_penalties:n } } @@ -875,8 +860,8 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_displaywidowpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_displaywidowpenalties:D 0 - 1 } \__galley_save_display_widow_penalties:n } } @@ -889,22 +874,22 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_widowpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_widowpenalties:D 0 - 1 } \__galley_save_widow_penalties:n } } \cs_new:Npn \__galley_save_widow_penalties:n #1 { \__int_value:w \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_interline_penalty: - { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero } + { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } \__msg_kernel_new:nnn { galley } { no-line-to-end } { There's~no~line~here~to~end. } \cs_set:Npn \clearpage { \mode_if_vertical:T { - \int_compare:nNnT \@dbltopnum = { - \c_one } + \int_compare:nNnT \@dbltopnum = { -1 } { \dim_compare:nNnT \tex_pagetotal:D < \topskip { \tex_hbox:D { } } @@ -961,7 +946,7 @@ \leavevmode \setbox \@tempboxa = \hbox { {#1} } \galley_parshape_set_single:nnnN - \c_one + { 1 } { \box_wd:N \@tempboxa } \c_zero_dim \c_false_bool diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index 598f757ad4f..44c68a9d000 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -19,9 +19,9 @@ %% and all files in that bundle must be distributed together. %% %% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach -%% (C) 2010-2012,2014,2106 The LaTeX3 Project +%% (C) 2010-2012,2014,2016-2017 The LaTeX3 Project \RequirePackage{xparse} -\GetIdInfo$Id: xgalley.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: xgalley.dtx 6963 2017-02-20 02:29:02Z bruno $ {L3 Experimental galley} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -118,14 +118,14 @@ \bool_if:NTF \l__galley_parshape_on_left_bool { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l__galley_tmpa_clist \l__galley_tmpb_clist \c_true_bool } { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l__galley_tmpb_clist \l__galley_tmpa_clist \c_true_bool @@ -217,7 +217,7 @@ \tl_clear:N \l__galley_justification_other_tl \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool - { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } + { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } @@ -259,7 +259,7 @@ \AssignTemplateKeys \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool - { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } + { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } |