blob: 625bcdc4feb00ec34dd385403199ecbacf75496a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
%%
%% This is file `l3str-esc-name.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3str-convert.dtx (with options: `name')
%%
%% Copyright (C) 2011-2017 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3experimental bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% File: l3str-convert.dtx Copyright (C) 2013-2018 The LaTeX3 Project
\cs_set_protected:Npn \__str_tmp:w #1#2#3
{
\cs_new_protected:cpn { __str_convert_unescape_#2: }
{
\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 #3 \g__str_result_tl
#1 ? { ? \prg_break: }
\prg_break_point:
}
\__str_if_flag_error:nnx { str_byte } { non-byte } { #2 }
\__str_if_flag_error:nnx { str_error } { unescape-#2 } { }
\group_end:
}
\cs_new:Npn #3 ##1#1##2##3
{
\__str_filter_bytes:n {##1}
\use_none:n ##3
\__str_output_byte:w "
\__str_hexadecimal_use:NTF ##2
{
\__str_hexadecimal_use:NTF ##3
{ }
{
\flag_raise:n { str_error }
* 0 + `#1 \use_i:nn
}
}
{
\flag_raise:n { str_error }
0 + `#1 \use_i:nn
}
\__str_output_end:
\use_i:nnn #3 ##2##3
}
\__kernel_msg_new:nnnn { str } { unescape-#2 }
{ String~invalid~in~escaping~'#2'. }
{
LaTeX~came~across~the~escape~character~'#1'~not~followed~by~
two~hexadecimal~digits.~This~is~invalid~in~the~escaping~'#2'.
}
}
\exp_after:wN \__str_tmp:w \c_hash_str { name }
\__str_unescape_name_loop:wNN
\str_const:Nn \c__str_escape_name_not_str { ! " $ & ' } %$
\str_const:Nn \c__str_escape_name_str { {}/<>[] }
\cs_new_protected:Npn \__str_convert_escape_name:
{ \__str_convert_gmap:N \__str_escape_name_char:N }
\cs_new:Npn \__str_escape_name_char:N #1
{
\__str_if_escape_name:NTF #1 {#1}
{ \c_hash_str \__str_output_hexadecimal:n {`#1} }
}
\prg_new_conditional:Npnn \__str_if_escape_name:N #1 { TF }
{
\if_int_compare:w `#1 < "2A \exp_stop_f:
\__str_if_contains_char:NNTF \c__str_escape_name_not_str #1
\prg_return_true: \prg_return_false:
\else:
\if_int_compare:w `#1 > "7E \exp_stop_f:
\prg_return_false:
\else:
\__str_if_contains_char:NNTF \c__str_escape_name_str #1
\prg_return_false: \prg_return_true:
\fi:
\fi:
}
%%
%%
%% End of file `l3str-esc-name.def'.
|