diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex | 1594 |
1 files changed, 933 insertions, 661 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index ed3ba7dd47d..6bf8dcf4de8 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -62,7 +62,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/29}% +\def\ExplFileDate{2017/07/15}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -187,7 +187,7 @@ local t = { } for _,i in pairs(tex.extraprimitives("luatex")) do if string.match(i,"^U") then - if not string.match(i,"^Uchar$") then + if not string.match(i,"^Uchar$") then %$ table.insert(t,i) end end @@ -826,6 +826,8 @@ \__kernel_primitive:NN \pdfdraftmode \pdftex_draftmode:D \__kernel_primitive:NN \pdfeachlinedepth \pdftex_eachlinedepth:D \__kernel_primitive:NN \pdfeachlineheight \pdftex_eachlineheight:D + \__kernel_primitive:NN \pdffilemoddate \pdftex_filemoddate:D + \__kernel_primitive:NN \pdffilesize \pdftex_filesize:D \__kernel_primitive:NN \pdffirstlineheight \pdftex_firstlineheight:D \__kernel_primitive:NN \pdffontexpand \pdftex_fontexpand:D \__kernel_primitive:NN \pdffontsize \pdftex_fontsize:D @@ -836,6 +838,7 @@ \__kernel_primitive:NN \pdflastypos \pdftex_lastypos:D \__kernel_primitive:NN \pdfmapfile \pdftex_mapfile:D \__kernel_primitive:NN \pdfmapline \pdftex_mapline:D + \__kernel_primitive:NN \pdfmdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \pdfnoligatures \pdftex_noligatures:D \__kernel_primitive:NN \pdfnormaldeviate \pdftex_normaldeviate:D \__kernel_primitive:NN \pdfpageheight \pdftex_pageheight:D @@ -925,6 +928,7 @@ \__kernel_primitive:NN \XeTeXvariationname \xetex_variationname:D \__kernel_primitive:NN \XeTeXrevision \xetex_XeTeXrevision:D \__kernel_primitive:NN \XeTeXversion \xetex_XeTeXversion:D + \__kernel_primitive:NN \mdfivesum \pdftex_mdfivesum:D \__kernel_primitive:NN \ifprimitive \pdftex_ifprimitive:D \__kernel_primitive:NN \primitive \pdftex_primitive:D \__kernel_primitive:NN \shellescape \pdftex_shellescape:D @@ -1755,29 +1759,6 @@ { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } { } } \cs_set:Npn \cs_if_exist_use:c #1 { \cs_if_exist:cTF {#1} { \use:c {#1} } { } } -\cs_set_protected:Npn \iow_log:x - { \tex_immediate:D \tex_write:D -1 } -\cs_set_protected:Npn \iow_term:x - { \tex_immediate:D \tex_write:D 16 } -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_log:x { \iow_log:x } - \cs_set_protected:Npn \__chk_suspend_log: - { - \cs_set_protected:Npx \__chk_resume_log: - { - \cs_set_protected:Npn \__chk_resume_log: - { \exp_not:o { \__chk_resume_log: } } - \cs_set_protected:Npn \__chk_log:x - { \exp_not:o { \__chk_log:x } } - } - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - } - \cs_set_protected:Npn \__chk_resume_log: { } -\else: - \cs_set_protected:Npn \__chk_log:x { \use_none:n } - \cs_set_protected:Npn \__chk_suspend_log: { } - \cs_set_protected:Npn \__chk_resume_log: { } -\fi: \cs_set_protected:Npn \__msg_kernel_error:nnxx #1#2#3#4 { \tex_newlinechar:D = `\^^J \tex_relax:D @@ -1797,6 +1778,85 @@ { \__msg_kernel_error:nnxx {#1} {#2} { } { } } \cs_set:Npn \msg_line_context: { on~line~ \tex_the:D \tex_inputlineno:D } +\cs_set_protected:Npn \iow_log:x + { \tex_immediate:D \tex_write:D -1 } +\cs_set_protected:Npn \iow_term:x + { \tex_immediate:D \tex_write:D 16 } +\cs_set_protected:Npn \debug_log_functions_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_on: } + } +\cs_set_protected:Npn \debug_log_functions_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_log_functions_off: } + } +\cs_set_protected:Npn \__debug_suspend_log: { } +\cs_set_protected:Npn \__debug_resume_log: { } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_log_functions_on: + { + \cs_set_protected:Npn \__debug_log:x { \iow_log:x } + \cs_set_protected:Npn \__debug_suspend_log: + { + \cs_set_protected:Npx \__debug_resume_log: + { + \cs_set_protected:Npn \__debug_resume_log: + { \exp_not:o { \__debug_resume_log: } } + \cs_set_protected:Npn \__debug_log:x + { \exp_not:o { \__debug_log:x } } + } + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \cs_set_protected:Npn \debug_log_functions_off: + { + \cs_set_protected:Npn \__debug_log:x { \use_none:n } + \cs_set_protected:Npn \__debug_suspend_log: { } + \cs_set_protected:Npn \__debug_resume_log: { } + } + \tex_ifodd:D \l@expl@log@functions@bool + \debug_log_functions_on: + \else: + \debug_log_functions_off: + \fi: +\fi: +\cs_set_protected:Npn \__debug_patch:nnNw #1#2 { } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3 + { + \tex_ifcase:D + \if_meaning:w #3 \cs_new_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_new:Npn 1~ \fi: + \if_meaning:w #3 \cs_set_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_set:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset_protected:Npn 1~ \fi: + \if_meaning:w #3 \cs_gset:Npn 1~ \fi: + \if_meaning:w #3 \prg_new_protected_conditional:Npnn 2~ \fi: + \if_meaning:w #3 \prg_new_conditional:Npnn 2~ \fi: + \__msg_kernel_error:nnx { kernel } { debug-unpatchable } + { \token_to_str:N #3 } + \or: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new:nnNNnn + \else: + \exp_after:wN \__debug_patch_param:NNnnNnp + \exp_after:wN \__debug_patch_new_conditional:nnNNnnn + \fi: + \use_none:nn {#1} {#2} #3 + } + \cs_set_protected:Npn \__debug_patch_param:NNnnNnp #1#2#3#4#5#6#7# + { #1 {#3} {#4} #5 #6 {#7} } + \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6 + { #3 #4 #5 { #1 #6 #2 } } + \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn + #1#2#3#4#5#6#7 + { #3 #4 #5 {#6} { #1 #7 #2 } } +\fi: +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -1804,29 +1864,38 @@ \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } -} -\tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \__chk_if_free_cs:N #1 - { - \cs_if_free:NF #1 - { - \__msg_kernel_error:nnxx { kernel } { command-already-defined } - { \token_to_str:N #1 } { \token_to_meaning:N #1 } - } - \__chk_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } - } -\fi: + } \cs_set_protected:Npn \__chk_if_free_cs:c { \exp_args:Nc \__chk_if_free_cs:N } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__chk_if_exist_var:N #1 +\cs_set_protected:Npn \debug_check_declarations_on: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_on: } + } +\cs_set_protected:Npn \debug_check_declarations_off: + { + \__msg_kernel_error:nnx { kernel } { enable-debug } + { \token_to_str:N \debug_check_declarations_off: } + } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_set_protected:Npn \debug_check_declarations_on: { - \cs_if_exist:NF #1 + \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { - \__msg_kernel_error:nnx { check } { non-declared-variable } - { \token_to_str:N #1 } + \cs_if_exist:NF ##1 + { + \__msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N ##1 } + } } } + \cs_set_protected:Npn \debug_check_declarations_off: + { \cs_set_protected:Npn \__chk_if_exist_var:N ##1 { } } + \tex_ifodd:D \l@expl@check@declarations@bool + \debug_check_declarations_on: + \else: + \debug_check_declarations_off: + \fi: \fi: \cs_set_protected:Npn \__chk_if_exist_cs:N #1 { @@ -2474,7 +2543,7 @@ \q_mark \__msg_kernel_error:nnxx { kernel } { variant-too-long } {#5} { \token_to_str:N #3 } - \use_none:nnnn + \use_none:nnn \q_stop #3 #3 @@ -2489,7 +2558,7 @@ \q_mark \__msg_kernel_error:nnxxxx { kernel } { invalid-variant } {#7} { \token_to_str:N #5 } {#1} {#2} - \use_none:nnnn + \use_none:nnn \q_stop #5 #5 @@ -2507,24 +2576,29 @@ \fi: \fi: } +\__debug_patch:nnNw + { + \cs_if_free:NF #4 + { + \__debug_log:x + { + Variant~\token_to_str:N #4~% + already~defined;~ not~ changing~ it~ \msg_line_context: + } + } + } + { } \cs_new_protected:Npn \__cs_generate_variant:wwNN #1 \q_mark #2 \q_stop #3#4 { #2 - \cs_if_free:NTF #4 + \cs_if_free:NT #4 { \group_begin: \__cs_generate_internal_variant:n {#1} \__cs_tmp:w #4 { \exp_not:c { exp_args:N #1 } \exp_not:N #3 } \group_end: } - { - \__chk_log:x - { - Variant~\token_to_str:N #4~% - already~defined;~ not~ changing~ it~ \msg_line_context: - } - } } \cs_new_protected:Npx \__cs_generate_internal_variant:n #1 { @@ -2588,16 +2662,41 @@ { \tl_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } \cs_generate_variant:Nn \tl_clear_new:N { c } \cs_generate_variant:Nn \tl_gclear_new:N { c } -\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \tl_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \tl_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \tl_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new_protected:Npn \tl_set_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_new_protected:Npn \tl_gset_eq:NN #1#2 + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \cs_gset_eq:NN #1 #2 + } +\else: + \cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN + \cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN +\fi: +\cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc } +\cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc } +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\__debug_patch:nnNw + { + \__chk_if_exist_var:N #1 + \__chk_if_exist_var:N #2 + \__chk_if_exist_var:N #3 + } + { } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_generate_variant:Nn \tl_concat:NNN { ccc } @@ -2606,16 +2705,22 @@ \prg_new_eq_conditional:NNn \tl_if_exist:c \cs_if_exist:c { TF , T , F , p } \tl_const:Nn \c_empty_tl { } \tl_const:Nn \c_space_tl { ~ } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } @@ -2624,20 +2729,28 @@ \cs_generate_variant:Nn \tl_gset:Nn { NV , Nv , Nf } \cs_generate_variant:Nn \tl_gset:Nx { c } \cs_generate_variant:Nn \tl_gset:Nn { c, co , cV , cv , cf } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } @@ -2648,20 +2761,28 @@ \cs_generate_variant:Nn \tl_gput_left:NV { c } \cs_generate_variant:Nn \tl_gput_left:No { c } \cs_generate_variant:Nn \tl_gput_left:Nx { c } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } @@ -2672,61 +2793,6 @@ \cs_generate_variant:Nn \tl_gput_right:NV { c } \cs_generate_variant:Nn \tl_gput_right:No { c } \cs_generate_variant:Nn \tl_gput_right:Nx { c } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \__cs_tmp:w #1 - { - \if_meaning:w \q_recursion_tail #1 - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w - \fi: - \use:x - { - \cs_set_protected:Npn #1 \exp_not:n { ##1 ##2 } - { - \__chk_if_exist_var:N \exp_not:n {##1} - \exp_not:o { #1 {##1} {##2} } - } - } - \__cs_tmp:w - } - \__cs_tmp:w - \tl_set:Nn \tl_set:No \tl_set:Nx - \tl_gset:Nn \tl_gset:No \tl_gset:Nx - \tl_put_left:Nn \tl_put_left:NV - \tl_put_left:No \tl_put_left:Nx - \tl_gput_left:Nn \tl_gput_left:NV - \tl_gput_left:No \tl_gput_left:Nx - \tl_put_right:Nn \tl_put_right:NV - \tl_put_right:No \tl_put_right:Nx - \tl_gput_right:Nn \tl_gput_right:NV - \tl_gput_right:No \tl_gput_right:Nx - \q_recursion_tail \q_recursion_stop - \cs_set_protected:Npn \tl_set_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_set_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_gset_eq:NN #1#2 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \cs_gset_eq:NN #1 #2 - } - \cs_set_protected:Npn \tl_concat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } - \cs_set_protected:Npn \tl_gconcat:NNN #1#2#3 - { - \__chk_if_exist_var:N #1 - \__chk_if_exist_var:N #2 - \__chk_if_exist_var:N #3 - \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } - } -\tex_fi:D \tl_const:Nx \c__tl_rescan_marker_tl { : \token_to_str:N : } \cs_new_protected:Npn \tl_set_rescan:Nnn { \__tl_set_rescan:NNnn \tl_set:Nn } @@ -4051,7 +4117,7 @@ \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = 0 \exp_stop_f: \else: \tl_const:cx - { c__unicode_title_ \utex_char:D "#1 _tl } + { c__unicode_mixed_ \utex_char:D "#1 _tl } { \utex_char:D "#7 } \fi: } @@ -4081,7 +4147,7 @@ \use:n { \__unicode_parse_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = 0 \exp_stop_f: \else: - \use:n { \__unicode_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop + \use:n { \__unicode_parse_auxii:w #1 ~ mixed ~ #3 ~ } ~ \q_stop \fi: } \cs_set_protected:Npn \__unicode_parse_auxii:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop @@ -5494,7 +5560,9 @@ \cs_new:cpn { flag~#1 } ##1 ; { \exp_after:wN \use_none:n \cs:w flag~#1~##1 \cs_end: } } -\cs_new_protected:Npn \flag_clear:n { \__flag_clear:wn 0 ; } +\__debug_patch:nnNw + { \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } } { } +\cs_new_protected:Npn \flag_clear:n #1 { \__flag_clear:wn 0 ; {#1} } \cs_new_protected:Npn \__flag_clear:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -5515,11 +5583,22 @@ } \cs_new_protected:Npn \flag_log:n { \__msg_log_next: \flag_show:n } +\tex_ifodd:D \l@expl@enable@debug@bool + \cs_new:Npn \__flag_chk_exist:n #1 + { + \flag_if_exist:nF {#1} + { + \__msg_kernel_expandable_error:nnn + { kernel } { bad-variable } { flag~#1~ } + } + } +\fi: \prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } { \cs_if_exist:cTF { flag~#1 } { \prg_return_true: } { \prg_return_false: } } +\__debug_patch:nnNw { \__flag_chk_exist:n {#1} } { } \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { \if_cs_exist:w flag~#1~0 \cs_end: @@ -5528,7 +5607,8 @@ \prg_return_false: \fi: } -\cs_new:Npn \flag_height:n { \__flag_height_loop:wn 0; } +\__debug_patch:nnNw { \__flag_chk_exist:n {#1} } { } +\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:wn 0; {#1} } \cs_new:Npn \__flag_height_loop:wn #1 ; #2 { \if_cs_exist:w flag~#2~#1 \cs_end: @@ -5544,35 +5624,6 @@ \cs:w flag~#1 \exp_after:wN \cs_end: \__int_value:w \flag_height:n {#1} ; } -\tex_ifodd:D \l@expl@check@declarations@bool - \cs_set_protected:Npn \flag_clear:n #1 - { - \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } - \__flag_clear:wn 0 ; {#1} - } - \cs_set:Npn \__flag_chk_exist:n #1 - { - \flag_if_exist:nF {#1} - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-variable } { flag~#1~ } - } - } - \cs_set:Npn \flag_height:n #1 - { - \__flag_chk_exist:n {#1} - \__flag_height_loop:wn 0; {#1} - } - \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \__flag_chk_exist:n {#1} - \if_cs_exist:w flag~#1~0 \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\fi: %% File: l3quark.dtx Copyright (C) 1990-2017 The LaTeX3 Project \cs_new_protected:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} } \quark_new:N \q_nil @@ -5685,74 +5736,34 @@ \cs_new_eq:NN \if_predicate:w \tex_ifodd:D \cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_new:N { c } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } \cs_generate_variant:Nn \bool_set_false:N { c } \cs_generate_variant:Nn \bool_gset_true:N { c } \cs_generate_variant:Nn \bool_gset_false:N { c } -\cs_new_eq:NN \bool_set_eq:NN \cs_set_eq:NN -\cs_new_eq:NN \bool_set_eq:Nc \cs_set_eq:Nc -\cs_new_eq:NN \bool_set_eq:cN \cs_set_eq:cN -\cs_new_eq:NN \bool_set_eq:cc \cs_set_eq:cc -\cs_new_eq:NN \bool_gset_eq:NN \cs_gset_eq:NN -\cs_new_eq:NN \bool_gset_eq:Nc \cs_gset_eq:Nc -\cs_new_eq:NN \bool_gset_eq:cN \cs_gset_eq:cN -\cs_new_eq:NN \bool_gset_eq:cc \cs_gset_eq:cc +\cs_new_eq:NN \bool_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \bool_gset_eq:NN \tl_gset_eq:NN +\cs_generate_variant:Nn \bool_set_eq:NN { Nc, cN, cc } +\cs_generate_variant:Nn \bool_gset_eq:NN { Nc, cN, cc } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_set:Nn #1#2 { \tex_chardef:D #1 = \bool_if_p:n {#2} } +\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { } \cs_new_protected:Npn \bool_gset:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } \cs_generate_variant:Nn \bool_set:Nn { c } \cs_generate_variant:Nn \bool_gset:Nn { c } -\if_bool:N \l@expl@check@declarations@bool - \cs_set_protected:Npn \bool_set_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_set_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_gset_true:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_true_bool - } - \cs_set_protected:Npn \bool_gset_false:N #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 \c_false_bool - } - \cs_set_protected:Npn \bool_set_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_set_eq:NN #1 - } - \cs_set_protected:Npn \bool_gset_eq:NN #1 - { - \__chk_if_exist_var:N #1 - \cs_gset_eq:NN #1 - } - \cs_set_protected:Npn \bool_set:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_chardef:D #1 = \bool_if_p:n {#2} - } - \cs_set_protected:Npn \bool_gset:Nn #1#2 - { - \__chk_if_exist_var:N #1 - \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} - } -\fi: \prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF } { \if_meaning:w \c_true_bool #1 @@ -7569,6 +7580,8 @@ \cs_if_exist:cTF { \c__msg_text_prefix_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } +\__debug_patch:nnNw { } + { \__debug_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} @@ -7577,17 +7590,6 @@ {#1} {#2} } } -\if_bool:N \l@expl@log@functions@bool - \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 - { - \msg_if_exist:nnT {#1} {#2} - { - \__msg_kernel_error:nnxx { kernel } { message-already-defined } - {#1} {#2} - } - \__chk_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } - } -\fi: \cs_new_protected:Npn \msg_new:nnnn #1#2 { \__chk_if_free_msg:nn {#1} {#2} @@ -7621,7 +7623,7 @@ \tl_const:Nn \c__msg_continue_text_tl { Type~<return>~to~continue } \tl_const:Nn \c__msg_critical_text_tl - { Reading~the~current~file~'\g_file_current_name_tl'~will~stop. } + { Reading~the~current~file~'\g_file_curr_name_str'~will~stop. } \tl_const:Nn \c__msg_fatal_text_tl { This~is~a~fatal~error:~LaTeX~will~abort. } \tl_const:Nn \c__msg_help_text_tl @@ -7678,7 +7680,6 @@ |............................................... } } - \group_begin: \char_set_lccode:nn {`\{} {`\ } \char_set_lccode:nn {`\}} {`\ } @@ -8183,19 +8184,6 @@ LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } -\bool_if:NT \l@expl@check@declarations@bool - { - \__msg_kernel_new:nnnn { check } { non-declared-variable } - { The~variable~#1~has~not~been~declared~\msg_line_context:. } - { - Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ - without~first~having: \\ - \ \ \tl_new:N ~ #1 \\ - \\ - LaTeX~will~create~the~variable~and~continue. - } - } \__msg_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { @@ -8226,6 +8214,32 @@ with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ from~type~'#3'~to~type~'#4'. } +\bool_if:NTF \l@expl@enable@debug@bool + { + \__msg_kernel_new:nnn { kernel } { debug-unpatchable } + { Only~some~definitions~can~be~patched;~'#3'~cannot. } + \__msg_kernel_new:nnnn { check } { non-declared-variable } + { The~variable~#1~has~not~been~declared~\msg_line_context:. } + { + Checking~is~active,~and~you~have~tried~do~so~something~like: \\ + \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ + without~first~having: \\ + \ \ \tl_new:N ~ #1 \\ + \\ + LaTeX~will~create~the~variable~and~continue. + } + } + { + \__msg_kernel_new:nnnn { kernel } { enable-debug } + { To~use~'#1'~load~expl3~with~the~'enable-debug'~option. } + { + The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ + some~internal~functions~in~expl3~have~been~appropriately~ + defined.~This~only~happens~if~one~of~the~options~ + 'enable-debug',~'check-declarations'~or~'log-functions'~was~ + given~when~loading~expl3. + } + } \__msg_kernel_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } \__msg_kernel_new:nnn { kernel } { misused-sequence } @@ -8403,166 +8417,225 @@ \ \ => \ \ \tl_to_str:n {#2} } %% File: l3file.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\tl_new:N \g_file_current_name_tl +\str_new:N \g_file_curr_dir_str +\str_new:N \g_file_curr_ext_str +\str_new:N \g_file_curr_name_str \cs_if_exist:NT \@currname - { \tl_gset_eq:NN \g_file_current_name_tl \@currname } + { \str_gset_eq:NN \g_file_curr_name_str \@currname } \seq_new:N \g__file_stack_seq -\seq_new:N \g__file_record_seq -\tl_new:N \l__file_internal_tl -\tl_new:N \l__file_internal_name_tl -\seq_new:N \l__file_search_path_seq -\seq_new:N \l__file_saved_search_path_seq -\seq_new:N \l__file_internal_seq -\cs_new_protected:Npn \__file_name_sanitize:nn #1#2 - { - \group_begin: - \seq_map_inline:Nn \l_char_active_seq - { - \tl_set:Nx \l__file_internal_tl { \iow_char:N ##1 } - \char_set_active_eq:NN ##1 \l__file_internal_tl - } - \tl_set:Nx \l__file_internal_name_tl {#1} - \tl_set:Nx \l__file_internal_name_tl - { \tl_to_str:N \l__file_internal_name_tl } - \int_compare:nNnTF - { - \int_mod:nn - { - 0 \tl_map_function:NN \l__file_internal_name_tl - \__file_name_sanitize_aux:n - } - { 2 } - } - = 0 +\group_begin: + \cs_set_protected:Npn \__file_tmp:w #1#2#3 + { + \tl_if_blank:nTF {#1} { - \tl_remove_all:Nn \l__file_internal_name_tl { " } - \tl_if_in:NnT \l__file_internal_name_tl { ~ } + \cs_set:Npn \__file_tmp:w ##1 " ##2 " ##3 \q_stop { { } {##2} { } } + \seq_gput_right:Nx \g__file_stack_seq { - \tl_set:Nx \l__file_internal_name_tl - { " \exp_not:V \l__file_internal_name_tl " } + \exp_after:wN \__file_tmp:w \tex_jobname:D + " \tex_jobname:D " \q_stop } } { - \__msg_kernel_error:nnx - { kernel } { unbalanced-quote-in-filename } - { \l__file_internal_name_tl } + \seq_gput_right:Nn \g__file_stack_seq { { } {#1} {#2} } + \__file_tmp:w } - \use:x + } + \cs_if_exist:NT \@currnamestack + { \exp_after:wN \__file_tmp:w \@currnamestack } +\group_end: +\seq_new:N \g__file_record_seq +\tl_new:N \l__file_tmp_tl +\str_new:N \l__file_base_name_str +\str_new:N \l__file_full_name_str +\str_new:N \l__file_dir_str +\str_new:N \l__file_ext_str +\str_new:N \l__file_name_str +\seq_new:N \l_file_search_path_seq +\seq_new:N \l__file_tmp_seq +\cs_new_protected:Npn \__file_name_sanitize:nN #1#2 + { + \group_begin: + \seq_map_inline:Nn \l_char_active_seq { - \group_end: - \exp_not:n {#2} { \l__file_internal_name_tl } + \tl_set:Nx \l__file_tmp_tl { \iow_char:N ##1 } + \char_set_active_eq:NN ##1 \l__file_tmp_tl } + \tl_set:Nx \l__file_tmp_tl {#1} + \tl_set:Nx \l__file_tmp_tl + { \tl_to_str:N \l__file_tmp_tl } + \exp_args:NNNV \group_end: + \str_set:Nn #2 \l__file_tmp_tl } -\cs_new:Npn \__file_name_sanitize_aux:n #1 - { \token_if_eq_charcode:NNT #1 " { + 1 } } -\cs_new_protected:Npn \file_add_path:nN #1 - { \__file_name_sanitize:nn {#1} { \__file_add_path:nN } } -\cs_new_protected:Npn \__file_add_path:nN #1#2 - { - \__ior_open:Nn \g__file_internal_ior {#1} - \ior_if_eof:NTF \g__file_internal_ior - { \__file_add_path_search:nN {#1} #2 } - { \tl_set:Nn #2 {#1} } - \ior_close:N \g__file_internal_ior +\cs_new_protected:Npn \__file_name_quote:nN #1#2 + { + \str_set:Nx #2 {#1} + \int_if_even:nF + { 0 \tl_map_function:NN #2 \__file_name_quote_aux:n } + { + \__msg_kernel_error:nnx + { kernel } { unbalanced-quote-in-filename } {#2} + } + \tl_remove_all:Nn #2 { " } + \tl_if_in:NnT #2 { ~ } + { \str_set:Nx #2 { " \exp_not:V #2 " } } } -\cs_new_protected:Npn \__file_add_path_search:nN #1#2 +\cs_new:Npn \__file_name_quote_aux:n #1 + { \token_if_eq_charcode:NNT #1 " { + 1 } } +\cs_new_protected:Npn \file_get_full_name:nN #1#2 { - \tl_set:Nn #2 { \q_no_value } + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \__file_get_full_name_search:nN { } \use:n + \seq_map_inline:Nn \l_file_search_path_seq + { \__file_get_full_name_search:nN { ##1 / } \seq_map_break:n } \cs_if_exist:NT \input@path { - \seq_set_eq:NN \l__file_saved_search_path_seq - \l__file_search_path_seq - \seq_set_split:NnV \l__file_internal_seq { , } \input@path - \seq_concat:NNN \l__file_search_path_seq - \l__file_search_path_seq \l__file_internal_seq + \tl_map_inline:Nn \input@path + { \__file_get_full_name_search:nN { ##1 } \tl_map_break:n } } - \seq_map_inline:Nn \l__file_search_path_seq + \str_clear:N \l__file_full_name_str + \__prg_break_point: + \str_if_empty:NF \l__file_full_name_str { - \__ior_open:Nn \g__file_internal_ior { ##1 #1 } - \ior_if_eof:NF \g__file_internal_ior + \exp_args:NV \file_parse_full_name:nNNN \l__file_full_name_str + \l__file_dir_str \l__file_name_str \l__file_ext_str + \str_if_empty:NT \l__file_ext_str { - \tl_set:Nx #2 { ##1 #1 } - \seq_map_break: + \__ior_open:No \g__file_internal_ior + { \l__file_full_name_str .tex } + \ior_if_eof:NF \g__file_internal_ior + { \str_put_right:Nn \l__file_full_name_str { .tex } } } } - \cs_if_exist:NT \input@path - { - \seq_set_eq:NN \l__file_search_path_seq - \l__file_saved_search_path_seq - } + \str_set_eq:NN #2 \l__file_full_name_str + \ior_close:N \g__file_internal_ior + } +\cs_generate_variant:Nn \file_get_full_name:nN { V } +\cs_new_protected:Npn \__file_get_full_name_search:nN #1#2 + { + \__file_name_quote:nN + { \tl_to_str:n {#1} \l__file_base_name_str } + \l__file_full_name_str + \__ior_open:No \g__file_internal_ior \l__file_full_name_str + \ior_if_eof:NF \g__file_internal_ior { #2 { \__prg_break: } } } \prg_new_protected_conditional:Npnn \file_if_exist:n #1 { T , F , TF } { - \file_add_path:nN {#1} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { \prg_return_true: } } -\cs_new_protected:Npn \file_input:n #1 +\cs_new_protected:Npn \__file_missing:n #1 { - \__file_if_exist:nT {#1} - { \__file_input:V \l__file_internal_name_tl } + \__file_name_sanitize:nN {#1} \l__file_base_name_str + \__msg_kernel_error:nnx { kernel } { file-not-found } + { \l__file_base_name_str } } -\cs_new_protected:Npn \__file_if_exist:nT #1#2 +\cs_new_protected:Npn \file_input:n #1 { - \file_if_exist:nTF {#1} - {#2} - { - \__file_name_sanitize:nn {#1} - { \__msg_kernel_error:nnx { kernel } { file-not-found } } - } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#1} } + { \__file_input:V \l__file_full_name_str } } \cs_new_protected:Npn \__file_input:n #1 { - \tl_if_in:nnTF {#1} { . } - { \__file_input_aux:n {#1} } - { \__file_input_aux:o { \tl_to_str:n { #1 . tex } } } - } -\cs_generate_variant:Nn \__file_input:n { V } -\cs_new_protected:Npn \__file_input_aux:n #1 - { \clist_if_exist:NTF \@filelist { \@addtofilelist {#1} } { \seq_gput_right:Nn \g__file_record_seq {#1} } - \seq_gpush:No \g__file_stack_seq \g_file_current_name_tl - \tl_gset:Nn \g_file_current_name_tl {#1} + \__file_input_push:n {#1} \tex_input:D #1 \c_space_tl - \seq_gpop:NN \g__file_stack_seq \l__file_internal_tl - \tl_gset_eq:NN \g_file_current_name_tl \l__file_internal_tl + \__file_input_pop: } -\cs_generate_variant:Nn \__file_input_aux:n { o } -\cs_new_protected:Npn \file_path_include:n #1 - { \__file_name_sanitize:nn {#1} { \__file_path_include:n } } -\cs_new_protected:Npn \__file_path_include:n #1 +\cs_generate_variant:Nn \__file_input:n { V } +\cs_new_protected:Npn \__file_input_push:n #1 { - \seq_if_in:NnF \l__file_search_path_seq {#1} - { \seq_put_right:Nn \l__file_search_path_seq {#1} } + \seq_gpush:Nx \g__file_stack_seq + { + { \g_file_curr_dir_str } + { \g_file_curr_name_str } + { \g_file_curr_ext_str } + } + \file_parse_full_name:nNNN {#1} + \l__file_dir_str \l__file_name_str \l__file_ext_str + \str_gset_eq:NN \g_file_curr_dir_str \l__file_dir_str + \str_gset_eq:NN \g_file_curr_name_str \l__file_name_str + \str_gset_eq:NN \g_file_curr_ext_str \l__file_ext_str } -\cs_new_protected:Npn \file_path_remove:n #1 +\cs_new_protected:Npn \__file_input_pop: { - \__file_name_sanitize:nn {#1} - { \seq_remove_all:Nn \l__file_search_path_seq } + \seq_gpop:NN \g__file_stack_seq \l__file_tmp_tl + \exp_after:wN \__file_input_pop:nnn \l__file_tmp_tl } -\cs_new_protected:Npn \file_list: +\cs_new_protected:Npn \__file_input_pop:nnn #1#2#3 { - \seq_set_eq:NN \l__file_internal_seq \g__file_record_seq - \clist_if_exist:NT \@filelist + \str_gset:Nn \g_file_curr_dir_str {#1} + \str_gset:Nn \g_file_curr_name_str {#2} + \str_gset:Nn \g_file_curr_ext_str {#3} + } +\cs_new_protected:Npn \file_parse_full_name:nNNN #1#2#3#4 + { + \exp_after:wN \__file_parse_full_name_auxi:w + \tl_to_str:n { #1 " #1 " } \q_stop #2#3#4 + } +\cs_new_protected:Npn \__file_parse_full_name_auxi:w #1 " #2 " #3 \q_stop #4#5#6 + { + \__file_parse_full_name_split:nNNNTF {#2} / #4 #5 + { \str_if_empty:NT #4 { \str_set:Nn #4 { / } } } + { } + \exp_args:No \__file_parse_full_name_split:nNNNTF {#5} . #5 #6 + { \str_put_left:Nn #6 { . } } + { + \str_set_eq:NN #5 #6 + \str_clear:N #6 + } + } +\cs_new_protected:Npn \__file_parse_full_name_split:nNNNTF #1#2#3#4 + { + \cs_set_protected:Npn \__file_tmp:w ##1 ##2 #2 ##3 \q_stop { - \clist_map_inline:Nn \@filelist + \tl_if_empty:nTF {##3} { - \seq_put_right:No \l__file_internal_seq - { \tl_to_str:n {##1} } + \str_set:Nn #4 {##2} + \tl_if_empty:nTF {##1} + { + \str_clear:N #3 + \use_ii:nn + } + { + \str_set:Nx #3 { \str_tail:n {##1} } + \use_i:nn + } } + { \__file_tmp:w { ##1 #2 ##2 } ##3 \q_stop } + } + \__file_tmp:w { } #1 #2 \q_stop + } +\cs_new_protected:Npn \file_show_list: + { + \seq_clear:N \l__file_tmp_seq + \clist_if_exist:NT \@filelist + { + \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq + { \tl_to_str:N \@filelist } + } + \seq_concat:NNN \l__file_tmp_seq \l__file_tmp_seq \g__file_record_seq + \seq_remove_duplicates:N \l__file_tmp_seq + \__msg_show_wrap:n + { + >~File~List~< \\ + \seq_map_function:NN \l__file_tmp_seq \__file_list_aux:n + ............ } - \seq_remove_duplicates:N \l__file_internal_seq - \iow_log:n { *~File~List~* } - \seq_map_inline:Nn \l__file_internal_seq { \iow_log:n {##1} } - \iow_log:n { ************* } } +\cs_new:Npn \__file_list_aux:n #1 { #1 \\ } +\cs_new_protected:Npn \file_log_list: + { \__msg_log_next: \file_show_list: } \AtBeginDocument { - \clist_map_inline:Nn \@filelist - { \seq_gput_right:No \g__file_record_seq { \tl_to_str:n {#1} } } + \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq + { \tl_to_str:N \@filelist } + \seq_gconcat:NNN \g__file_record_seq \g__file_record_seq \l__file_tmp_seq } \int_const:Nn \c_term_ior { 16 } \seq_new:N \g__ior_streams_seq @@ -8585,30 +8658,21 @@ \cs_new_protected:Npn \ior_new:N #1 { \cs_new_eq:NN #1 \c_term_ior } \cs_generate_variant:Nn \ior_new:N { c } \cs_new_protected:Npn \ior_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \__ior_open_aux:Nn #1 } } + { \ior_open:NnF #1 {#2} { \__file_missing:n {#2} } } \cs_generate_variant:Nn \ior_open:Nn { c } -\cs_new_protected:Npn \__ior_open_aux:Nn #1#2 - { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl - { \__msg_kernel_error:nnx { kernel } { file-not-found } {#2} } - { \__ior_open:No #1 \l__file_internal_name_tl } - } \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } - { \__file_name_sanitize:nn {#2} { \__ior_open_aux:NnTF #1 } } -\cs_generate_variant:Nn \ior_open:NnT { c } -\cs_generate_variant:Nn \ior_open:NnF { c } -\cs_generate_variant:Nn \ior_open:NnTF { c } -\cs_new_protected:Npn \__ior_open_aux:NnTF #1#2 { - \file_add_path:nN {#2} \l__file_internal_name_tl - \quark_if_no_value:NTF \l__file_internal_name_tl + \file_get_full_name:nN {#2} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str { \prg_return_false: } { - \__ior_open:No #1 \l__file_internal_name_tl + \__ior_open:No #1 \l__file_full_name_str \prg_return_true: } } +\cs_generate_variant:Nn \ior_open:NnT { c } +\cs_generate_variant:Nn \ior_open:NnF { c } +\cs_generate_variant:Nn \ior_open:NnTF { c } \exp_args:NNf \cs_new_protected:Npn \__ior_new:N { \exp_args:NNc \exp_after:wN \exp_stop_f: { newread } } \cs_new_protected:Npn \__ior_open:Nn #1#2 @@ -8641,9 +8705,11 @@ } } \cs_generate_variant:Nn \ior_close:N { c } -\cs_new_protected:Npn \ior_list_streams: - { \__ior_list_streams:Nn \g__ior_streams_prop { ior } } -\cs_new_protected:Npn \__ior_list_streams:Nn #1#2 +\cs_new_protected:Npn \ior_show_list: + { \__ior_list:Nn \g__ior_streams_prop { ior } } +\cs_new_protected:Npn \ior_log_list: + { \__msg_log_next: \ior_show_list: } +\cs_new_protected:Npn \__ior_list:Nn #1#2 { \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-streams } {#2} { \prop_if_empty:NF #1 { ? } } { } { } @@ -8743,26 +8809,25 @@ \exp_args:NNf \cs_new_protected:Npn \__iow_new:N { \exp_args:NNc \exp_after:wN \exp_stop_f: { newwrite } } \cs_new_protected:Npn \iow_open:Nn #1#2 - { \__file_name_sanitize:nn {#2} { \__iow_open:Nn #1 } } -\cs_generate_variant:Nn \iow_open:Nn { c } -\cs_new_protected:Npn \__iow_open:Nn #1#2 { + \__file_name_sanitize:nN {#2} \l__file_base_name_str \iow_close:N #1 \seq_gpop:NNTF \g__iow_streams_seq \l__iow_stream_tl - { \__iow_open_stream:Nn #1 {#2} } + { \__iow_open_stream:NV #1 \l__file_base_name_str } { \__iow_new:N #1 \tl_set:Nx \l__iow_stream_tl { \int_eval:n {#1} } - \__iow_open_stream:Nn #1 {#2} + \__iow_open_stream:NV #1 \l__file_base_name_str } } -\cs_generate_variant:Nn \__iow_open:Nn { No } +\cs_generate_variant:Nn \iow_open:Nn { c } \cs_new_protected:Npn \__iow_open_stream:Nn #1#2 { \tex_global:D \tex_chardef:D #1 = \l__iow_stream_tl \scan_stop: \prop_gput:NVn \g__iow_streams_prop #1 {#2} \tex_immediate:D \tex_openout:D #1 #2 \scan_stop: } +\cs_generate_variant:Nn \__iow_open_stream:Nn { NV } \cs_new_protected:Npn \iow_close:N #1 { \int_compare:nT { - \c_log_iow < #1 < \c_term_iow } @@ -8775,9 +8840,11 @@ } } \cs_generate_variant:Nn \iow_close:N { c } -\cs_new_protected:Npn \iow_list_streams: - { \__iow_list_streams:Nn \g__iow_streams_prop { iow } } -\cs_new_eq:NN \__iow_list_streams:Nn \__ior_list_streams:Nn +\cs_new_protected:Npn \iow_show_list: + { \__iow_list:Nn \g__iow_streams_prop { iow } } +\cs_new_protected:Npn \iow_log_list: + { \__msg_log_next: \iow_show_list: } +\cs_new_eq:NN \__iow_list:Nn \__ior_list:Nn \cs_new_protected:Npn \iow_shipout_x:Nn #1#2 { \tex_write:D #1 {#2} } \cs_generate_variant:Nn \iow_shipout_x:Nn { c, Nx, cx } @@ -9118,6 +9185,43 @@ which~will~be~wrapped~using~#1.~ It~was~called~with~argument~'#3'. } +\tl_new:N \g_file_current_name_tl +\tl_gset:Nn \g_file_current_name_tl { \g_file_curr_name_str } +\cs_new_protected:Npn \file_path_include:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_include:n } + { + \token_to_str:N \seq_put_right:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_if_in:NVF \l_file_search_path_seq \l__file_full_name_str + { \seq_put_right:NV \l_file_search_path_seq \l__file_full_name_str } + } +\cs_new_protected:Npn \file_path_remove:n #1 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_path_remove:n } + { + \token_to_str:N \seq_remove_all:Nn \c_space_tl + \token_to_str:N \l_file_search_path_seq + } + \__file_name_sanitize:nN {#1} \l__file_full_name_str + \seq_remove_all:NV \l_file_search_path_seq \l__file_full_name_str + } +\cs_new_protected:Npn \file_add_path:nN #1#2 + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_add_path:nN } + { \token_to_str:N \file_get_full_name:nN } + \file_get_full_name:nN {#1} #2 + \str_if_empty:NT #2 + { \tl_set:Nn #2 { \q_no_value } } + } \cs_new_protected:Npn \ior_get_str:NN { \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } @@ -9127,6 +9231,51 @@ \cs_gset_eq:NN \ior_get_str:NN \ior_str_get:NN \ior_str_get:NN } +\cs_new_protected:Npn \file_list: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \file_list: } + { \token_to_str:N \file_log_list: } + \cs_gset_eq:NN \file_list: \file_log_list: + \file_log_list: + } +\cs_new_protected:Npn \ior_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_list_streams: } + { \token_to_str:N \ior_show_list: } + \cs_gset_eq:NN \ior_list_streams: \ior_show_list: + \ior_show_list: + } +\cs_new_protected:Npn \ior_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \ior_log_streams: } + { \token_to_str:N \ior_log_list: } + \cs_gset_eq:NN \ior_log_streams: \ior_log_list: + \ior_log_list: + } +\cs_new_protected:Npn \iow_list_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_list_streams: } + { \token_to_str:N \iow_show_list: } + \cs_gset_eq:NN \iow_list_streams: \iow_show_list: + \iow_show_list: + } +\cs_new_protected:Npn \iow_log_streams: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \iow_log_streams: } + { \token_to_str:N \iow_log_list: } + \cs_gset_eq:NN \iow_log_streams: \iow_log_list: + \iow_log_list: + } %% File: l3skip.dtx Copyright (C) 2004-2011 Frank Mittelbach, The LaTeX3 Project %% (C) 2012-2017 The LaTeX3 Project \cs_new_eq:NN \if_dim:w \tex_ifdim:D @@ -9213,7 +9362,7 @@ \cs_new:Npn \dim_ratio:nn #1#2 { \__dim_ratio:n {#1} / \__dim_ratio:n {#2} } \cs_new:Npn \__dim_ratio:n #1 - { \__int_value:w \__dim_eval:w #1 \__dim_eval_end: } + { \__int_value:w \__dim_eval:w (#1) \__dim_eval_end: } \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { \if_dim:w \__dim_eval:w #1 #2 \__dim_eval:w #3 \__dim_eval_end: @@ -9873,12 +10022,14 @@ } } } -\cs_new_protected:Npn \__keys_cmd_set:nn #1#2 +\__debug_patch:nnNw { \cs_if_exist:cF { \c__keys_code_root_tl #1 } - { \__chk_log:x { Defining~key~#1~\msg_line_context: } } - \cs_set_protected:cpn { \c__keys_code_root_tl #1 } ##1 {#2} + { \__debug_log:x { Defining~key~#1~\msg_line_context: } } } + { } +\cs_new_protected:Npn \__keys_cmd_set:nn #1#2 + { \cs_set_protected:cpn { \c__keys_code_root_tl #1 } ##1 {#2} } \cs_generate_variant:Nn \__keys_cmd_set:nn { nx , Vn , Vo } \cs_new_protected:Npn \__keys_default_set:n #1 { @@ -9903,7 +10054,7 @@ \tex_undefined:D } { - \clist_set_eq:cN { \c__keys_groups_root_tl \l_keys_path_tl } + \cs_set_eq:cN { \c__keys_groups_root_tl \l_keys_path_tl } \l__keys_groups_clist } } @@ -16159,14 +16310,14 @@ \cs_new_protected:Npn \__sort_return_mark:N #1 { } \cs_new_protected:Npn \__sort_return_none_error: { - \__msg_kernel_error:nnxx { sort } { return-none } + \__msg_kernel_error:nnxx { kernel } { return-none } { \tex_the:D \tex_toks:D \l__sort_A_int } { \tex_the:D \tex_toks:D \l__sort_C_int } \__sort_return_same: } \cs_new_protected:Npn \__sort_return_two_error:w #1 \__sort_return_none_error: - { \__msg_kernel_error:nn { sort } { return-two } } + { \__msg_kernel_error:nn { kernel } { return-two } } \cs_new_protected:Npn \__sort_return_same: { \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int @@ -16288,12 +16439,12 @@ { \cs_set_eq:NN \toksdef \__sort_disabled_toksdef:n } \cs_new_protected:Npn \__sort_disabled_toksdef:n #1 { - \__msg_kernel_error:nnx { sort } { toksdef } + \__msg_kernel_error:nnx { kernel } { toksdef } { \token_to_str:N #1 } \__sort_error: \tex_toksdef:D #1 } -\__msg_kernel_new:nnnn { sort } { toksdef } +\__msg_kernel_new:nnnn { kernel } { toksdef } { Allocation~of~\iow_char:N\\toks~registers~impossible~while~sorting. } { The~comparison~code~used~for~sorting~a~list~has~attempted~to~ @@ -16303,20 +16454,20 @@ \cs_new_protected:Npn \__sort_too_long_error:NNw #1#2 \fi: { \fi: - \__msg_kernel_error:nnxxx { sort } { too-large } + \__msg_kernel_error:nnxxx { kernel } { too-large } { \token_to_str:N #2 } { \int_eval:n { \l__sort_true_max_int - \l__sort_min_int } } { \int_eval:n { \l__sort_top_int - \l__sort_min_int } } #1 \__sort_error: } -\__msg_kernel_new:nnnn { sort } { too-large } +\__msg_kernel_new:nnnn { kernel } { too-large } { The~list~#1~is~too~long~to~be~sorted~by~TeX. } { TeX~has~#2~toks~registers~still~available:~ this~only~allows~to~sort~with~up~to~#3~ items.~All~extra~items~will~be~deleted. } -\__msg_kernel_new:nnnn { sort } { return-none } +\__msg_kernel_new:nnnn { kernel } { return-none } { The~comparison~code~did~not~return. } { When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~ @@ -16325,7 +16476,7 @@ \iow_char:N\\sort_return_swapped: .~ Exactly~one~of~these~should~be~called. } -\__msg_kernel_new:nnnn { sort } { return-two } +\__msg_kernel_new:nnnn { kernel } { return-two } { The~comparison~code~returned~multiple~times. } { When~sorting~a~list,~the~code~to~compare~items~called~ @@ -16870,10 +17021,10 @@ } \cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2 { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } } -\cs_new:Npn \__regex_current_cs_to_str: +\cs_new:Npn \__regex_curr_cs_to_str: { \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N - \tex_the:D \tex_toks:D \l__regex_current_pos_int + \tex_the:D \tex_toks:D \l__regex_curr_pos_int } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -16908,21 +17059,21 @@ } \cs_new_protected:Npn \__regex_item_caseful_equal:n #1 { - \if_int_compare:w #1 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_char_int \exp_after:wN \__regex_break_true:w \fi: } \cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: } \cs_new_protected:Npn \__regex_item_caseless_equal:n #1 { - \if_int_compare:w #1 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_char_int \exp_after:wN \__regex_break_true:w \fi: \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int @@ -16934,8 +17085,8 @@ } \cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2 { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: @@ -16950,15 +17101,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 > `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_set_eq:NN \l__regex_case_changed_char_int \l__regex_curr_char_int + \if_int_compare:w \l__regex_curr_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_curr_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_curr_char_int < `a \exp_stop_f: \else: \int_sub:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \if_int_compare:w \l__regex_curr_char_int < `A \exp_stop_f: \else: \int_add:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } \fi: \fi: @@ -16968,7 +17119,7 @@ \cs_new_protected:Npn \__regex_item_catcode: { " - \if_case:w \l__regex_current_catcode_int + \if_case:w \l__regex_curr_catcode_int 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 @@ -16987,18 +17138,18 @@ { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } } \cs_new_protected:Npn \__regex_item_exact:nn #1#2 { - \if_int_compare:w #1 = \l__regex_current_catcode_int - \if_int_compare:w #2 = \l__regex_current_char_int + \if_int_compare:w #1 = \l__regex_curr_catcode_int + \if_int_compare:w #2 = \l__regex_curr_char_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w \fi: \fi: } \cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = 0 + \int_compare:nNnTF \l__regex_curr_catcode_int = 0 { \tl_set:Nx \l__regex_internal_a_tl - { \scan_stop: \__regex_current_cs_to_str: \scan_stop: } + { \scan_stop: \__regex_curr_cs_to_str: \scan_stop: } \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } @@ -17006,10 +17157,10 @@ } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = 0 + \int_compare:nNnT \l__regex_curr_catcode_int = 0 { \group_begin: - \tl_set:Nx \l__regex_cs_name_tl { \__regex_current_cs_to_str: } + \tl_set:Nx \l__regex_cs_name_tl { \__regex_curr_cs_to_str: } \__regex_single_match: \__regex_disable_submatches: \__regex_build_for_cs:n {#1} @@ -17134,7 +17285,7 @@ \cs_new:cpn { __regex_escape_/break:w } { \if_false: { \fi: } - \__msg_kernel_error:nn { regex } { trailing-backslash } + \__msg_kernel_error:nn { kernel } { trailing-backslash } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \cs_new:cpn { __regex_escape_~:w } { } @@ -17161,7 +17312,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-overflow } {#1} + \__msg_kernel_error:nnx { kernel } { x-overflow } {#1} \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: } @@ -17225,7 +17376,7 @@ { \if_false: { \fi: } \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} + \__msg_kernel_error:nnx { kernel } { x-missing-rbrace } {#1} \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: \__regex_escape_loop:N #1 } @@ -17390,7 +17541,7 @@ \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 } + \__msg_kernel_error:nn { kernel } { c-bad-mode } \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n \fi: \fi: @@ -17419,13 +17570,13 @@ { \__regex_if_in_class:TF { - \__msg_kernel_error:nn { regex } { missing-rbrack } + \__msg_kernel_error:nn { kernel } { missing-rbrack } \use:c { __regex_compile_]: } \prg_do_nothing: \prg_do_nothing: } { } \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { missing-rparen } + \__msg_kernel_error:nnx { kernel } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn { \l__regex_group_level_int } @@ -17461,10 +17612,10 @@ \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int - { \__msg_kernel_error:nn { regex } { c-trailing } } + { \__msg_kernel_error:nn { kernel } { c-trailing } } \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { - \__msg_kernel_error:nn { regex } { c-missing-rbrace } + \__msg_kernel_error:nn { kernel } { c-missing-rbrace } \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: @@ -17524,7 +17675,7 @@ \cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3 { \__regex_compile_quantifier_none: - \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} + \__msg_kernel_warning:nnxx { kernel } { invalid-quantifier } {#1} {#3} \__regex_compile_abort_tokens:x {#1} #2 #3 } @@ -17591,7 +17742,7 @@ { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } { \if_int_compare:w \l__regex_internal_a_int > \l__regex_internal_b_int - \__msg_kernel_error:nnxx { regex } { backwards-quantifier } + \__msg_kernel_error:nnxx { kernel } { backwards-quantifier } { \int_use:N \l__regex_internal_a_int } { \int_use:N \l__regex_internal_b_int } \int_zero:N \l__regex_internal_b_int @@ -17614,7 +17765,7 @@ } \cs_new_protected:Npn \__regex_compile_raw_error:N #1 { - \__msg_kernel_error:nnx { regex } { bad-escape } {#1} + \__msg_kernel_error:nnx { kernel } { bad-escape } {#1} \__regex_compile_raw:N #1 } \cs_new_protected:Npn \__regex_compile_raw:N #1#2#3 @@ -17656,7 +17807,7 @@ \__regex_if_end_range:NNTF #2 #3 { \if_int_compare:w `#1 > `#3 \exp_stop_f: - \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} + \__msg_kernel_error:nnxx { kernel } { range-backwards } {#1} {#3} \else: \__tl_build_one:x { @@ -17670,7 +17821,7 @@ \fi: } { - \__msg_kernel_warning:nnxx { regex } { range-missing-end } + \__msg_kernel_warning:nnxx { kernel } { range-missing-end } {#1} { \c_backslash_str #3 } \__tl_build_one:x { @@ -17688,7 +17839,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: + \if_int_compare:w \l__regex_curr_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -17822,8 +17973,8 @@ \str_case:nn { #2 } { : { \__regex_compile_class_posix:NNNNw } - = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } - . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } + = { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { = } } + . { \__msg_kernel_warning:nnx { kernel } { posix-unsupported } { . } } } } \__regex_compile_raw:N [ #1 #2 @@ -17862,7 +18013,7 @@ } } { - \__msg_kernel_warning:nnx { regex } { posix-unknown } + \__msg_kernel_warning:nnx { kernel } { posix-unknown } { \l__regex_internal_a_tl } \__regex_compile_abort_tokens:x { @@ -17872,7 +18023,7 @@ } } { - \__msg_kernel_error:nnxx { regex } { posix-missing-close } + \__msg_kernel_error:nnxx { kernel } { posix-missing-close } { [: \l__regex_internal_a_tl } { #2 #4 } \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl } #1 #2 #3 #4 @@ -17896,7 +18047,7 @@ \__tl_build_one:o \l__regex_internal_regex \exp_after:wN \__regex_compile_quantifier:w \else: - \__msg_kernel_warning:nn { regex } { extra-rparen } + \__msg_kernel_warning:nn { kernel } { extra-rparen } \exp_after:wN \__regex_compile_raw:N \exp_after:wN ) \fi: } @@ -17912,7 +18063,7 @@ \cs_if_exist_use:cF { __regex_compile_special_group_\token_to_str:N #4 :w } { - \__msg_kernel_warning:nnx { regex } { special-group-unknown } + \__msg_kernel_warning:nnx { kernel } { special-group-unknown } { (? #4 } \__regex_compile_group_begin:N \__regex_group:nnnN \__regex_compile_raw:N ? #3 #4 @@ -17948,7 +18099,7 @@ \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseless_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?i #2 } \__regex_compile_raw:N ( \__regex_compile_raw:N ? \__regex_compile_raw:N i @@ -17964,7 +18115,7 @@ \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } } { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } + \__msg_kernel_warning:nnx { kernel } { unknown-option } { (?-#2#4 } \__regex_compile_raw:N ( \__regex_compile_raw:N ? \__regex_compile_raw:N - @@ -17986,14 +18137,27 @@ \else: \c__regex_catcode_in_class_mode_int \fi: + \token_if_eq_charcode:NNT C #2 { \__regex_compile_c_C:NN } } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } { - \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-category } {#2} #1 #2 } } +\cs_new_protected:Npn \__regex_compile_c_C:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N + { + \token_if_eq_charcode:NNTF #2 . + { \use_none:n } + { \token_if_eq_charcode:NNF #2 ( } % ) + } + { \use:n } + { \__msg_kernel_error:nnn { kernel } { c-C-invalid } {#2} } + #1 #2 + } \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int @@ -18030,7 +18194,7 @@ { \__regex_compile_c_lbrack_end: } } { - \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} + \__msg_kernel_error:nnx { kernel } { c-missing-rbrack } {#2} \__regex_compile_c_lbrack_end: #1 #2 } @@ -18132,7 +18296,7 @@ \__regex_compile_u_loop:NN } { - \__msg_kernel_error:nn { regex } { u-missing-lbrace } + \__msg_kernel_error:nn { kernel } { u-missing-lbrace } \__regex_compile_raw:N u #1 #2 } } @@ -18150,7 +18314,7 @@ } { \if_false: { \fi: } - \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} + \__msg_kernel_error:nnx { kernel } { u-missing-rbrace } {#2} \__regex_compile_u_end: #1 #2 } @@ -18395,7 +18559,7 @@ \__regex_pop_lr_states: \__regex_toks_put_right:Nn \l__regex_right_state_int { - \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int + \if_int_compare:w \l__regex_curr_pos_int = \l__regex_max_pos_int \exp_after:wN \__regex_action_success: \fi: } @@ -18676,14 +18840,14 @@ } \cs_new_protected:Npn \__regex_anchor:N #1 { - \if_int_compare:w #1 = \l__regex_current_pos_int + \if_int_compare:w #1 = \l__regex_curr_pos_int \exp_after:wN \__regex_break_true:w \fi: } \cs_new_protected:Npn \__regex_b_test: { \group_begin: - \int_set_eq:NN \l__regex_current_char_int \l__regex_last_char_int + \int_set_eq:NN \l__regex_curr_char_int \l__regex_last_char_int \__regex_prop_w: \__regex_break_point:TF { \group_end: \__regex_item_reverse:n \__regex_prop_w: } @@ -18703,15 +18867,15 @@ } \int_new:N \l__regex_min_pos_int \int_new:N \l__regex_max_pos_int -\int_new:N \l__regex_current_pos_int +\int_new:N \l__regex_curr_pos_int \int_new:N \l__regex_start_pos_int \int_new:N \l__regex_success_pos_int -\int_new:N \l__regex_current_char_int -\int_new:N \l__regex_current_catcode_int +\int_new:N \l__regex_curr_char_int +\int_new:N \l__regex_curr_catcode_int \int_new:N \l__regex_last_char_int \int_new:N \l__regex_case_changed_char_int -\int_new:N \l__regex_current_state_int -\prop_new:N \l__regex_current_submatches_prop +\int_new:N \l__regex_curr_state_int +\prop_new:N \l__regex_curr_submatches_prop \prop_new:N \l__regex_success_submatches_prop \int_new:N \l__regex_step_int \int_new:N \l__regex_min_active_int @@ -18728,12 +18892,12 @@ \cs_new_protected:Npn \__regex_match:n #1 { \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } + \int_set:Nn \l__regex_curr_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 + \int_set_eq:NN \l__regex_min_pos_int \l__regex_curr_pos_int \__tl_analysis_map_inline:nn {#1} { \__regex_query_set:nnn {##1} {"##2} {##3} } - \int_set_eq:NN \l__regex_max_pos_int \l__regex_current_pos_int + \int_set_eq:NN \l__regex_max_pos_int \l__regex_curr_pos_int \__regex_query_set:nnn { } { -1 } { -2 } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn @@ -18752,16 +18916,16 @@ { \if_meaning:w \c_true_bool \l__regex_empty_success_bool \cs_set:Npn \__regex_if_two_empty_matches:F - { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_current_pos_int } + { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_curr_pos_int } \else: \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n \fi: \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int \bool_set_false:N \l__regex_match_success_bool - \prop_clear:N \l__regex_current_submatches_prop + \prop_clear:N \l__regex_curr_submatches_prop \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 + \int_set:Nn \l__regex_curr_pos_int { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: @@ -18786,8 +18950,8 @@ \cs_new_protected:Npn \__regex_match_loop: { \int_add:Nn \l__regex_step_int { 2 } - \int_incr:N \l__regex_current_pos_int - \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int + \int_incr:N \l__regex_curr_pos_int + \int_set_eq:NN \l__regex_last_char_int \l__regex_curr_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int \__regex_query_get: \use:x @@ -18802,7 +18966,7 @@ \__prg_break_point: \bool_set_false:N \l__regex_fresh_thread_bool %^^A was arg of break_point:n \if_int_compare:w \l__regex_max_active_int > \l__regex_min_active_int - \if_int_compare:w \l__regex_current_pos_int < \l__regex_max_pos_int + \if_int_compare:w \l__regex_curr_pos_int < \l__regex_max_pos_int \exp_after:wN \exp_after:wN \exp_after:wN \__regex_match_loop: \fi: \fi: @@ -18816,13 +18980,13 @@ \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 { \__intarray_gset_fast:Nnn \g__regex_charcode_intarray - { \l__regex_current_pos_int } {#3} + { \l__regex_curr_pos_int } {#3} \__intarray_gset_fast:Nnn \g__regex_catcode_intarray - { \l__regex_current_pos_int } {#2} + { \l__regex_curr_pos_int } {#2} \__intarray_gset_fast:Nnn \g__regex_balance_intarray - { \l__regex_current_pos_int } { \l__regex_balance_int } - \__regex_toks_set:Nn \l__regex_current_pos_int {#1} - \int_incr:N \l__regex_current_pos_int + { \l__regex_curr_pos_int } { \l__regex_balance_int } + \__regex_toks_set:Nn \l__regex_curr_pos_int {#1} + \int_incr:N \l__regex_curr_pos_int \if_case:w #2 \exp_stop_f: \or: \int_incr:N \l__regex_balance_int \or: \int_decr:N \l__regex_balance_int @@ -18830,29 +18994,29 @@ } \cs_new_protected:Npn \__regex_query_get: { - \l__regex_current_char_int + \l__regex_curr_char_int = \__intarray_item_fast:Nn \g__regex_charcode_intarray - { \l__regex_current_pos_int } \scan_stop: - \l__regex_current_catcode_int + { \l__regex_curr_pos_int } \scan_stop: + \l__regex_curr_catcode_int = \__intarray_item_fast:Nn \g__regex_catcode_intarray - { \l__regex_current_pos_int } \scan_stop: + { \l__regex_curr_pos_int } \scan_stop: } \cs_new_protected:Npn \__regex_use_state: { \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int } - \__regex_toks_use:w \l__regex_current_state_int + { \l__regex_curr_state_int } { \l__regex_step_int } + \__regex_toks_use:w \l__regex_curr_state_int \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int + 1 } + { \l__regex_curr_state_int } { \l__regex_step_int + 1 } } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { - \int_set:Nn \l__regex_current_state_int {#1} + \int_set:Nn \l__regex_curr_state_int {#1} \if_int_compare:w \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } + { \l__regex_curr_state_int } < \l__regex_step_int - \tl_set:Nn \l__regex_current_submatches_prop {#2} + \tl_set:Nn \l__regex_curr_submatches_prop {#2} \exp_after:wN \__regex_use_state: \fi: \scan_stop: @@ -18872,26 +19036,26 @@ { \use:x { - \int_add:Nn \l__regex_current_state_int {#2} + \int_add:Nn \l__regex_curr_state_int {#2} \exp_not:n { \if_int_compare:w \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } + { \l__regex_curr_state_int } #1 \exp_after:wN \__regex_use_state: \fi: } - \int_set:Nn \l__regex_current_state_int - { \int_use:N \l__regex_current_state_int } - \tl_set:Nn \exp_not:N \l__regex_current_submatches_prop - { \exp_not:o \l__regex_current_submatches_prop } + \int_set:Nn \l__regex_curr_state_int + { \int_use:N \l__regex_curr_state_int } + \tl_set:Nn \exp_not:N \l__regex_curr_submatches_prop + { \exp_not:o \l__regex_curr_submatches_prop } } } \cs_new_protected:Npn \__regex_action_cost:n #1 { \exp_args:No \__regex_store_state:n - { \__int_value:w \__int_eval:w \l__regex_current_state_int + #1 } + { \__int_value:w \__int_eval:w \l__regex_curr_state_int + #1 } } \cs_new_protected:Npn \__regex_store_state:n #1 { @@ -18903,7 +19067,7 @@ \cs_new_protected:Npn \__regex_store_submatches: { \__regex_toks_set:No \l__regex_max_active_int - { \l__regex_current_submatches_prop } + { \l__regex_curr_submatches_prop } } \cs_new_protected:Npn \__regex_disable_submatches: { @@ -18912,8 +19076,8 @@ } \cs_new_protected:Npn \__regex_action_submatch:n #1 { - \prop_put:Nno \l__regex_current_submatches_prop {#1} - { \int_use:N \l__regex_current_pos_int } + \prop_put:Nno \l__regex_curr_submatches_prop {#1} + { \int_use:N \l__regex_curr_pos_int } } \cs_new_protected:Npn \__regex_action_success: { @@ -18922,9 +19086,9 @@ \bool_set_true:N \l__regex_match_success_bool \bool_set_eq:NN \l__regex_empty_success_bool \l__regex_fresh_thread_bool - \int_set_eq:NN \l__regex_success_pos_int \l__regex_current_pos_int + \int_set_eq:NN \l__regex_success_pos_int \l__regex_curr_pos_int \prop_set_eq:NN \l__regex_success_submatches_prop - \l__regex_current_submatches_prop + \l__regex_curr_submatches_prop \__prg_break: } } @@ -19003,14 +19167,14 @@ {#1} \prg_do_nothing: \prg_do_nothing: \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: } \fi: \seq_if_empty:NF \l__regex_replacement_category_seq { - \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } + \__msg_kernel_error:nnx { kernel } { replacement-missing-rparen } { \seq_count:N \l__regex_replacement_category_seq } \seq_clear:N \l__regex_replacement_category_seq } @@ -19145,12 +19309,12 @@ \cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3 { \token_if_eq_meaning:NNTF \prg_do_nothing: #3 - { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } + { \__msg_kernel_error:nn { kernel } { replacement-catcode-end } } { \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0 { \__msg_kernel_error:nnnn - { regex } { replacement-catcode-in-cs } {#1} {#3} + { kernel } { replacement-catcode-in-cs } {#1} {#3} #2 #3 } { @@ -19160,7 +19324,19 @@ \l__regex_replacement_category_tl \tl_set:Nn \l__regex_replacement_category_tl {#1} } - { \use:c { __regex_replacement_c_#1:w } #2 #3 } + { + \token_if_eq_meaning:NNT #2 \__regex_replacement_escaped:N + { + \__regex_char_if_alphanumeric:NTF #3 + { + \__msg_kernel_error:nnnn + { kernel } { replacement-catcode-escaped } + {#1} {#3} + } + { } + } + \use:c { __regex_replacement_c_#1:w } #2 #3 + } } } } @@ -19214,7 +19390,7 @@ \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 { \if_int_compare:w `#2 = 0 \exp_stop_f: - \__msg_kernel_error:nn { regex } { replacement-null-space } + \__msg_kernel_error:nn { kernel } { replacement-null-space } \fi: \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } @@ -19228,7 +19404,7 @@ \group_end: \cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3 { - \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} + \__msg_kernel_error:nnx { kernel } { replacement-#1 } {#3} #2 #3 } \cs_new_protected:Npn \regex_new:N #1 @@ -19399,7 +19575,7 @@ { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } = 0 { - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { splitting~or~extracting~submatches } { \flag_height:n { __regex_end } } { \flag_height:n { __regex_begin } } @@ -19522,7 +19698,7 @@ { \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + \__msg_kernel_error:nnxxx { kernel } { result-unbalanced } { replacing } { \int_max:nn { - \l__regex_balance_int } { 0 } } { \int_max:nn { \l__regex_balance_int } { 0 } } @@ -19544,20 +19720,20 @@ } } } -\__msg_kernel_new:nnnn { regex } { trailing-backslash } +\__msg_kernel_new:nnnn { kernel } { trailing-backslash } { Trailing~escape~character~'\iow_char:N\\'. } { A~regular~expression~or~its~replacement~text~ends~with~ the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { x-missing-rbrace } { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ '\iow_char:N\\x\{...#1'.~ The~closing~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { x-overflow } +\__msg_kernel_new:nnnn { kernel } { x-overflow } { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } { You~wrote~something~like~ @@ -19565,20 +19741,20 @@ The~character~code~#1~is~larger~than~ the~maximum~value~\int_use:N \c_max_char_int. } -\__msg_kernel_new:nnnn { regex } { invalid-quantifier } +\__msg_kernel_new:nnnn { kernel } { invalid-quantifier } { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } { The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~ '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'. } -\__msg_kernel_new:nnnn { regex } { missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { missing-rbrack } { Missing~right~bracket~inserted~in~regular~expression. } { LaTeX~was~given~a~regular~expression~where~a~character~class~ was~started~with~'[',~but~the~matching~']'~is~missing. } -\__msg_kernel_new:nnnn { regex } { missing-rparen } +\__msg_kernel_new:nnnn { kernel } { missing-rparen } { Missing~right~ \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ @@ -19588,13 +19764,13 @@ LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ more~left~parentheses~than~right~parentheses. } -\__msg_kernel_new:nnnn { regex } { extra-rparen } +\__msg_kernel_new:nnnn { kernel } { extra-rparen } { Extra~right~parenthesis~ignored~in~regular~expression. } { LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ was~open.~The~parenthesis~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { bad-escape } +\__msg_kernel_new:nnnn { kernel } { bad-escape } { Invalid~escape~'\iow_char:N\\#1'~ \__regex_if_in_cs:TF { within~a~control~sequence. } @@ -19618,14 +19794,14 @@ because~it~does~not~match~exactly~one~character. } } -\__msg_kernel_new:nnnn { regex } { range-missing-end } +\__msg_kernel_new:nnnn { kernel } { range-missing-end } { Invalid~end-point~for~range~'#1-#2'~in~character~class. } { The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ end-point~for~a~range:~alphanumeric~characters~should~not~be~ escaped,~and~non-alphanumeric~characters~should~be~escaped. } -\__msg_kernel_new:nnnn { regex } { range-backwards } +\__msg_kernel_new:nnnn { kernel } { range-backwards } { Range~'[#1-#2]'~out~of~order~in~character~class. } { In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ @@ -19633,27 +19809,34 @@ Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~ '#2'~has~character~code~\int_eval:n {`#2}. } -\__msg_kernel_new:nnnn { regex } { c-bad-mode } +\__msg_kernel_new:nnnn { kernel } { c-bad-mode } { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } { The~'\iow_char:N\\c'~escape~cannot~be~used~within~ a~control~sequence~test~'\iow_char:N\\c{...}'.~ To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { c-C-invalid } + { '\iow_char:N\\cC'~should~be~followed~by~'.'~or~'(',~not~'#1'. } + { + The~'\iow_char:N\\cC'~construction~restricts~the~next~item~to~be~a~ + control~sequence~or~the~next~group~to~be~made~of~control~sequences.~ + It~only~makes~sense~to~follow~it~by~'.'~or~by~a~group. + } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } { LaTeX~was~given~a~regular~expression~where~a~ '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ with~a~closing~brace~'\iow_char:N\}'. } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } +\__msg_kernel_new:nnnn { kernel } { c-missing-rbrack } { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } { A~construction~'\iow_char:N\\c[...'~appears~in~a~ regular~expression,~but~the~closing~']'~is~not~present. } -\__msg_kernel_new:nnnn { regex } { c-missing-category } +\__msg_kernel_new:nnnn { kernel } { c-missing-category } { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } { In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ @@ -19661,19 +19844,19 @@ capital~letter~representing~a~character~category,~namely~ one~of~'ABCDELMOPSTU'. } -\__msg_kernel_new:nnnn { regex } { c-trailing } +\__msg_kernel_new:nnnn { kernel } { c-trailing } { Trailing~category~code~escape~'\iow_char:N\\c'... } { A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ by~a~letter.~It~will~be~ignored. } -\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-lbrace } { Missing~left~brace~following~'\iow_char:N\\u'~escape. } { The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ a~brace~group~with~the~name~of~the~variable~to~use. } -\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { u-missing-rbrace } { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } { LaTeX~ @@ -19682,14 +19865,14 @@ { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ } when~parsing~the~argument~of~an~'\iow_char:N\\u\iow_char:N\{...\}'~escape. } -\__msg_kernel_new:nnnn { regex } { posix-unsupported } +\__msg_kernel_new:nnnn { kernel } { posix-unsupported } { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } { The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? } -\__msg_kernel_new:nnnn { regex } { posix-unknown } +\__msg_kernel_new:nnnn { kernel } { posix-unknown } { POSIX~class~'[:#1:]'~unknown. } { '[:#1:]'~is~not~among~the~known~POSIX~classes~ @@ -19698,10 +19881,10 @@ '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ '[:word:]',~and~'[:xdigit:]'. } -\__msg_kernel_new:nnnn { regex } { posix-missing-close } +\__msg_kernel_new:nnnn { kernel } { posix-missing-close } { Missing~closing~':]'~for~POSIX~class. } { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } -\__msg_kernel_new:nnnn { regex } { result-unbalanced } +\__msg_kernel_new:nnnn { kernel } { result-unbalanced } { Missing~brace~inserted~when~#1. } { LaTeX~was~asked~to~do~some~regular~expression~operation,~ @@ -19709,33 +19892,33 @@ of~begin-group~and~end-group~tokens.~Braces~were~inserted:~ #2~left,~#3~right. } -\__msg_kernel_new:nnnn { regex } { unknown-option } +\__msg_kernel_new:nnnn { kernel } { unknown-option } { Unknown~option~'#1'~for~regular~expressions. } { The~only~available~option~is~'case-insensitive',~toggled~by~ '(?i)'~and~'(?-i)'. } -\__msg_kernel_new:nnnn { regex } { special-group-unknown } +\__msg_kernel_new:nnnn { kernel } { special-group-unknown } { Unknown~special~group~'#1~...'~in~a~regular~expression. } { The~only~valid~constructions~starting~with~'(?'~are~ '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'. } -\__msg_kernel_new:nnnn { regex } { replacement-c } +\__msg_kernel_new:nnnn { kernel } { replacement-c } { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ or~a~brace~group,~not~by~'#1'. } -\__msg_kernel_new:nnnn { regex } { replacement-u } +\__msg_kernel_new:nnnn { kernel } { replacement-u } { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } { In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ must~be~~followed~by~a~brace~group~holding~the~name~of~the~ variable~to~use. } -\__msg_kernel_new:nnnn { regex } { replacement-g } +\__msg_kernel_new:nnnn { kernel } { replacement-g } { Missing~brace~for~the~'\iow_char:N\\g'~construction~ in~a~replacement~text. @@ -19745,7 +19928,7 @@ submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-end } { Missing~character~for~the~'\iow_char:N\\c<category><character>'~ construction~in~a~replacement~text. @@ -19756,7 +19939,17 @@ the~character~category.~Then,~a~character~must~follow.~LaTeX~ reached~the~end~of~the~replacement~when~looking~for~that. } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-escaped } + { + Escaped~letter~or~digit~after~category~code~in~replacement~text. + } + { + In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ + can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ + the~character~category.~Then,~a~character~must~follow,~not~ + '\iow_char:N\\#2'. + } +\__msg_kernel_new:nnnn { kernel } { replacement-catcode-in-cs } { Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ '\iow_char:N\\c\{...\}'~in~a~replacement~text. @@ -19766,7 +19959,7 @@ '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ sequence~name. } -\__msg_kernel_new:nnnn { regex } { replacement-null-space } +\__msg_kernel_new:nnnn { kernel } { replacement-null-space } { TeX~cannot~build~a~space~token~with~character~code~0. } { You~asked~for~a~character~token~with~category~space,~ @@ -19775,13 +19968,13 @@ This~specific~case~is~impossible~and~will~be~replaced~ by~a~normal~space. } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rbrace } { Missing~right~brace~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } +\__msg_kernel_new:nnnn { kernel } { replacement-missing-rparen } { Missing~right~parenthesis~inserted~in~replacement~text. } { There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ @@ -19965,6 +20158,16 @@ \c_group_end_token } \cs_new_eq:NN \hbox_gset_end: \hbox_set_end: +\cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2 + { + \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \hbox_gset_to_wd:Nnw + { \tex_global:D \hbox_set_to_wd:Nnw } +\cs_generate_variant:Nn \hbox_set_to_wd:Nnw { c } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnw { c } \cs_new_protected:Npn \hbox_to_wd:nn #1#2 { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: @@ -20037,6 +20240,16 @@ \c_group_end_token } \cs_new_eq:NN \vbox_gset_end: \vbox_set_end: +\cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2 + { + \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: + \c_group_begin_token + \group_begin: + } +\cs_new_protected:Npn \vbox_gset_to_ht:Nnw + { \tex_global:D \vbox_set_to_ht:Nnw } +\cs_generate_variant:Nn \vbox_set_to_ht:Nnw { c } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnw { c } \cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D \cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D \cs_generate_variant:Nn \vbox_unpack:N { c } @@ -20411,14 +20624,14 @@ \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 - \__chk_suspend_log: + \__debug_suspend_log: \prop_clear_new:c { l__coffin_corners_ \__int_value:w #1 _prop } \prop_clear_new:c { l__coffin_poles_ \__int_value:w #1 _prop } \prop_gset_eq:cN { l__coffin_corners_ \__int_value:w #1 _prop } \c__coffin_corners_prop \prop_gset_eq:cN { l__coffin_poles_ \__int_value:w #1 _prop } \c__coffin_poles_prop - \__chk_resume_log: + \__debug_resume_log: } \cs_generate_variant:Nn \coffin_new:N { c } \cs_new_protected:Npn \hcoffin_set:Nn #1#2 @@ -20898,7 +21111,7 @@ } \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \hbox_unpack:N \c_empty_box + \mode_leave_vertical: \__coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } #1 {#2} {#3} {#4} {#5} \l__coffin_aligned_coffin \box_use:N \l__coffin_aligned_coffin @@ -21151,7 +21364,12 @@ \group_end: } \cs_new_protected:Npn \color_ensure_current: - { \__driver_color_ensure_current: } + { + \__driver_color_ensure_current: + \group_insert_after:N \__driver_color_reset: + } +\tl_new:N \l__color_current_tl +\tl_set:Nn \l__color_current_tl { gray~0 } %% File: l3sys.dtx Copyright (C) 2015-2017 The LaTeX3 Project \str_const:Nx \c_sys_jobname_str { \tex_jobname:D } \int_const:Nn \c_sys_minute_int @@ -21290,10 +21508,34 @@ \__deprecation_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } \__deprecation_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } \__deprecation_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } + \__deprecation_error:Nnn \g_file_current_name_tl { \g_file_curr_name_str } { 2018-12-31 } + \__deprecation_error:Nnn \file_add_path:nN { \file_get_full_name:nN } { 2018-12-31 } + \__deprecation_error:Nnn \file_path_include:n + { \seq_put_right:Nn \l_file_search_path_seq } { 2018-12-31 } + \__deprecation_error:Nnn \file_path_remove:n + { \seq_remove_all:Nn \l_file_search_path_seq } { 2018-12-31 } + \__deprecation_error:Nnn \file_list: { \file_log_list: } { 2018-12-31 } + \__deprecation_error:Nnn \ior_list_streams: { \ior_show_list: } { 2018-12-31 } + \__deprecation_error:Nnn \ior_log_streams: { \ior_log_list: } { 2018-12-31 } + \__deprecation_error:Nnn \iow_list_streams: { \iow_show_list: } { 2018-12-31 } + \__deprecation_error:Nnn \iow_log_streams: { \iow_log_list: } { 2018-12-31 } \cs_set_eq:NN \__fp_parse_round:Nw \__fp_parse_round_deprecation_error:Nw \cs_set_eq:NN \deprecation_error: \scan_stop: } %% File: l3candidates.dtx Copyright (C) 2012-2017 The LaTeX3 Project +\cs_new_protected:Npx \mode_leave_vertical: + { + \cs_if_exist:NTF \pdftex_quitvmode:D + { \pdftex_quitvmode:D } + { + \exp_not:n + { + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: + } + } + } \cs_new_protected:Npn \box_clip:N #1 { \hbox_set:Nn #1 { \__driver_box_use_clip:N #1 } } \cs_generate_variant:Nn \box_clip:N { c } @@ -21632,36 +21874,96 @@ {#5} {#6} } } +\cs_new_protected:Npn \file_get_mdfive_hash:nN #1#2 + { \__file_get_details:nnN {#1} { mdfivesum } {#2} } +\cs_new_protected:Npn \file_get_size:nN #1#2 + { \__file_get_details:nnN {#1} { size } {#2} } +\cs_new_protected:Npn \file_get_timestamp:nN #1#2 + { \__file_get_details:nnN {#1} { moddate } {#2} } +\cs_new_protected:Npn \__file_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_set:Nx #3 + { + \use:c { pdftex_file #2 :D } \exp_after:wN + { \l__file_full_name_str } + } + } +\cs_if_exist:NTF \luatex_directlua:D + { + \cs_set_protected:Npn \__file_get_details:nnN #1#2#3 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_set:Nx #3 + { + \lua_now_x:n + { + l3kernel.file#2 + ( " \lua_escape_x:n { \l__file_full_name_str } " ) + } + } + } + } + { + \cs_set_protected:Npn \file_get_mdfive_hash:nN #1#2 + { + \file_get_full_name:nN {#1} \l__file_full_name_str + \tl_set:Nx #2 + { + \pdftex_mdfivesum:D file \exp_after:wN + { \l__file_full_name_str } + } + } + \cs_if_exist:NT \xetex_XeTeXversion:D + { + \cs_set_protected:Npn \__file_get_details:nnN #1#2#3 + { + \tl_clear:N #3 + \__msg_kernel_error:nnx + { kernel } { xetex-primitive-not-available } + { \exp_not:c { pdffile #2 } } + } + } + } +\__msg_kernel_new:nnnn { kernel } { xetex-primitive-not-available } + { Primitive~\token_to_str:N #1 not~available } + { + XeTeX~does~not~currently~provide~functionality~equivalent~to~the~ + \token_to_str:N #1 primitive. + } \cs_new_protected:Npn \file_if_exist_input:n #1 { - \file_if_exist:nT {#1} - { \__file_input:V \l__file_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str + { \__file_input:V \l__file_full_name_str } } \cs_new_protected:Npn \file_if_exist_input:nT #1#2 { - \file_if_exist:nT {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NF \l__file_full_name_str { #2 - \__file_input:V \l__file_internal_name_tl + \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nF #1 +\cs_new_protected:Npn \file_if_exist_input:nF #1#2 { - \file_if_exist:nTF {#1} - { \__file_input:V \l__file_internal_name_tl } + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#2} + { \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \file_if_exist_input:nTF #1#2 +\cs_new_protected:Npn \file_if_exist_input:nTF #1#2#3 { - \file_if_exist:nTF {#1} + \file_get_full_name:nN {#1} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + {#3} { #2 - \__file_input:V \l__file_internal_name_tl + \__file_input:V \l__file_full_name_str } } -\cs_new_protected:Npn \ior_log_streams: - { \__msg_log_next: \ior_list_streams: } -\cs_new_protected:Npn \iow_log_streams: - { \__msg_log_next: \iow_list_streams: } +\cs_new_protected:Npn \file_input_stop: { \tex_endinput:D } \cs_if_exist:NTF \pdftex_uniformdeviate:D { \cs_new:Npn \int_rand:nn #1#2 @@ -21998,7 +22300,9 @@ \cs_generate_variant:Nn \tl_gset_from_file:Nnn { c } \cs_new_protected:Npn \__tl_set_from_file:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \exp_args:No \etex_everyeof:D @@ -22006,7 +22310,7 @@ #3 \scan_stop: \exp_after:wN \__tl_from_file_do:w \exp_after:wN \prg_do_nothing: - \tex_input:D \l__file_internal_name_tl \scan_stop: + \tex_input:D \l__file_full_name_str \scan_stop: \exp_args:NNNo \group_end: #1 #2 \l__tl_internal_a_tl } @@ -22023,13 +22327,15 @@ \cs_generate_variant:Nn \tl_gset_from_file_x:Nnn { c } \cs_new_protected:Npn \__tl_set_from_file_x:NNnn #1#2#3#4 { - \__file_if_exist:nT {#4} + \file_get_full_name:nN {#4} \l__file_full_name_str + \str_if_empty:NTF \l__file_full_name_str + { \__file_missing:n {#4} } { \group_begin: \etex_everyeof:D { \exp_not:N } #3 \scan_stop: \tl_set:Nx \l__tl_internal_a_tl - { \tex_input:D \l__file_internal_name_tl \c_space_token } + { \tex_input:D \l__file_full_name_str \c_space_token } \exp_args:NNNo \group_end: #1 #2 \l__tl_internal_a_tl } @@ -22037,10 +22343,10 @@ \cs_generate_variant:Nn \tl_if_head_eq_catcode:nNTF { o } \cs_new:Npn \tl_lower_case:n { \__tl_change_case:nnn { lower } { } } \cs_new:Npn \tl_upper_case:n { \__tl_change_case:nnn { upper } { } } -\cs_new:Npn \tl_mixed_case:n { \__tl_mixed_case:nn { } } +\cs_new:Npn \tl_mixed_case:n { \__tl_change_case:nnn { mixed } { } } \cs_new:Npn \tl_lower_case:nn { \__tl_change_case:nnn { lower } } \cs_new:Npn \tl_upper_case:nn { \__tl_change_case:nnn { upper } } -\cs_new:Npn \tl_mixed_case:nn { \__tl_mixed_case:nn } +\cs_new:Npn \tl_mixed_case:nn { \__tl_change_case:nnn { mixed } } \cs_new:Npn \__tl_change_case:nnn #1#2#3 { \etex_unexpanded:D \exp_after:wN @@ -22078,6 +22384,10 @@ } \cs_new:Npn \__tl_change_case_group:nwnn #1#2 \q_recursion_stop #3#4 { + \use:c { __tl_change_case_group_ #3 : nnnn } {#1} {#2} {#3} {#4} + } +\cs_new:Npn \__tl_change_case_group_lower:nnnn #1#2#3#4 + { \__tl_change_case_output:own { \exp_after:wN @@ -22088,6 +22398,20 @@ } \__tl_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } +\cs_new_eq:NN \__tl_change_case_group_upper:nnnn + \__tl_change_case_group_lower:nnnn +\cs_new:Npn \__tl_change_case_group_mixed:nnnn #1#2#3#4 + { + \__tl_change_case_output:own + { + \exp_after:wN + { + \exp:w + \__tl_change_case_aux:nnn {#3} {#4} {#1} + } + } + \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#4} + } \exp_last_unbraced:NNo \cs_new:Npn \__tl_change_case_space:wnn \c_space_tl { \__tl_change_case_output:nwn { ~ } @@ -22156,11 +22480,11 @@ \cs_new:Npn \__tl_change_case_N_type:Nnnn #1#2#3#4 { \token_if_cs:NTF #1 - { \__tl_change_case_cs_letterlike:Nnn #1 {#3} { } } - { \__tl_change_case_char:Nnn #1 {#3} {#4} } + { \__tl_change_case_cs_letterlike:Nn #1 {#3} } + { \use:c { __tl_change_case_char_ #3 :Nnn } #1 {#3} {#4} } \__tl_change_case_loop:wnn #2 \q_recursion_stop {#3} {#4} } -\cs_new:Npn \__tl_change_case_char:Nnn #1#2#3 +\cs_new:Npn \__tl_change_case_char_lower:Nnn #1#2#3 { \cs_if_exist_use:cF { __tl_change_case_ #2 _ #3 :Nnw } { \use_ii:nn } @@ -22170,6 +22494,19 @@ { \__tl_change_case_char:nN {#2} #1 } } } +\cs_new_eq:NN \__tl_change_case_char_upper:Nnn + \__tl_change_case_char_lower:Nnn +\cs_new:Npn \__tl_change_case_char_mixed:Nnn #1#2#3 + { + \__tl_change_case_mixed_switch:w + \cs_if_exist_use:cF { __tl_change_case_mixed_ #3 :Nnw } + { + \cs_if_exist_use:cF { __tl_change_case_upper_ #3 :Nnw } + { \use_ii:nn } + } + #1 + { \__tl_change_case_mixed_skip:N #1 } + } \cs_if_exist:NTF \utex_char:D { \cs_new:Npn \__tl_change_case_char:nN #1#2 @@ -22192,13 +22529,32 @@ } } \cs_new:Npn \__tl_change_case_char_auxi:nN #1#2 + { \use:c { __tl_change_case_char_ #1 :N } #2 } +\cs_new:Npn \__tl_change_case_char_lower:N #1 + { + \__tl_change_case_output:fwn + { + \cs_if_exist_use:cF { c__unicode_lower_ \token_to_str:N #1 _tl } + { \__tl_change_case_char_auxii:nN { lower } #1 } + } + } +\cs_new:Npn \__tl_change_case_char_upper:N #1 { \__tl_change_case_output:fwn { - \cs_if_exist_use:cF { c__unicode_ #1 _ \token_to_str:N #2 _tl } - { \__tl_change_case_char_auxii:nN {#1} #2 } + \cs_if_exist_use:cF { c__unicode_upper_ \token_to_str:N #1 _tl } + { \__tl_change_case_char_auxii:nN { upper } #1 } } } +\cs_new:Npn \__tl_change_case_char_mixed:N #1 + { + \cs_if_exist:cTF { c__unicode_mixed_ \token_to_str:N #1 _tl } + { + \__tl_change_case_output:fwn + { \tl_use:c { c__unicode_mixed_ \token_to_str:N #1 _tl } } + } + { \__tl_change_case_char_upper:N #1 } + } \cs_if_exist:NTF \utex_char:D { \cs_new:Npn \__tl_change_case_char_auxii:nN #1#2 @@ -22213,7 +22569,7 @@ } \cs_new_protected:Npn \__tl_lookup_lower:N #1 { \tex_lccode:D `#1 } \cs_new_protected:Npn \__tl_lookup_upper:N #1 { \tex_uccode:D `#1 } - \cs_new_eq:NN \__tl_lookup_title:N \__tl_lookup_upper:N + \cs_new_eq:NN \__tl_lookup_mixed:N \__tl_lookup_upper:N } { \cs_new:Npn \__tl_change_case_char_auxii:nN #1#2 { \exp_stop_f: #2 } @@ -22234,7 +22590,16 @@ #3 } } -\cs_new:Npn \__tl_change_case_cs_letterlike:Nnn #1#2#3 +\cs_new:Npn \__tl_change_case_cs_letterlike:Nn #1#2 + { + \str_if_eq:nnTF {#2} { mixed } + { + \__tl_change_case_cs_letterlike:NnN #1 { upper } + \__tl_change_case_mixed_switch:w + } + { \__tl_change_case_cs_letterlike:NnN #1 {#2} \prg_do_nothing: } + } +\cs_new:Npn \__tl_change_case_cs_letterlike:NnN #1#2#3 { \cs_if_exist:cTF { c__tl_change_case_ #2 _ \token_to_str:N #1 _tl } { @@ -22322,6 +22687,36 @@ } \cs_new:Npn \__tl_change_case_cs_expand:NN #1#2 { \exp_after:wN #2 #1 } +\cs_new:Npn \__tl_change_case_mixed_skip:N #1 + { + \exp_after:wN \__tl_change_case_mixed_skip:NN + \exp_after:wN #1 \l_tl_mixed_case_ignore_tl + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \__tl_change_case_mixed_skip:NN #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} + { \__tl_change_case_char:nN { mixed } #1 } + \int_compare:nNnT { `#1 } = { `#2 } + { + \use_i_delimit_by_q_recursion_stop:nw + { + \__tl_change_case_output:nwn {#1} + \__tl_change_case_mixed_skip_tidy:Nwn + } + } + \__tl_change_case_mixed_skip:NN #1 + } +\cs_new:Npn \__tl_change_case_mixed_skip_tidy:Nwn #1#2 \q_recursion_stop #3 + { + \__tl_change_case_loop:wnn #2 \q_recursion_stop { mixed } + } +\cs_new:Npn \__tl_change_case_mixed_switch:w + #1 \__tl_change_case_loop:wnn #2 \q_recursion_stop #3 + { + #1 + \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } + } \cs_new:Npn \__tl_change_case_lower_sigma:Nnw #1#2#3#4 \q_recursion_stop { \int_compare:nNnTF { `#1 } = { "03A3 } @@ -22795,7 +23190,7 @@ \group_end: } \__tl_tmp:w { 00DF } { SS } { upper } - \__tl_tmp:w { 00DF } { Ss } { title } + \__tl_tmp:w { 00DF } { Ss } { mixed } \__tl_tmp:w { 0131 } { I } { upper } } \group_end: @@ -22827,129 +23222,6 @@ \tl_new:N \l_tl_case_change_accents_tl \tl_set:Nn \l_tl_case_change_accents_tl { \" \' \. \^ \` \~ \c \H \k \r \t \u \v } -\cs_new:Npn \__tl_mixed_case:nn #1#2 - { - \etex_unexpanded:D \exp_after:wN - { - \exp:w - \__tl_mixed_case_aux:nn {#1} {#2} - } - } -\cs_new:Npn \__tl_mixed_case_aux:nn #1#2 - { - \group_align_safe_begin: - \__tl_mixed_case_loop:wn - #2 \q_recursion_tail \q_recursion_stop {#1} - \__tl_change_case_result:n { } - } -\cs_new:Npn \__tl_mixed_case_loop:wn #1 \q_recursion_stop - { - \tl_if_head_is_N_type:nTF {#1} - { \__tl_mixed_case_N_type:Nwn } - { - \tl_if_head_is_group:nTF {#1} - { \__tl_mixed_case_group:nwn } - { \__tl_mixed_case_space:wn } - } - #1 \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_group:nwn #1#2 \q_recursion_stop #3 - { - \__tl_change_case_output:own - { - \exp_after:wN - { - \exp:w - \__tl_mixed_case_aux:nn {#3} {#1} - } - } - \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } -\exp_last_unbraced:NNo \cs_new:Npn \__tl_mixed_case_space:wn \c_space_tl - { - \__tl_change_case_output:nwn { ~ } - \__tl_mixed_case_loop:wn - } -\cs_new:Npn \__tl_mixed_case_N_type:Nwn #1#2 \q_recursion_stop - { - \quark_if_recursion_tail_stop_do:Nn #1 - { \__tl_change_case_end:wn } - \exp_after:wN \__tl_mixed_case_N_type:NNNnn - \exp_after:wN #1 \l_tl_case_change_math_tl - \q_recursion_tail ? \q_recursion_stop {#2} - } -\cs_new:Npn \__tl_mixed_case_N_type:NNNnn #1#2#3 - { - \quark_if_recursion_tail_stop_do:Nn #2 - { \__tl_mixed_case_N_type:Nnn #1 } - \token_if_eq_meaning:NNTF #1 #2 - { - \use_i_delimit_by_q_recursion_stop:nw - { - \__tl_change_case_math:NNNnnn - #1 #3 \__tl_mixed_case_loop:wn - } - } - { \__tl_mixed_case_N_type:NNNnn #1 } - } -\cs_new:Npn \__tl_mixed_case_N_type:Nnn #1#2#3 - { - \token_if_cs:NTF #1 - { - \__tl_change_case_cs_letterlike:Nnn #1 { upper } - { \__tl_mixed_case_letterlike:Nw } - \__tl_mixed_case_loop:wn #2 \q_recursion_stop {#3} - } - { - \__tl_mixed_case_char:Nn #1 {#3} - \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } {#3} - } - } -\cs_new:Npn \__tl_mixed_case_letterlike:Nw #1#2 \q_recursion_stop - { \__tl_change_case_loop:wnn #2 \q_recursion_stop { lower } } -\cs_new:Npn \__tl_mixed_case_char:Nn #1#2 - { - \cs_if_exist_use:cF { __tl_change_case_mixed_ #2 :Nnw } - { - \cs_if_exist_use:cF { __tl_change_case_upper_ #2 :Nnw } - { \use_ii:nn } - } - #1 - { \__tl_mixed_case_skip:N #1 } - } -\cs_new:Npn \__tl_mixed_case_skip:N #1 - { - \exp_after:wN \__tl_mixed_case_skip:NN - \exp_after:wN #1 \l_tl_mixed_case_ignore_tl - \q_recursion_tail \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_skip:NN #1#2 - { - \quark_if_recursion_tail_stop_do:nn {#2} - { \__tl_mixed_case_char:N #1 } - \int_compare:nNnT { `#1 } = { `#2 } - { - \use_i_delimit_by_q_recursion_stop:nw - { - \__tl_change_case_output:nwn {#1} - \__tl_mixed_case_skip_tidy:Nwn - } - } - \__tl_mixed_case_skip:NN #1 - } -\cs_new:Npn \__tl_mixed_case_skip_tidy:Nwn #1#2 \q_recursion_stop #3 - { - \__tl_mixed_case_loop:wn #2 \q_recursion_stop - } -\cs_new:Npn \__tl_mixed_case_char:N #1 - { - \cs_if_exist:cTF { c__unicode_title_ #1 _tl } - { - \__tl_change_case_output:fwn - { \tl_use:c { c__unicode_title_ #1 _tl } } - } - { \__tl_change_case_char:nN { upper } #1 } - } \cs_new:Npn \__tl_change_case_mixed_nl:Nnw #1 { \bool_lazy_or:nnTF |