summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-07-31 18:27:06 +0000
committerKarl Berry <karl@freefriends.org>2011-07-31 18:27:06 +0000
commitdac945b204407dae96f70ec228206516093156d7 (patch)
tree02ca182689947e45dec95e17ba08b503c959bd17 /Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty
parentc1840548792cfbc7c9f746da1d53d89b94406e72 (diff)
l3kernel (5jun11)
git-svn-id: svn://tug.org/texlive/trunk@23282 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty177
1 files changed, 177 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty
new file mode 100644
index 00000000000..c42867b5b48
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty
@@ -0,0 +1,177 @@
+%%
+%% This is file `l3keyval.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% l3keyval.dtx (with options: `package')
+%%
+%% 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: l3keyval.dtx Copyright (C) 2006-2011 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 "expl3 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.
+%%
+%% -----------------------------------------------------------------------
+\RequirePackage{l3names}
+\GetIdInfo$Id: l3keyval.dtx 2478 2011-06-19 21:34:23Z joseph $
+ {L3 Experimental key-value parsing}
+ %\section{Parsing key--value lists}
+ %\begin{function}{\keyval_parse:NNn}
+\ProvidesExplPackage
+ {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\package_check_loaded_expl:
+\int_new:N \g_keyval_level_int
+\tl_new:N \l_keyval_key_tl
+\tl_new:N \l_keyval_value_tl
+\tl_new:N \l_keyval_sanitise_tl
+\tl_new:N \l_keyval_parse_tl
+\group_begin:
+ \char_set_catcode_active:n { `\= }
+ \char_set_catcode_active:n { `\, }
+ \char_set_lccode:nn { `\8 } { `\= }
+ \char_set_lccode:nn { `\9 } { `\, }
+\tl_to_lowercase:n
+ {
+ \group_end:
+ \cs_new_protected:Npn \keyval_parse:n #1
+ {
+ \group_begin:
+ \tl_clear:N \l_keyval_sanitise_tl
+ \tl_set:Nn \l_keyval_sanitise_tl {#1}
+ \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { = } { 8 }
+ \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { , } { 9 }
+ \tl_clear:N \l_keyval_parse_tl
+ \exp_after:wN \keyval_parse_elt:w \exp_after:wN
+ \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9
+ \exp_after:wN \group_end:
+ \l_keyval_parse_tl
+ }
+ }
+\cs_new_protected:Npn \keyval_parse_elt:w #1 ,
+ {
+ \tl_if_blank:oTF { \use_none:n #1 }
+ { \keyval_parse_elt:w \q_no_value }
+ {
+ \quark_if_nil:oF { \use_ii:nn #1 }
+ {
+ \keyval_split_key_value:w #1 = = \q_stop
+ \keyval_parse_elt:w \q_no_value
+ }
+ }
+ }
+\cs_new_protected:Npn \keyval_split_key_value:w #1 = #2 \q_stop
+ {
+ \keyval_split_key:w #1 \q_stop
+ \str_if_eq:nnTF {#2} { = }
+ {
+ \tl_put_right:Nx \l_keyval_parse_tl
+ {
+ \exp_not:c { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n }
+ { \exp_not:o \l_keyval_key_tl }
+ }
+ }
+ {
+ \keyval_split_key_value_aux:wTF #2 \q_no_value \q_stop
+ { \keyval_split_value:w \q_nil #2 }
+ { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } }
+ }
+ }
+\cs_new:Npn \keyval_split_key_value_aux:wTF #1 = #2#3 \q_stop
+ { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value }
+\group_begin:
+ \char_set_catcode_math_toggle:n { `\Q }
+ \cs_new_protected:Npn \keyval_split_key:w #1 \q_stop
+ {
+ \exp_args:NNf \tl_set:Nn \l_keyval_key_tl
+ {
+ \exp_after:wN \keyval_remove_spaces:w \exp_after:wN
+ \exp_not:N \use_none:n #1 Q ~ Q
+ }
+ \tl_set:Nx \l_keyval_key_tl
+ { \exp_after:wN \keyval_split_key_aux:w \l_keyval_key_tl \q_stop }
+ }
+ \cs_gset:Npn \keyval_split_key_aux:w #1 \q_stop { \exp_not:n {#1} }
+ \cs_gset:Npn \keyval_remove_spaces:w #1 ~ Q { \keyval_remove_spaces_aux:w #1 Q }
+ \cs_gset:Npn \keyval_remove_spaces_aux:w #1 Q #2 {#1}
+\group_end:
+\cs_new_protected:Npn \keyval_split_value:w #1 = =
+ {
+ \tl_put_right:Nx \l_keyval_parse_tl
+ {
+ \exp_not:c { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn }
+ { \exp_not:o \l_keyval_key_tl }
+ }
+ \tl_set:Nx \l_keyval_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } }
+ \tl_if_empty:NTF \l_keyval_value_tl
+ { \tl_put_right:Nn \l_keyval_parse_tl { { } } }
+ {
+ \quark_if_nil:NTF \l_keyval_value_tl
+ {
+ \tl_put_right:Nx \l_keyval_parse_tl
+ { { \exp_not:o { \use_ii:nnn #1 \q_nil } } }
+ }
+ { \keyval_split_value_aux:w #1 \q_stop }
+ }
+ }
+\group_begin:
+ \char_set_catcode_math_toggle:n { `\Q }
+ \cs_new_protected:Npn \keyval_split_value_aux:w \q_nil #1 \q_stop
+ {
+ \exp_args:NNf \tl_set:Nn \l_keyval_value_tl
+ { \keyval_remove_spaces:w \exp_not:N #1 Q ~ Q }
+ \tl_put_right:Nx \l_keyval_parse_tl { { \exp_not:o \l_keyval_value_tl } }
+ }
+\group_end:
+\cs_new_protected:Npn \keyval_parse:NNn #1#2#3
+ {
+ \int_gincr:N \g_keyval_level_int
+ \cs_gset_eq:cN { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } #1
+ \cs_gset_eq:cN { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } #2
+ \keyval_parse:n {#3}
+ \int_gdecr:N \g_keyval_level_int
+ }
+\msg_kernel_new:nnnn { keyval } { misplaced-equals-sign }
+ { Misplaced~equals~sign~in~key-value~input~\msg_line_number: }
+ {
+ LaTeX~is~attempting~to~parse~some~key-value~input~but~found~
+ two~equals~signs~not~separated~by~a~comma.
+ }
+\cs_new_eq:NN \KV_process_space_removal_sanitize:NNn \keyval_parse:NNn
+\cs_new_eq:NN \KV_process_space_removal_no_sanitize:NNn \keyval_parse:NNn
+\cs_new_eq:NN \KV_process_no_space_removal_no_sanitize:NNn \keyval_parse:NNn
+%%
+%%
+%% End of file `l3keyval.sty'.