summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def')
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def169
1 files changed, 169 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def
new file mode 100644
index 00000000000..b7e5411f1ae
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def
@@ -0,0 +1,169 @@
+%%
+%% This is file `l3str-esc-string.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% l3str-convert.dtx (with options: `string')
+%%
+%% EXPERIMENTAL CODE
+%%
+%% Do not distribute this file without also distributing the
+%% source files specified above.
+%%
+%% Do not distribute a modified version of this file.
+%%
+%% File: l3str-convert.dtx Copyright (C) 2013 The LaTeX3 Project
+%%
+%% It may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% license or (at your option) any later version. The latest version
+%% of this license is in the file
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "l3experimental bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% The released version of this bundle is available from CTAN.
+%%
+%% -----------------------------------------------------------------------
+%%
+%% The development version of the bundle can be found at
+%%
+%% http://www.latex-project.org/svnroot/experimental/trunk/
+%%
+%% for those people who are interested.
+%%
+%%%%%%%%%%%
+%% NOTE: %%
+%%%%%%%%%%%
+%%
+%% Snapshots taken from the repository represent work in progress and may
+%% not work or may contain conflicting material! We therefore ask
+%% people _not_ to put them into distributions, archives, etc. without
+%% prior consultation with the LaTeX3 Project.
+%%
+%% -----------------------------------------------------------------------
+\group_begin:
+ \char_set_lccode:nn {`\*} {`\\}
+ \char_set_catcode_other:N \^^J
+ \char_set_catcode_other:N \^^M
+ \tl_to_lowercase:n
+ {
+ \cs_new_protected_nopar:Npn \__str_convert_unescape_string:
+ {
+ \group_begin:
+ \flag_clear:n { str_byte }
+ \flag_clear:n { str_error }
+ \int_set:Nn \tex_escapechar:D { 92 }
+ \tl_gset:Nx \g__str_result_tl
+ {
+ \exp_after:wN \__str_unescape_string_newlines:wN
+ \g__str_result_tl \__prg_break: ^^M ?
+ \__prg_break_point:
+ }
+ \tl_gset:Nx \g__str_result_tl
+ {
+ \exp_after:wN \__str_unescape_string_loop:wNNN
+ \g__str_result_tl * ?? { ? \__prg_break: }
+ \__prg_break_point:
+ }
+ \__str_if_flag_error:nnx { str_byte } { non-byte } { string }
+ \__str_if_flag_error:nnx { str_error } { unescape-string } { }
+ \group_end:
+ }
+ \cs_new:Npn \__str_unescape_string_loop:wNNN #1 *#2#3#4
+ }
+ {
+ \__str_filter_bytes:n {#1}
+ \use_none:n #4
+ \__str_output_byte:w '
+ \__str_octal_use:NTF #2
+ {
+ \__str_octal_use:NTF #3
+ {
+ \__str_octal_use:NTF #4
+ {
+ \if_int_compare:w #2 > \c_three
+ - 256
+ \fi:
+ \__str_unescape_string_repeat:NNNNNN
+ }
+ { \__str_unescape_string_repeat:NNNNNN ? }
+ }
+ { \__str_unescape_string_repeat:NNNNNN ?? }
+ }
+ {
+ \str_case_x:nnn {#2}
+ {
+ { \c_backslash_str } { 134 }
+ { ( } { 50 }
+ { ) } { 51 }
+ { r } { 15 }
+ { f } { 14 }
+ { n } { 12 }
+ { t } { 11 }
+ { b } { 10 }
+ { ^^J } { 0 - \c_one }
+ }
+ {
+ \flag_raise:n { str_error }
+ 0 - \c_one \use_i:nn
+ }
+ }
+ \__str_output_end:
+ \use_i:nn \__str_unescape_string_loop:wNNN #2#3#4
+ }
+ \cs_new:Npn \__str_unescape_string_repeat:NNNNNN #1#2#3#4#5#6
+ { \__str_output_end: \__str_unescape_string_loop:wNNN }
+ \cs_new:Npn \__str_unescape_string_newlines:wN #1 ^^M #2
+ {
+ #1
+ \if_charcode:w ^^J #2 \else: ^^J \fi:
+ \__str_unescape_string_newlines:wN #2
+ }
+ \__msg_kernel_new:nnnn { str } { unescape-string }
+ { String~invalid~in~escaping~'string'. }
+ {
+ LaTeX~came~across~an~escape~character~'\c_backslash_str'~
+ not~followed~by~any~of:~'n',~'r',~'t',~'b',~'f',~'(',~')',~
+ '\c_backslash_str',~one~to~three~octal~digits,~or~the~end~
+ of~a~line.
+ }
+\group_end:
+\str_const:Nx \c__str_escape_string_str
+ { \c_backslash_str ( ) }
+\cs_new_protected_nopar:Npn \__str_convert_escape_string:
+ { \__str_convert_gmap:N \__str_escape_string_char:N }
+\cs_new:Npn \__str_escape_string_char:N #1
+ {
+ \__str_if_escape_string:NTF #1
+ {
+ \__str_if_contains_char:NNT
+ \c__str_escape_string_str #1
+ { \c_backslash_str }
+ #1
+ }
+ {
+ \c_backslash_str
+ \int_div_truncate:nn {`#1} {64}
+ \int_mod:nn { \int_div_truncate:nn {`#1} \c_eight } \c_eight
+ \int_mod:nn {`#1} \c_eight
+ }
+ }
+\prg_new_conditional:Npnn \__str_if_escape_string:N #1 { TF }
+ {
+ \if_int_compare:w `#1 < "21 \exp_stop_f:
+ \prg_return_false:
+ \else:
+ \if_int_compare:w `#1 > "7E \exp_stop_f:
+ \prg_return_false:
+ \else:
+ \prg_return_true:
+ \fi:
+ \fi:
+ }
+%%
+%%
+%% End of file `l3str-esc-string.def'.