summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx59
1 files changed, 30 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
index 3d25a841a80..7260ca7667f 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3regex.dtx Copyright (C) 2011-2012 The LaTeX3 Project
+%% File: l3regex.dtx Copyright (C) 2011-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
@@ -35,7 +35,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3regex.dtx 4341 2012-11-27 08:39:42Z bruno $
+\GetIdInfo$Id: l3regex.dtx 4455 2013-01-22 20:38:19Z bruno $
{L3 Experimental regular expressions}
%</driver|package>
%<*driver>
@@ -320,7 +320,11 @@
% still be escaped without harm. Any escape sequence which matches a
% single character (|\d|, |\D|, \emph{etc.}) is supported in character
% classes. If the first character is |^|, then
-% the meaning of the character class is inverted. Ranges of characters
+% the meaning of the character class is inverted; |^| appearing anywhere
+% else in the range is not special. If the first character (possibly
+% following a leading |^|) is |]| then it does not need to be escaped
+% since ending the range there would make it empty.
+% Ranges of characters
% can be expressed using |-|, for instance, |[\D 0-5]| and |[^6-9]| are
% equivalent.
%
@@ -712,7 +716,7 @@
%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str}
+\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str, l3str-convert}
%</package>
% \end{macrocode}
%
@@ -911,7 +915,7 @@
% This function makes showing regular expressions easier, and lets us
% define |\D| in terms of |\d| for instance. There is a subtelty: the
% end of the query is marked by $-2$, and will thus match |\D| and
-% other negated properties; this case is catched by another part of
+% other negated properties; this case is caught by another part of
% the code.
% \begin{macrocode}
\cs_new_protected:Npn \@@_item_reverse:n #1
@@ -1375,7 +1379,7 @@
{
\__msg_kernel_error:nnx { regex } { x-overflow } {#1}
\tl_set:Nx \l_@@_internal_b_tl
- { \if_false: } \fi: \@@_escape_loop:N
+ { \if_false: } \fi:
}
{
\char_set_lccode:nn { \c_zero } {#1}
@@ -1384,7 +1388,6 @@
\tl_set:Nx \l_@@_internal_b_tl
{ \if_false: } \fi:
\@@_escape_raw:N ^^@
- \@@_escape_loop:N
}
}
}
@@ -1414,7 +1417,7 @@
}
\cs_new:Npn \@@_escape_x_test_two:N #1
{
- \if_charcode:w \c_lbrace_str #1
+ \if_charcode:w \c_left_brace_str #1
\exp_after:wN \@@_escape_x_loop:N
\else:
\__str_hexadecimal_use:NTF #1
@@ -1454,7 +1457,7 @@
{ \@@_escape_x_loop:N }
{
;
- \exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #1
+ \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #1
{ \@@_escape_loop:N }
{
\if_false: { \fi: }
@@ -1487,9 +1490,7 @@
% \end{itemize}
% The code is ugly, and highly based on magic numbers and the ascii
% codes of characters. This is mostly unavoidable for performance
-% reasons: testing for instance with \cs{__str_if_contains_char:nN}
-% would be much slower. Maybe the tests can be optimized a little
-% bit more.
+% reasons. Maybe the tests can be optimized a little bit more.
% Here, \enquote{alphanumeric} means \texttt{0}--\texttt{9},
% \texttt{A}--\texttt{Z}, \texttt{a}--\texttt{z};
% \enquote{special} character means non-alphanumeric
@@ -2111,17 +2112,17 @@
% brace, leading to the range $[a,\infty]$ or $[a,b]$, encoded as
% $\{a\}\{-1\}$ and $\{a\}\{b-a\}$.
% \begin{macrocode}
-\cs_new_protected:cpn { @@_compile_quantifier_ \c_lbrace_str :w }
+\cs_new_protected:cpn { @@_compile_quantifier_ \c_left_brace_str :w }
{
\@@_get_digits:NTFw \l_@@_internal_a_int
{ \@@_compile_quantifier_braced_auxi:w }
- { \@@_compile_quantifier_abort:xNN { \c_lbrace_str } }
+ { \@@_compile_quantifier_abort:xNN { \c_left_brace_str } }
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxi:w #1#2
{
\str_case_x:nnn { #1 #2 }
{
- { \@@_compile_special:N \c_rbrace_str }
+ { \@@_compile_special:N \c_right_brace_str }
{
\exp_args:No \@@_compile_quantifier_lazyness:nnNN
{ \int_use:N \l_@@_internal_a_int } { 0 }
@@ -2135,28 +2136,28 @@
}
{
\@@_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_@@_internal_a_int }
+ { \c_left_brace_str \int_use:N \l_@@_internal_a_int }
#1 #2
}
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxii:w #1#2
{
\str_if_eq_x:nnTF
- { #1 #2 } { \@@_compile_special:N \c_rbrace_str }
+ { #1 #2 } { \@@_compile_special:N \c_right_brace_str }
{
\exp_args:No \@@_compile_quantifier_lazyness:nnNN
{ \int_use:N \l_@@_internal_a_int } { -1 }
}
{
\@@_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_@@_internal_a_int , }
+ { \c_left_brace_str \int_use:N \l_@@_internal_a_int , }
#1 #2
}
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxiii:w #1#2
{
\str_if_eq_x:nnTF
- { #1 #2 } { \@@_compile_special:N \c_rbrace_str }
+ { #1 #2 } { \@@_compile_special:N \c_right_brace_str }
{
\if_int_compare:w \l_@@_internal_a_int > \l_@@_internal_b_int
\__msg_kernel_error:nnxx { regex } { backwards-quantifier }
@@ -2173,7 +2174,7 @@
{
\@@_compile_quantifier_abort:xNN
{
- \c_lbrace_str
+ \c_left_brace_str
\int_use:N \l_@@_internal_a_int ,
\int_use:N \l_@@_internal_b_int
}
@@ -2856,7 +2857,7 @@
% to forbid nesting |\c|. Additionally, disable submatch tracking
% since groups don't escape the scope of |\c{...}|.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { @@_compile_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { @@_compile_c_ \c_left_brace_str :w }
{
\@@_compile:w
\@@_disable_submatches:
@@ -2875,7 +2876,7 @@
% dangling class or group). Then insert the corresponding test in the
% outer regex.
% \begin{macrocode}
-\cs_new_protected:cpn { @@_compile_ \c_rbrace_str : }
+\cs_new_protected:cpn { @@_compile_ \c_right_brace_str : }
{
\@@_if_in_cs:TF
{
@@ -2883,7 +2884,7 @@
\@@_compile_one:x
{ \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } }
}
- { \exp_after:wN \@@_compile_raw:N \c_rbrace_str }
+ { \exp_after:wN \@@_compile_raw:N \c_right_brace_str }
}
% \end{macrocode}
% \end{macro}
@@ -2907,7 +2908,7 @@
\@@_if_in_class_or_catcode:TF
{ \@@_compile_raw_error:N u #1 #2 }
{
- \str_if_eq_x:nnTF {#1#2} { \@@_compile_special:N \c_lbrace_str }
+ \str_if_eq_x:nnTF {#1#2} { \@@_compile_special:N \c_left_brace_str }
{
\tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
\@@_compile_u_loop:NN
@@ -2925,7 +2926,7 @@
{
\token_if_eq_meaning:NNTF #1 \@@_compile_special:N
{
- \exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #2
+ \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #2
{ \if_false: { \fi: } \@@_compile_u_end: }
{ #2 \@@_compile_u_loop:NN }
}
@@ -4733,7 +4734,7 @@
\tl_clear:N \l_@@_balance_tl
\@@_escape_use:nnnn
{
- \if_charcode:w \c_rbrace_str ##1
+ \if_charcode:w \c_right_brace_str ##1
\@@_replacement_rbrace:N \else: \__tl_build_one:n \fi: ##1
}
{ \@@_replacement_escaped:N ##1 }
@@ -4820,7 +4821,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_replacement_g:w #1#2
{
- \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_left_brace_str }
{
\int_zero:N \l_@@_internal_a_int
\@@_replacement_g_digits:NN
@@ -4877,7 +4878,7 @@
}
{ \@@_replacement_error:NNN c #1#2 }
}
-\cs_new_protected_nopar:cpn { @@_replacement_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { @@_replacement_c_ \c_left_brace_str :w }
{
\if_case:w \l_@@_replacement_csnames_int
\__tl_build_one:n
@@ -4898,7 +4899,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_replacement_u:w #1#2
{
- \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_left_brace_str }
{
\if_case:w \l_@@_replacement_csnames_int
\__tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }