diff options
Diffstat (limited to 'macros/latex/contrib/semantex/semantex.sty')
-rw-r--r-- | macros/latex/contrib/semantex/semantex.sty | 8844 |
1 files changed, 4768 insertions, 4076 deletions
diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty index e5125e921f..c2ca6e552b 100644 --- a/macros/latex/contrib/semantex/semantex.sty +++ b/macros/latex/contrib/semantex/semantex.sty @@ -1,104 +1,115 @@ -\RequirePackage{expl3,xparse} -\ProvidesExplPackage{semantex}{2020/07/21}{0.3alpha}{} +\RequirePackage{xparse,l3keys2e,semtex,leftindex} +\ProvidesExplPackage{semantex}{2020/09/07}{0.4beta}{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SemanTeX -- semantic, keyval-based mathematics % +% https://ctan.org/pkg/semantex % +% (C) 2020 Sebastian Ørsted % +% sorsted@gmail.com % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SemanTeX -- semantic mathematics % -% https://ctan.org/pkg/semantex % -% (C) 2020 Sebastian Ørsted % -% sorsted@gmail.com % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\cs_set_eq:NN \semantex_keyval_parse:NNn \keyval_parse:NNn + +\keys_define:nn { semantex } +{ + keyvalparser .code:n = \cs_set_eq:NN \semantex_keyval_parse:NNn #1, + keyvalparser .value_required:n = true, + semtexfile .choice:, + semtexfile / true .code:n = \semantex_turn_semtex_file_on:, + semtexfile / false .code:n = \semantex_turn_semtex_file_off:, + semtexfile / unknown .code:n = \msg_error:nnnn { semantex } { semantex_setup_key_value_not_found } { semtexfile } { #1 }, + unknown .code:n = \msg_error:nnx { semantex } { semantex_setup_key_not_found } { \l_keys_key_str } +} + +\DeclareDocumentCommand\SemantexSetup { m } +{ + \keys_set:nn { semantex } { #1 } +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% ERROR MESSAGES +% THE .semtex FILE % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\bool_new:N \g__semantex_semtex_file_was_opened -\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { arg_valuekey_not_found } { Unknown~argument~key~#2~passed~to~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { data_tl_not_found } { Unknown~data~#2~requested~from~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { data_int_not_found } { Unknown~integer~#2~requested~from~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { data_bool_not_found } { Unknown~boolean~#2~requested~from~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { data_cs_not_found } { Unknown~command~sequence~#2~requested~from~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { data_prop_not_found } { Unknown~property~list~#2~requested~from~#1~on~line~\msg_line_number: } {} +\iow_new:N \g__semantex_semtex_file_stream_temp_iow -\msg_new:nnnn { semantex } { key_value_not_found } { Unknown~value~#3~passed~to~key~#2~in~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { class_already_defined } { Class~#1~already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { object_already_defined } { Object~#1~already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { class_not_found } { Unknown~class~#3~declared~as~#2~of~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { object_not_found } { You~set~#1~as~#2~of~unknown~object~#3~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1~declared~as~class~of~#2~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { setup_unknown_class } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { setup_unknown_object } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {} - -\msg_new:nnnn { semantex } { created_a_SemantexBaseObject } { Never~create~objects~of~class~\SemantexBaseObject;~create~a~new~class~yourself~instead.~You~created~the~object~#1~on~line~\msg_line_number: } {} +\cs_new_protected:Npn \semantex_turn_semtex_file_on: +{ + \bool_if:NF \g__semantex_semtex_file_was_opened + { + \iow_open:Nn \g__semantex_semtex_file_stream_temp_iow { \jobname.semtex } + \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { \DeclareClass {\SemantexBaseObject } } + } + + \cs_set:Npn\semantex_write_to_semtex_file:n##1 + { + \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { ##1 } + } + + \bool_set_true:N \g__semantex_semtex_file_was_opened +} -\msg_new:nnnn { semantex } { generic_error } { #2~#1~on~line~\msg_line_number: } {} +\cs_new_protected:Npn \semantex_turn_semtex_file_off: +{ + \bool_if:NT \g__semantex_semtex_file_was_opened + { + \iow_close:N \g__semantex_semtex_file_stream_temp_iow + } + + \cs_set:Npn\semantex_write_to_semtex_file:n##1 {} -\cs_generate_variant:Nn \msg_error:nnnn { nnnx } + \bool_set_false:N \g__semantex_semtex_file_was_opened +} -\tl_new:N\l__semantex_error_output_format_temp +\semantex_turn_semtex_file_off: -\cs_new:Npn\semantex_error_output_format:nN#1#2 +\cs_new_protected:Npn\semantex_write_original_source_to_semtex_file:n#1 { - \tl_set:Nn \l__semantex_error_output_format_temp { #1 } - \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_ } { object~\cs:w } - \tl_replace_all:Nnn \l__semantex_error_output_format_temp { class_ } { class~\cs:w } - \tl_put_right:Nn \l__semantex_error_output_format_temp { \cs_end: } - \tl_trim_spaces:N \l__semantex_error_output_format_temp - \tl_set_eq:NN #2 \l__semantex_error_output_format_temp + \semantex_write_to_semtex_file:n { \BeginSource } + \semantex_write_to_semtex_file:n { #1 } } -\cs_generate_variant:Nn \semantex_error_output_format:nN { xN } - -\cs_generate_variant:Nn \msg_error:nnnnn { nnxnn } +\cs_set_eq:NN\SemantexRecordSource\semantex_write_original_source_to_semtex_file:n -\cs_generate_variant:Nn \msg_error:nnnn { nnxn } +\cs_new_protected:Npn\semantex_add_to_existing_original_source_in_semtex_file:n#1 +{ + \semantex_write_to_semtex_file:n { #1 } +} -\cs_generate_variant:Nn \msg_error:nnn { nnx } +\cs_new_protected:Npn\semantex_write_output_to_semtex_file:n#1 +{ + \semantex_write_to_semtex_file:n { \EndSource } + \semantex_write_to_semtex_file:n { \BeginOutput } + \semantex_write_to_semtex_file:n { #1 } + \semantex_write_to_semtex_file:n { \EndOutput } +} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% COMMANDS FOR BULLETS AND SLOTS -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\cs_generate_variant:Nn\semantex_write_output_to_semtex_file:n { V } +\cs_generate_variant:Nn\semantex_write_original_source_to_semtex_file:n { o } -\box_new:N \l__semantex_bullet_box -\hbox_set:Nn \l__semantex_bullet_box { $\cdot$ } -\box_scale:Nnn \l__semantex_bullet_box {1.2} {1.2} -\tl_set:Nn\g_semantex_bullet +\cs_new_protected:Npn\semantex_write_class_declaration_to_semtex_file:n#1 { - \box_move_up:nn{-0.25ex}{\box_use:N \l__semantex_bullet_box} + \semantex_write_to_semtex_file:n { \DeclareClass{#1} } } -\tl_set:Nn\g_semantex_double_bullet{\g_semantex_bullet \g_semantex_bullet} - -\tl_set_eq:NN\SemantexBullet \g_semantex_bullet - -\tl_set_eq:NN \SemantexDoubleBullet \g_semantex_double_bullet +\cs_new_protected:Npn\semantex_write_object_declaration_to_semtex_file:n#1 +{ + \semantex_write_to_semtex_file:n { \DeclareObject{#1} } +} -\tl_set:Nn \g_semantex_slot { \mathord{-} } +\cs_new_protected:Npn\SemantexIDcommand#1 +{ + \semantex_write_to_semtex_file:n { \SemantexID{#1} } +} -\tl_set_eq:NN \SemantexSlot \g_semantex_slot +\cs_set_eq:NN\SemantexRecordObject\semantex_write_object_declaration_to_semtex_file:n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -106,25 +117,28 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\DeclareDocumentCommand\semantex_new_plain_class:Nw{mO{}} % new simple-type class +\DeclareDocumentCommand\semantex_new_simple_class:Nw{mO{}} % new simple-type class { % #1 = class name % #2 = options \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } - %\semantex_new_class:Nn { #1 } { #2 } - \DeclareDocumentCommand{#1}{m}{ + \DeclareDocumentCommand{#1}{m} + { % the actual \#1 command + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } } \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##1 } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_class_\cs_to_str:N #1_with_options:nnw}{mm}{ + \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mm} + { + %\semantex_add_to_existing_original_source_in_semtex_file:n { } % add nothing to file \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##2 } ##1 } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_class_\cs_to_str:N #1:Nw}{mgO{}} + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} { % the command for creating a new object of class #1 % ##1 = command name, with backslash @@ -143,25 +157,28 @@ } } % create the object with name ##1 - \DeclareDocumentCommand{##1}{}{ + \DeclareDocumentCommand{##1}{} + { % the actual \##1 command + \semantex_write_original_source_to_semtex_file:n { ##1 } \semantex_render_object:Nn ##1 { } } } } -\tl_set_eq:NN\NewPlainClass\semantex_new_plain_class:Nw +\tl_set_eq:NN\NewSimpleClass\semantex_new_simple_class:Nw -\DeclareDocumentCommand\semantex_new_simple_class:Nw{mO{}} % new simple-type class +\DeclareDocumentCommand\semantex_new_symbol_class:Nw{mO{}} % new symbol-type class { % #1 = class name % #2 = options \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } - %\semantex_new_class:Nn { #1 } { #2 } - \DeclareDocumentCommand{#1}{mo}{ + \DeclareDocumentCommand{#1}{mo} + { % the actual \#1 command \IfValueTF{##2} { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } { ##2 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -169,14 +186,17 @@ } } { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } } \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##1 } } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_class_\cs_to_str:N #1_with_options:nnw}{mmo}{ + \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmo} + { \IfValueTF{##3} { + \semantex_add_to_existing_original_source_in_semtex_file:n { [##3] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -185,13 +205,14 @@ } } { + %\semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##2 } ##1 } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_class_\cs_to_str:N #1:Nw}{mgO{}} + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} { % the command for creating a new object of class #1 % ##1 = command name, with backslash @@ -210,25 +231,26 @@ } } % create the object with name ##1 - \DeclareDocumentCommand{##1}{o}{ + \DeclareDocumentCommand{##1}{o} + { % the actual \##1 command \IfValueTF { ####1 } { + \semantex_write_original_source_to_semtex_file:n { ##1 [ ####1 ] } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } } } { + \semantex_write_original_source_to_semtex_file:n { ##1 } \semantex_render_object:Nn ##1 { } } } } } -\tl_set_eq:NN\NewSimpleClass\semantex_new_simple_class:Nw - -%IM Consider using \semantexIfNoValueOrDotTF on the argument +\tl_set_eq:NN\NewSymbolClass\semantex_new_symbol_class:Nw \DeclareDocumentCommand\semantex_new_variable_class:Nw{mO{}} % new variable-type class { @@ -236,12 +258,14 @@ % #2 = options \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } %\semantex_new_class:Nn #1 { #2 } - \DeclareDocumentCommand{#1}{mog}{ + \DeclareDocumentCommand{#1}{mog} + { % the actual \#1 command \IfValueTF { ##2 } { \IfValueTF { ##3 } { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } [ ##2 ] { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -250,6 +274,7 @@ } } { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } [ ##2 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -260,6 +285,7 @@ { \IfValueTF { ##3 } { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -267,16 +293,19 @@ } } { + \semantex_write_original_source_to_semtex_file:n { #1 { ##1 } } \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##1 } } } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_class_\cs_to_str:N #1_with_options:nnw}{mmog}{ + \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmog} + { \IfValueTF { ##3 } { \IfValueTF { ##4 }{ + \semantex_add_to_existing_original_source_in_semtex_file:n { [ ##3 ] { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -286,6 +315,7 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n { [ ##3 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -297,6 +327,7 @@ { \IfValueTF { ##4 } { + \semantex_add_to_existing_original_source_in_semtex_file:n { { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -305,6 +336,7 @@ } } { + % \semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##2 } ##1 @@ -312,7 +344,7 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_class_\cs_to_str:N #1:Nw}{mgO{}} + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} { % the command for creating a new object of class #1 % ##1 = command name, with backslash @@ -336,6 +368,10 @@ \IfValueTF{####1}{ \IfValueTF{####2} { + \semantex_write_original_source_to_semtex_file:n + { + ##1 [ ####1 ] { ####2 } + } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -343,6 +379,10 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { + ##1 [ ####1 ] + } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -352,12 +392,20 @@ { \IfValueTF{####2} { + \semantex_write_original_source_to_semtex_file:n + { + ##1 {####2} + } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_arg:Nn ##1 { ####2 } } } { + \semantex_write_original_source_to_semtex_file:n + { + ##1 + } \semantex_render_object:Nn ##1 {} } } @@ -378,10 +426,12 @@ { \IfValueTF { ##3 } { - \tl_if_eq:nnTF { ##3 }{ * } + \str_if_eq:nnTF { ##3 }{ * } { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { * } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -391,6 +441,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { * } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -400,10 +452,12 @@ } } { - \tl_if_eq:nnTF { ##3 }{ ** } + \str_if_eq:nnTF { ##3 }{ ** } { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ** } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -413,6 +467,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ** } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -424,6 +480,8 @@ { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ##3 } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -433,6 +491,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -446,6 +506,8 @@ { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -454,6 +516,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -465,10 +529,12 @@ { \IfValueTF { ##3 } { - \tl_if_eq:nnTF { ##3 }{ * } + \str_if_eq:nnTF { ##3 }{ * } { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { * } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -477,6 +543,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { * } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -485,10 +553,12 @@ } } { - \tl_if_eq:nnTF { ##3 }{ ** } + \str_if_eq:nnTF { ##3 }{ ** } { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ** } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -497,6 +567,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ** } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -507,6 +579,8 @@ { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ##3 } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -515,6 +589,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:N #1 { ##1 } @@ -527,6 +603,8 @@ { \IfValueTF { ##4 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -534,6 +612,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } } \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##1 } } @@ -541,15 +621,18 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_class_\cs_to_str:N #1_with_options:nnw}{mmogg}{ + \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmogg} + { \IfValueTF{##3} { \IfValueTF { ##4 } { - \tl_if_eq:nnTF { ##4 }{ * } + \str_if_eq:nnTF { ##4 }{ * } { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { * } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -560,6 +643,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { * } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -570,10 +655,12 @@ } } { - \tl_if_eq:nnTF { ##4 }{ ** } + \str_if_eq:nnTF { ##4 }{ ** } { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ** } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -584,6 +671,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ** } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -596,6 +685,8 @@ { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ##4 } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -606,6 +697,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -620,6 +713,8 @@ { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -629,6 +724,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -641,10 +738,12 @@ { \IfValueTF { ##4 } { - \tl_if_eq:nnTF { ##4 }{ * } + \str_if_eq:nnTF { ##4 }{ * } { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { * } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -654,6 +753,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { * } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -663,10 +764,12 @@ } } { - \tl_if_eq:nnTF { ##4 }{ ** } + \str_if_eq:nnTF { ##4 }{ ** } { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ** } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -676,6 +779,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ** } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -687,6 +792,8 @@ { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ##4 } { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -696,6 +803,8 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -709,6 +818,8 @@ { \IfValueTF { ##5 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ##5 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -717,6 +828,7 @@ } } { + % \semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##2 } ##1 @@ -725,7 +837,7 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_class_\cs_to_str:N #1:Nw}{mgO{}} + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} { % the command for creating a new object of class #1 % ##1 = command name, with backslash @@ -744,16 +856,19 @@ } } % creates the object with name ##1 - \DeclareDocumentCommand{##1}{ogg}{ + \DeclareDocumentCommand{##1}{ogg} + { % the actual \##1 command \IfValueTF{####1} { \IfValueTF{####2} { - \tl_if_eq:nnTF { ####2 } { * } + \str_if_eq:nnTF { ####2 } { * } { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { * } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -762,6 +877,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { * } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -770,10 +887,12 @@ } } { - \tl_if_eq:nnTF { ####2 } { ** } + \str_if_eq:nnTF { ####2 } { ** } { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { ** } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -782,6 +901,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { ** } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -792,6 +913,8 @@ { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { ####2 } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -800,6 +923,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { ####2 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -812,6 +937,8 @@ { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -819,6 +946,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1 ] } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -829,10 +958,12 @@ { \IfValueTF{####2} { - \tl_if_eq:nnTF { ####2 } { * } + \str_if_eq:nnTF { ####2 } { * } { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 { * } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_use_bullet:N ##1 @@ -840,6 +971,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 { * } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_use_bullet:N ##1 @@ -847,10 +980,12 @@ } } { - \tl_if_eq:nnTF { ####2 } { ** } + \str_if_eq:nnTF { ####2 } { ** } { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ** } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_use_double_bullet:N ##1 @@ -858,6 +993,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ** } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_use_double_bullet:N ##1 @@ -867,6 +1004,8 @@ { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ####2 } { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_degreedefault:Nn ##1 { ####2 } @@ -874,6 +1013,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ####2 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_degreedefault:Nn ##1 { ####2 } @@ -885,12 +1026,16 @@ { \IfValueTF{####3} { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ####3 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_arg:Nn ##1 { ####3 } } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 } \semantex_render_object:Nn ##1 { } } } @@ -912,6 +1057,8 @@ { \IfValueTF { ##3 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -920,6 +1067,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } [ ##2 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -930,6 +1079,8 @@ { \IfValueTF { ##3 } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } { ##3 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##1 } @@ -937,6 +1088,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { #1 { ##1 } } \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##1 } } @@ -944,12 +1097,14 @@ } } % the actual \#1 command - \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_class_\cs_to_str:N #1_with_options:nnw}{mmog} + \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmog} { \IfValueTF { ##3 } { \IfValueTF { ##4 } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] { ##4 } } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } @@ -959,11 +1114,13 @@ } } { + \semantex_add_to_existing_original_source_in_semtex_file:n + { [ ##3 ] } \semantex_render_class:Nn #1 { \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } ##1 - \semantex_class_set_keys:Nn #1{ ##3 } + \semantex_class_set_keys:Nn #1 { ##3 } } } } @@ -971,6 +1128,8 @@ \IfValueTF { ##4 } { \semantex_render_class:Nn #1 { + \semantex_add_to_existing_original_source_in_semtex_file:n + { { ##4 } } \semantex_class_do_output:N #1 \semantex_class_set_symbol:Nn #1 { ##2 } ##1 @@ -978,6 +1137,7 @@ } } { + % \semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file \semantex_render_class:Nn #1 { \semantex_class_set_symbol:Nn #1 { ##2 } ##1 @@ -985,7 +1145,7 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_class_\cs_to_str:N #1:Nw}{mmmO{}} + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mmmO{}} { % the command for creating a new object of class #1 % ##1 = command name, with backslash @@ -997,12 +1157,15 @@ \semantex_object_set_keys:Nn ##1 { ##4 } } % creates the object with name ##1 - \DeclareDocumentCommand{##1}{og}{ + \DeclareDocumentCommand{##1}{og} + { % the actual \##1 command \IfValueTF { ####1 } { \IfValueTF { ####2 } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1] { ####2 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -1010,6 +1173,8 @@ } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 [ ####1] } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_keys:Nn ##1 { ####1 } @@ -1019,12 +1184,16 @@ { \IfValueTF { ####2 } { + \semantex_write_original_source_to_semtex_file:n + { ##1 { ####2 } } \semantex_render_object:Nn ##1 { \semantex_object_do_output:N ##1 \semantex_object_set_arg:Nn ##1 { ####2 } } } { + \semantex_write_original_source_to_semtex_file:n + { ##1 } \semantex_render_object:Nn ##1 { } } } @@ -1040,72 +1209,128 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_new:Npn\NewObject#1 +% Internally, objects and classes are both special cases of what we call "registers". +% A register is a collection of data and key definitions, and different registers can +% inherit from each other. Each register has a name which is a token list, with no +% backslash. The class \<MyClass> corresponds to the register "class_<MyClass>", +% and the object \<MyObject> corresponds to the register "object_<MyObject>". +% Firstly, we need a couple of commands to convert class and object names into +% register names. + +\cs_new:Npn\semantex_class_to_register:N#1 +{ + % #1 = name of class + class_\cs_to_str:N #1 +} + +\cs_new:Npn\semantex_object_to_register:N#1 { - \cs_if_exist_use:cF { __semantex_new_object_of_class_\cs_to_str:N#1:Nw } + % #1 = name of object + object_\cs_to_str:N #1 +} + +\DeclareDocumentCommand\NewObject { m } +{ + % #1 = name of object + \semantex_class_if_exist:NTF #1 + { + \use:c { __semantex_new_object_of_\semantex_class_to_register:N #1:Nw } + } { \msg_error:nnnn { semantex } { created_object_of_unknown_class } { #1 } } } -\cs_new:Npn \__semantex_new_class_or_object:nn#1#2 +\DeclareDocumentCommand\UseClassInCommand { mo } { - % create new object - % #1 = name of command, without backslash + \semantex_class_if_exist:NTF #1 + { + \IfValueTF { #2 } + { + \use:c { __semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw } + { + \semantex_keys_set:nn { \semantex_class_to_register:N #1 } { #2 } + } + } + { + \use:c { __semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw } {} + } + } + { + \msg_error:nnnn { semantex } { used_unknown_class } { #1 } + } +} + +\cs_new_protected:Npn \semantex_new_register:nn#1#2 +{ + % create new register + % #1 = name of register % #2 = standard keyval setup \semantex_data_tl_provide:nn { #1 } { parent } \semantex_data_tl_set:nnn { #1 } { parent } { class_SemantexBaseObject } + % The parent class by default is \SemantexBaseObject \cs_set:cpn { __semantex_data_cs_#1_valuekey:nn } ##1##2 % command controlling valuekeys - { \semantex_valuekey:nnn { #1 } { ##1 } { ##2 } } + { \semantex_valuekey:nnn { #1 } { ##1 } { ##2 } } \cs_set:cpn { __semantex_data_cs_#1_singlekey:n } ##1 % command controlling singlekeys - { \semantex_singlekey:nn { #1 } { ##1 } } + { \semantex_singlekey:nn { #1 } { ##1 } } + + \cs_generate_variant:cn { __semantex_data_cs_#1_valuekey:nn } { nx } + + \cs_set:cpn { __semantex_data_cs_#1_singlekey_x:n } ##1 % command controlling executed singlekeys + { \semantex_singlekey_x:nn { #1 } { ##1 } } % Now a similar collection of keyval commands for the *argument* \cs_set:cpn { __semantex_data_cs_#1_arg_valuekey:nn } ##1##2 - { \semantex_arg_valuekey:nnn { #1 } { ##1 } { ##2 } } + { \semantex_arg_valuekey:nnn { #1 } { ##1 } { ##2 } } \cs_set:cpn { __semantex_data_cs_#1_arg_singlekey:n } ##1 - { \semantex_arg_singlekey:nn { #1 } { ##1 } } + { \semantex_arg_singlekey:nn { #1 } { ##1 } } - \cs_set:cpn { __semantex_data_cs_#1_outputoptions:n } ##1 {} + \cs_generate_variant:cn { __semantex_data_cs_#1_arg_valuekey:nn } { nx } - \cs_set:cpn { __semantex_data_cs_#1_parseoptions:n } ##1 {} + \cs_set:cpn { __semantex_data_cs_#1_arg_singlekey_x:n } ##1 + { \semantex_arg_singlekey_x:nn { #1 } { ##1 } } - % This is used to set up the class/object when creating it + % This is used to set up the register when creating it #2 } -\cs_generate_variant:Nn \__semantex_new_class_or_object:nn { xn } +\cs_generate_variant:Nn \semantex_new_register:nn { xn } -\cs_new:Npn \semantex_new_class:Nn#1#2{ +\cs_new_protected:Npn \semantex_new_class:Nn#1#2 +{ % create a new class % #1 = name of class - % #2 = standard keyval setup; the parent class by default is SemantexBaseObject + % #2 = standard keyval setup \semantex_class_if_exist:NTF #1 { \msg_error:nnn { semantex } { class_already_defined } { #1 } } { - \semantex_class_register:N #1 - \__semantex_new_class_or_object:xn { class_\cs_to_str:N #1 } { #2 } + \semantex_add_to_list_of_classes:N #1 + \semantex_new_register:xn { \semantex_class_to_register:N #1 } { #2 } } } -\cs_set:Npn \semantex_new_object:NNn#1#2#3 +\cs_set_protected:Npn \semantex_new_object:NNn#1#2#3 { + % create a new object + % #1 = name of class + % #2 = name of object + % #3 = standard keyval setup \semantex_object_if_exist:NTF #2 { \msg_error:nnn { semantex } { object_already_defined } { #2 } } { - \semantex_object_register:N #2 - \__semantex_new_class_or_object:xn { object_\cs_to_str:N #2 } { - %class=#1, #3 + \semantex_add_to_list_of_objects:N #2 + \semantex_new_register:xn { \semantex_object_to_register:N #2 } + { \semantex_object_set_class:Nn #2 { #1 } #3 } @@ -1113,246 +1338,272 @@ } % The following commands are used in the code for creating class types: +% Writing the actual content of the commands is not that much more +% complicated, but I've decided to use them anyway to make it more +% user-friendly to create your own class type. -\cs_set:Npn\semantex_class_set_symbol:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_symbol:Nn#1#2 { - %\semantex_data_tl_set:xnn { class_\cs_to_str:N#1 } { symbol } { #2 } - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbol:xn { class_\cs_to_str:N #1 } { #2 } + \semantex_valuekey:nnn { \semantex_class_to_register:N #1 } { symbol } { #2 } } -\cs_set:Npn\semantex_object_set_symbol:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_symbol:Nn#1#2 { - %\semantex_data_tl_set:xnn { object_\cs_to_str:N#1 } { symbol } { #2 } - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbol:xn { object_\cs_to_str:N #1 } { #2 } + \semantex_valuekey:nnn { \semantex_object_to_register:N #1 } { symbol } { #2 } } -\cs_set:Npn\semantex_class_do_output:N#1 +\cs_new_protected:Npn\semantex_class_do_output:N#1 { - \semantex_data_bool_set_true:xn { class_\cs_to_str:N#1 } { output } + \semantex_data_bool_set_true:nn { \semantex_class_to_register:N #1 } { output } } -\cs_set:Npn\semantex_object_do_output:N#1 +\cs_new_protected:Npn\semantex_object_do_output:N#1 { - \semantex_data_bool_set_true:xn { object_\cs_to_str:N#1 } { output } + \semantex_data_bool_set_true:nn { \semantex_object_to_register:N #1 } { output } } -\cs_set:Npn\semantex_class_set_keys:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_keys:Nn#1#2 { - \semantex_keys_set:xn { class_\cs_to_str:N #1 } { #2 } + \semantex_keys_set:nn { \semantex_class_to_register:N #1 } { #2 } } -\cs_set:Npn\semantex_object_set_keys:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_keys:Nn#1#2 { - \semantex_keys_set:xn { object_\cs_to_str:N #1 } { #2 } + \semantex_keys_set:nn { \semantex_object_to_register:N #1 } { #2 } } -\cs_set:Npn\semantex_class_set_arg:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_arg:Nn#1#2 { - \semantex_valuekey:xnn { class_\cs_to_str:N#1 } { arg } { #2 } + \semantex_valuekey:nnn { \semantex_class_to_register:N #1 } { arg } { #2 } } -\cs_set:Npn\semantex_object_set_arg:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_arg:Nn#1#2 { - \semantex_valuekey:xnn { object_\cs_to_str:N#1 } { arg } { #2 } + \semantex_valuekey:nnn { \semantex_object_to_register:N #1 } { arg } { #2 } } -\cs_set:Npn\semantex_class_set_degreedefault:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_degreedefault:Nn#1#2 { - \semantex_valuekey:xnn { class_\cs_to_str:N#1 } { degreedefault } { #2 } - % should there be \exp_not:n around #2? Probably not, based on the above + \semantex_valuekey:nnn { \semantex_class_to_register:N #1 } { degreedefault } { #2 } } -\cs_set:Npn\semantex_object_set_degreedefault:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_degreedefault:Nn#1#2 { - \semantex_valuekey:xnn { object_\cs_to_str:N#1 } { degreedefault } { #2 } - % should there be \exp_not:n around #2? Probably not, based on the above + \semantex_valuekey:nnn { \semantex_object_to_register:N #1 } { degreedefault } { #2 } } -\cs_set:Npn\semantex_class_use_bullet:N#1 +\cs_new_protected:Npn\semantex_class_use_bullet:N#1 { - \semantex_singlekey:xn { class_\cs_to_str:N#1 } { * } + \semantex_singlekey:nn { \semantex_class_to_register:N #1 } { * } } -\cs_set:Npn\semantex_object_use_bullet:N#1 +\cs_new_protected:Npn\semantex_object_use_bullet:N#1 { - \semantex_singlekey:xn { object_\cs_to_str:N#1 } { * } + \semantex_singlekey:nn { \semantex_object_to_register:N #1 } { * } } -\cs_set:Npn\semantex_class_use_double_bullet:N#1 +\cs_new_protected:Npn\semantex_class_use_double_bullet:N#1 { - \semantex_singlekey:xn { class_\cs_to_str:N#1 } { * } + \semantex_singlekey:nn { \semantex_class_to_register:N #1 } { * } } -\cs_set:Npn\semantex_object_use_double_bullet:N#1 +\cs_new_protected:Npn\semantex_object_use_double_bullet:N#1 { - \semantex_singlekey:xn { object_\cs_to_str:N#1 } { * } + \semantex_singlekey:nn { \semantex_object_to_register:N #1 } { * } } -\cs_set:Npn\semantex_class_set_leftpar:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_leftpar:Nn#1#2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftpar:xn { class_\cs_to_str:N#1 } { #2 } + \semantex_data_tl_set:nnn { \semantex_class_to_register:N #1 } { leftpar } { #2 } } -\cs_set:Npn\semantex_object_set_leftpar:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_leftpar:Nn#1#2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftpar:xn { object_\cs_to_str:N#1 } { #2 } + \semantex_data_tl_set:nnn { \semantex_object_to_register:N #1 } { leftpar } { #2 } } -\cs_set:Npn\semantex_class_set_rightpar:Nn#1#2 +\cs_new_protected:Npn\semantex_class_set_rightpar:Nn#1#2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightpar:xn { class_\cs_to_str:N#1 } { #2 } + \semantex_data_tl_set:nnn { \semantex_class_to_register:N #1 } { rightpar } { #2 } } -\cs_set:Npn\semantex_object_set_rightpar:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_rightpar:Nn#1#2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightpar:xn { object_\cs_to_str:N#1 } { #2 } + \semantex_data_tl_set:nnn { \semantex_object_to_register:N #1 } { rightpar } { #2 } } -\cs_set:Npn\semantex_object_set_class:Nn#1#2 +\cs_new_protected:Npn\semantex_object_set_class:Nn#1#2 { - \semantex_data_class_set:xn { object_\cs_to_str:N #1 } { #2 } + \semantex_data_class_set:nn { \semantex_object_to_register:N #1 } { #2 } } -\seq_new:N \g__semantex_all_classes_seq % a register for all objects created +\seq_new:N \g__semantex_all_classes_seq % a list of all objects created -\cs_new:Npn\semantex_class_register:N#1 +\cs_new_protected:Npn\semantex_add_to_list_of_classes:N#1 { - \seq_put_right:Nx\g__semantex_all_classes_seq { class_\cs_to_str:N #1 } + \seq_put_right:Nx\g__semantex_all_classes_seq { \semantex_class_to_register:N #1 } + \semantex_write_class_declaration_to_semtex_file:n { #1 } } -\cs_new:Npn\semantex_class_if_exist:NTF#1#2#3 +\cs_new_protected:Npn\semantex_class_if_exist:NTF#1#2#3 { - \seq_if_in:NxTF\g__semantex_all_classes_seq { class_\cs_to_str:N#1 } { #2 } { #3 } + \seq_if_in:NxTF\g__semantex_all_classes_seq { \semantex_class_to_register:N #1 } { #2 } { #3 } } -\seq_new:N \g__semantex_all_objects_seq % a register for all objects created +\seq_new:N \g__semantex_all_objects_seq % a list of all objects created -\cs_new:Npn\semantex_object_register:N#1 +\cs_new_protected:Npn\semantex_add_to_list_of_objects:N#1 { - \seq_put_right:Nx\g__semantex_all_objects_seq { object_\cs_to_str:N #1 } + \seq_put_right:Nx\g__semantex_all_objects_seq { \semantex_object_to_register:N #1 } + \semantex_write_object_declaration_to_semtex_file:n { #1 } } -\cs_new:Npn\semantex_object_if_exist:NTF#1#2#3 +\cs_new_protected:Npn\semantex_object_if_exist:NTF#1#2#3 { - \seq_if_in:NxTF\g__semantex_all_objects_seq { object_\cs_to_str:N#1 } { #2 } { #3 } + \seq_if_in:NxTF\g__semantex_all_objects_seq { \semantex_object_to_register:N #1 } { #2 } { #3 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% COMMANDS FOR RENDERING OBJECTS AND CLASSES +% COMMANDS FOR RENDERING REGISTERS % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \cs_generate_variant:Nn\tl_if_blank:nTF { xTF } -\cs_new_protected:Npn \__semantex_render:nn#1#2 +\cs_new_protected:Npn \semantex_render_register:nn#1#2 { - % the main command for rendering a class/object - % #1 = name of object + % the main command for rendering a register + % #1 = name of register % #2 = options \group_begin: - \semantex_provide_user_commands:n { #1 } + \cs_set:Nn\semantex_this: { #1 } \semantex_data_tl_inherit:nn { #1 } { symbol } % Inherit the symbol from parent if not done already - %\semantex_keys_set:nn { #1 } { #2 } % Setup the keys - #2 - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parse:nn { #1 } { } % Run the "parse" routine, i.e. the collection of code that the user has added to the parse register - \semantex_data_bool_get:nnTF { #1 } { output } % Checks if the object/class is supposed to output + #2 % This is where keys can be set up + \semantex_parse:n { #1 } % Run the "parse" routine, i.e. run the collection of code that the user has added via the key "parseoptions" + \semantex_data_bool_get:nnTF { #1 } { output } % Checks if the register is supposed to output { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_innerreturn:nn { #1 }{} + \semantex_inner_return:n { #1 } \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } % Checks if more than one argument has been received, i.e. whether we want to render any argument { \semantex_data_bool_get:nnTF { #1 } { leftargument } % Checks if left or right argument { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftreturn:nn { #1 }{} + \semantex_left_return:n { #1 } } { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightreturn:nn { #1 }{} + \semantex_right_return:n { #1 } } } { % do nothing } - \tl_set:Nx\l__semantex_render_symbol_temp { \semantex_data_tl_get:nn { #1 } { symbol } } % Stores the symbol in a temporary command - \tl_set:Nx \l__semantex_render_temp + \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command + \tl_set:Nx \l__semantex_render_output_class_temp_tl { \semantex_data_tl_get:nn { #1 } { output } } % The output class + \exp_args:NNx\cs_set:Nn\l__semantex_render_outputoptions_temp_cs:n + { \semantex_data_tl_get_exp_not:nn { #1 } { outputoptions } } + % \cs_set:Nx did not work here, as it changes ##1 to #1, which we don't want. + \tl_set:Nn\l__semantex_render_outputoptions_temp_tl + { + \l__semantex_render_outputoptions_temp_cs:n + } + \tl_put_right:Nx \l__semantex_render_outputoptions_temp_tl + { + { \l__semantex_render_output_class_temp_tl } + } + \exp_args:NNo\tl_set:No \l__semantex_render_outputoptions_temp_tl + { + \l__semantex_render_outputoptions_temp_tl + } % This was necessary, trust me. + \tl_set:Nx \l__semantex_render_temp_tl { \exp_not:c { - __semantex_make_object_of_\semantex_data_tl_get:nn { #1 } { output }_with_options:nnw - } % This is for outputting -- the command \__semantex_make_object_of_class_???_with_options:nnw makes a one-time object of class ??? and allows us to immediately parse options to it - { - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperputleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerputleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftputright:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftputright:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupper:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { preupper } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupper:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { postupper } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelower:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { prelower } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlower:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { postlower } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupperleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupperleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelowerleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlowerleft:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } } - \exp_not:N\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_texclass:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get:nn { #1 } { texclass } } - %\exp_not:N\semantex_keys_set:nn { \semantex_data_tl_get:nn { #1 } { output } } { \semantex_data_tl_get_exp_not:nn { #1 } { outputoptions } } - %\semantex_data_tl_get_exp_not:nn { #1 } { outputoptions } - %\exp_not:c -% \exp_args:Nc\exp_not:N -% { __semantex_data_cs_#1_outputoptions:n } { -% \semantex_data_tl_get:nn { #1 } { output } -% } -% \semantex_data_cs_get_exp_not:nn { #1 } { outputoptions:n } { \semantex_data_tl_get:nn { #1 } { output } } - \semantex_data_cs_get:nn { #1 } { outputoptions:n } { \semantex_data_tl_get:nn { #1 } { output } } - % These are the options we parse to our object -- this is all - % information that we pass on to the output class so that it + __semantex_make_object_of_\l__semantex_render_output_class_temp_tl _with_options:nnw + } + % This is for outputting -- the command + % \__semantex_make_object_of_class_???_with_options:nnw + % makes a one-time object of class ??? and allows us to + % immediately pass options to it + { + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupper } { \semantex_data_tl_get_exp_not:nn { #1 } { preupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupper } { \semantex_data_tl_get_exp_not:nn { #1 } { postupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelower } { \semantex_data_tl_get_exp_not:nn { #1 } { prelower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlower } { \semantex_data_tl_get_exp_not:nn { #1 } { postlower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { heightphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { slantingphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { texclass } { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } + \exp_not:V \l__semantex_render_outputoptions_temp_tl + % These are the options we pass to the output class so that it % can eventually render it } - { \exp_not:V \l__semantex_render_symbol_temp } + { \exp_not:V \l__semantex_render_symbol_temp_tl } } } { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_return:nn { #1 }{} % Returns the object/class, i.e. adds all remaining indices and arguments to it - \tl_if_blank:xTF { \semantex_data_tl_get:nn { #1 } { texclass } } + \semantex_pre_return:n { #1 } % Performs the pre_return routine, i.e. adds all remaining indices and arguments to the symbol + \tl_if_blank:xTF { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } % Checks whether the texclass register has been declared -- this is % where you store \mathord, \mathbin, \mathrel, etc., if you want % the object to be eventually wrapped in this. { - \tl_set:Nx\l__semantex_render_symbol_temp { \semantex_data_tl_get:nn { #1 } { symbol } } + \tl_set:Nx\l__semantex_render_temp_tl + { + \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + } } { - \tl_set:Nx\l__semantex_render_symbol_temp { \semantex_data_tl_get:nn { #1 } { texclass } { \semantex_data_tl_get:nn { #1 } { symbol } } } - } - \tl_set:Nx\l__semantex_render_temp { - \exp_not:V \l__semantex_render_symbol_temp + \tl_set:Nx\l__semantex_render_temp_tl + { + \semantex_data_tl_get_exp_not:nn { #1 } { texclass } + { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } + } } + \group_begin: + \semantex_write_output_to_semtex_file:V \l__semantex_render_temp_tl + % Adds the output to the .semtex file, if this has been turned on, + % which it is not by default. + \group_end: } \exp_last_unbraced:NV \group_end: - \l__semantex_render_temp % This neat trick allows outputting to different classes to work as expected + \l__semantex_render_temp_tl + % This neat trick allows outputting to different classes to work as expected } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperputleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerputleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftputright:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftputright:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupper:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupper:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelower:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlower:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupperleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupperleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelowerleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlowerleft:nn { nx } -%\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_texclass:nn { nx } - -\cs_generate_variant:Nn \__semantex_render:nn { xn } +\cs_generate_variant:Nn \semantex_render_register:nn { xn } -\cs_set:Npn\semantex_render_class:Nn#1#2 % a front-end command +\cs_new_protected:Npn\semantex_render_class:Nn#1#2 % a front-end command { - \__semantex_render:xn { class_\cs_to_str:N #1 } { #2 } + \semantex_render_register:xn { \semantex_class_to_register:N #1 } { #2 } } -\cs_set:Npn\semantex_render_object:Nn#1#2 +\cs_new_protected:Npn\semantex_render_object:Nn#1#2 { - \__semantex_render:xn { object_\cs_to_str:N #1 } { #2 } % Actually, it seems to all still work out fine with n-type instead of x-type, but better be sure + \semantex_render_register:xn { \semantex_object_to_register:N #1 } { #2 } + % Actually, it seems to all still work out fine with n-type + % instead of x-type, but better be sure } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1361,338 +1612,642 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\tl_new:N\SemantexDelimiterSize - -%%So far, this is experimental: -%%\makeatletter %this part requires amsmath -%\tl_set:Nn\semantexnormalscaling{\bBigg@{0.8}} -%\tl_set:Nn\semantexnormalscalingl{\mathopen\semantexnormalscaling} -%\tl_set:Nn\semantexnormalscalingr{\mathclose\semantexnormalscaling} -%\tl_set:Nn\semantexnormalscalingm{\mathrel\semantexnormalscaling} -%%\makeatother - -\cs_new:Npn \__semantex_parentheses_normal:nnn#1#2#3 +\cs_new_protected:Npn \semantex_parentheses_store:nN#1#2 { - \group_begin: - %\semantexnormalscalingl#2 #4 #5 #6 \semantexnormalscalingr#3 - \mathopen#1 #3 \mathclose#2 - \group_end: + \semantex_data_tl_get_store:nnN { #1 } { parsize } \l__semantex_parentheses_store_temp_tl + \semantex_data_bool_get:nnTF { #1 } { allowSemantexDelimiterSize } + { + \tl_set:Nn#2 { \SemantexParentheses } + \tl_put_right:Nx#2 + { + { \exp_not:V \l__semantex_parentheses_store_temp_tl } + { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } + { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } + { + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + } + } + } + { + \str_case:VnF { \l__semantex_parentheses_store_temp_tl } % This is where \big,\Big, etc. go. + { + { normal } { + \tl_set:Nx#2 + { + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + } + \str_if_eq:xnF { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } { . } + { + \tl_put_left:Nx#2 + { + \exp_not:N \mathopen \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } + } + } + \str_if_eq:xnF { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } { . } + { + \tl_put_right:Nx#2 + { + \exp_not:N \mathclose \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } + } + } + } + { auto } { + \tl_set:Nx#2 + { + \exp_not:N \SemantexLeft \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \SemantexRight \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } + } + } + { * } { + \tl_set:Nx#2 + { + \exp_not:N \SemantexLeft \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \SemantexRight \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } + } + } + } + { + \tl_set:Nx#2 + { + \exp_not:N \mathopen + \exp_not:V \l__semantex_parentheses_store_temp_tl + \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \mathclose + \exp_not:V \l__semantex_parentheses_store_temp_tl + \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } + } + } + } } -\cs_new:Npn \__semantex_parentheses_auto:nnn#1#2#3 -{ - \group_begin: - \tl_set:Nn\SemantexDelimiterSize{\middle} - %\tl_set_eq:NN\SemantexDelimiterSize\middle - \mathopen{}\mathclose\bgroup\left#1 - #3 - \aftergroup\egroup\right#2 - \group_end: -} +\cs_generate_variant:Nn \str_case:nnF { VnF } +\cs_generate_variant:Nn \str_if_eq:nnF { xnF } -\cs_new:Npn \__semantex_parentheses_other:nnnn#1#2#3#4 +\cs_new_protected:Npn \semantex_no_parentheses_store:nN#1#2 +% The central command for handling the rendering of arguments with no parentheses around { - \group_begin: - \tl_set_eq:NN\SemantexDelimiterSize#4 - %\tl_set:Nx\SemantexDelimiterSize{\exp_not:N#1} - \mathopen#4#1 #3 \mathclose#4#2 - \group_end: + \semantex_data_bool_get:nnTF { #1 } { allowSemantexDelimiterSize } + { + \tl_set:Nn#2 { \SemantexNoParentheses } + \tl_put_right:Nx#2 + { + { + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + } + } + } + { + \tl_set:Nx#2 + { + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + } + } } - -\cs_generate_variant:Nn \str_case:nnF { xnF } - -\cs_new:Npn \__semantex_parentheses_store:nnnnN#1#2#3#4#5 -% The central command handling the rendering of argument parentheses +\cs_new_protected:Npn \__semantex_symbol_parentheses_store:nnnnN#1#2#3#4#5 +% The central command handling the rendering of symbol parentheses { - \tl_set:Nx#5 - { - { #2 } - { #3 } - { #4 } - } - \str_case:xnF { #1 } % This is where \big,\Big, etc. go. To my surprise, an x-type expansion did not cause any issues with this + \str_case:nnF { #1 } % This is where \big,\Big, etc. go. { { normal } { - \tl_put_left:Nn#5 + \tl_set:Nn#5 { - \exp_not:N - \__semantex_parentheses_normal:nnn + #4 + } + \str_if_eq:nnF { #2 } { . } + { + \tl_put_left:Nn#5 + { + \mathopen #2 + } + } + \str_if_eq:nnF { #3 } { . } + { + \tl_put_right:Nn#5 + { + \mathclose #3 + } } } { auto } { - \tl_put_left:Nn#5 + \tl_set:Nn#5 { - \exp_not:N - \__semantex_parentheses_auto:nnn + \SemantexLeft #2 + #4 + \SemantexRight #3 } } { * } { - \tl_put_left:Nn#5 + \tl_set:Nn#5 { - \exp_not:N - \__semantex_parentheses_auto:nnn + \SemantexLeft #2 + #4 + \SemantexRight #3 } } } { - \tl_put_right:Nx#5 - { - { \exp_not:V #1 } - } - \tl_put_left:Nn#5 + \tl_set:Nn#5 { - \exp_not:N - \__semantex_parentheses_other:nnnn + \mathopen #1 #2 + #4 + \mathclose #1 #3 } } } -\cs_new:Npn \__semantex_no_parentheses:n#1 +\cs_generate_variant:Nn \__semantex_symbol_parentheses_store:nnnnN { xxxxN } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% COMMANDS FOR THE RETURN ROUTINES +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\cs_new_protected:Npn\semantex_return:n#1 { - \group_begin: - \tl_clear:N\SemantexDelimiterSize - #1 - \group_end: + % This is an umbrella key that runs all of the three + % return routines, innerreturn, rightreturn, and leftreturn + \semantex_inner_return:n { #1 } + \semantex_left_return:n { #1 } + \semantex_right_return:n { #1 } } -\cs_new:Npn \__semantex_no_parentheses_store:nN#1#2 -% The central command for handling the rendering of arguments with no parentheses around +\cs_new_protected:Npn\semantex_pre_return:n#1 { - \tl_set:Nx#2 - { - { #1 } - } - \tl_put_left:Nn#2 + % The pre-return routines are like the return routines, except + % they do not reset all the parameters we need. This is only + % intended for use when rendering and not outputting, as + % resetting parameters in this case would just waste + % time. + \semantex_inner_pre_return:n { #1 } + \semantex_left_pre_return:n { #1 } + \semantex_right_pre_return:n { #1 } +} + +\cs_new_protected:Npn\semantex_inner_return:n#1 +{ + \semantex_inner_pre_return:n { #1 } + \semantex_data_seq_clear:nn { #1 } { commands_sequence } +} + +\cs_new_protected:Npn\semantex_inner_pre_return:n#1 +{ + % This adds all of the commands added via the command key + % to the symbol + \semantex_data_seq_get_store:nnN { #1 } { commands_sequence } + \l__semantex_data_seq_commands_sequence_temp + \seq_map_inline:Nn \l__semantex_data_seq_commands_sequence_temp { - \exp_not:N - \__semantex_no_parentheses:n + \semantex_data_tl_set:nnx { #1 } { symbol } + { + \exp_not:N ##1 + { + \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + } + } } + \semantex_data_seq_clear:nn { #1 } { commands_sequence } } -\cs_new:Npn \__semantex_symbol_parentheses_normal:nnn#1#2#3 +\cs_new_protected:Npn\semantex_right_return:n#1 { - \mathopen#1 #3 \mathclose#2 + \semantex_right_indices_return_store:nN { #1 } + \l__semantex_rightreturn_right_indices_temp + \semantex_data_tl_put_right:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_rightreturn_right_indices_temp + } + \semantex_data_bool_get:nnTF { #1 } { leftargument } + { + % do nothing + } + { + \semantex_arg_return_store:nN { #1 } \l__semantex_rightreturn_arg_temp + \semantex_data_tl_put_right:nnx { #1 } { symbol } + { + \exp_not:V + \l__semantex_rightreturn_arg_temp + } + \semantex_data_tl_clear:nn { #1 } { arg } + \semantex_data_tl_clear:nn { #1 } { prearg } + \semantex_data_tl_clear:nn { #1 } { postarg } + \semantex_data_int_clear:nn { #1 } { numberofarguments } + \semantex_data_bool_set_false:nn { #1 } { nextargwithsep } + } + \semantex_data_tl_clear:nn { #1 } { upper } + \semantex_data_tl_clear:nn { #1 } { preupper } + \semantex_data_tl_clear:nn { #1 } { postupper } + \semantex_data_bool_set_false:nn { #1 } { nextupperwithsep } + \semantex_data_int_clear:nn { #1 } { numberofupperindices } + \semantex_data_tl_clear:nn { #1 } { lower } + \semantex_data_tl_clear:nn { #1 } { prelower } + \semantex_data_tl_clear:nn { #1 } { postlower } + \semantex_data_bool_set_false:nn { #1 } { nextlowerwithsep } + \semantex_data_int_clear:nn { #1 } { numberoflowerindices } } -\cs_new:Npn \__semantex_symbol_parentheses_auto:nnn#1#2#3 +\cs_new_protected:Npn\semantex_right_pre_return:n#1 { - \mathopen{}\mathclose\bgroup\left#1 - #3 - \aftergroup\egroup\right#2 + \semantex_right_indices_return_store:nN { #1 } + \l__semantex_rightreturn_right_indices_temp + \semantex_data_tl_put_right:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_rightreturn_right_indices_temp + } + \semantex_data_bool_get:nnTF { #1 } { leftargument } + { + % do nothing + } + { + \semantex_arg_return_store:nN { #1 } \l__semantex_rightreturn_arg_temp + \semantex_data_tl_put_right:nnx { #1 } { symbol } + { + \exp_not:V + \l__semantex_rightreturn_arg_temp + } + } } -\cs_new:Npn \__semantex_symbol_parentheses_other:nnnn#1#2#3#4 +\cs_new_protected:Npn \semantex_right_indices_return_store:nN#1#2 { - \mathopen#4#1 #3 \mathclose#4#2 + \tl_set:Nn#2{} + \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerindices } + { + \tl_put_right:Nx#2 + { + \sb{ + \semantex_data_tl_get_exp_not:nn { #1 } { prelower } + \semantex_data_tl_get_exp_not:nn { #1 } { lower } + \semantex_data_tl_get_exp_not:nn { #1 } { postlower } + } + } + } + { + % do nothing + } + \semantex_data_int_if_positive:nnTF { #1 } { numberofupperindices } + { + \tl_put_right:Nx#2 + { + \sp{ + \semantex_data_tl_get_exp_not:nn { #1 } { preupper } + \semantex_data_tl_get_exp_not:nn { #1 } { upper } + \semantex_data_tl_get_exp_not:nn { #1 } { postupper } + } + } + } + { + % do nothing + } } +\cs_new_protected:Npn\semantex_left_return:n#1 +{ + \semantex_left_indices_return_store:nN { #1 } + \l__semantex_leftreturn_left_indices_temp + \semantex_data_tl_put_left:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_leftreturn_left_indices_temp + } + \semantex_data_bool_get:nnTF { #1 } { leftargument } + { + \semantex_arg_return_store:nN { #1 } \l__semantex_leftreturn_arg_temp + \semantex_data_tl_put_left:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_leftreturn_arg_temp + } + \semantex_data_tl_clear:nn { #1 } { arg } + \semantex_data_tl_clear:nn { #1 } { prearg } + \semantex_data_tl_clear:nn { #1 } { postarg } + \semantex_data_int_clear:nn { #1 } { numberofarguments } + \semantex_data_bool_set_false:nn { #1 } { nextargwithsep } + } + { + % do nothing + } + \semantex_data_tl_clear:nn { #1 } { upperleft } + \semantex_data_tl_clear:nn { #1 } { preupperleft } + \semantex_data_tl_clear:nn { #1 } { postupperleft } + \semantex_data_bool_set_false:nn { #1 } { nextupperleftwithsep } + \semantex_data_int_clear:nn { #1 } { numberofupperleftindices } + \semantex_data_tl_clear:nn { #1 } { lowerleft } + \semantex_data_tl_clear:nn { #1 } { prelowerleft } + \semantex_data_tl_clear:nn { #1 } { postlowerleft } + \semantex_data_bool_set_false:nn { #1 } { nextlowerleftwithsep } + \semantex_data_int_clear:nn { #1 } { numberoflowerleftindices } + \semantex_data_tl_set:nnx { #1 } { heightphantom } + { + \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + } + \semantex_data_tl_clear:nn { #1 } { slantingphantom } +} -\cs_new:Npn \__semantex_symbol_parentheses_store:nnnnN#1#2#3#4#5 -% The central command handling the rendering of symbol parentheses +\cs_new_protected:Npn\semantex_left_pre_return:n#1 { - \tl_set:Nx#5 + \semantex_left_indices_return_store:nN { #1 } + \l__semantex_leftreturn_left_indices_temp + \semantex_data_tl_put_left:nnx { #1 } { symbol } { - { #2 } - { #3 } - { #4 } + \exp_not:V \l__semantex_leftreturn_left_indices_temp } - \str_case:xnF { #1 } % This is where \big,\Big, etc. go. To my surprise, an x-type expansion did not cause any issues with this + \semantex_data_bool_get:nnTF { #1 } { leftargument } { - { normal } { - \tl_put_left:Nn#5 + \semantex_arg_return_store:nN { #1 } \l__semantex_leftreturn_arg_temp + \semantex_data_tl_put_left:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_leftreturn_arg_temp + } + } + { + % do nothing + } +} + +\cs_new_protected:Npn \semantex_left_indices_return_store:nN#1#2 +{ + \tl_set:Nn#2{} + \semantex_data_int_if_positive:nnTF { #1 } { numberofupperleftindices } + { + \tl_put_right:Nn #2 { \manualleftindex } + \tl_put_right:Nx #2 + { + { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } + { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom} } { - \exp_not:N - \__semantex_symbol_parentheses_normal:nnn + \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } + \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } + \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } } - { auto } { - \tl_put_left:Nn#5 + \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerleftindices } + { + \tl_put_right:Nx#2 { - \exp_not:N - \__semantex_symbol_parentheses_auto:nnn + { + \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } + \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } + \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } + } } } - { * } { - \tl_put_left:Nn#5 + { + \tl_put_right:Nn#2 { - \exp_not:N - \__semantex_symbol_parentheses_auto:nnn + { } } } } { - \tl_put_right:Nx#5 + \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerleftindices } { - { \exp_not:V #1 } + \tl_put_right:Nn #2 { \manualleftindex } + \tl_put_right:Nx #2 + { + { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } + { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom} } + { } + { + \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } + \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } + \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } + } + } } - \tl_put_left:Nn#5 { - \exp_not:N - \__semantex_symbol_parentheses_other:nnnn + % do nothing } } } +\cs_new_protected:Npn \semantex_arg_return_store:nN#1#2 +{ + \semantex_data_tl_get_store:nnN { #1 } { parsize } \l__arg_return_store_parsize_temp_tl + \semantex_data_bool_get:nnTF { #1 } { par } + { + \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } + { + \semantex_parentheses_store:nN { #1 } #2 + } + { + \tl_set:Nn#2{} + } + } + { + \semantex_data_bool_get:nnTF { #1 } { flexpar } + { + \semantex_data_int_if_greater_than_one:nnTF { #1 } { numberofarguments } + { + \semantex_parentheses_store:nN { #1 } #2 + } + { + \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } + { + \semantex_no_parentheses_store:nN { #1 } #2 + } + { + \tl_set:Nn#2{} + } + } + } + { + \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } + { + \semantex_no_parentheses_store:nN { #1 } #2 + } + { + \tl_set:Nn#2{} + } + } + } +} +\cs_generate_variant:Nn \__semantex_parentheses_store:nnnnN { xxxxN , ooooN } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% COMMANDS FOR MODIFYING AND OBTAINING DATA +% COMMANDS HADNLING "spar" -- SYMBOL PARENTHESES % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%-------------------------------------------- -% Commands to modify and obtain data - -%\cs_new:Npn \semantex_data_tl_get_proto:nnn#1#2#3 -%{ -% % #1 = name of object -% % #2 = the data to get -% % #3 = also the name of object, but being stored -% % when passing to the parent, in order to make -% % error messages meaningful -% \tl_if_exist:cTF { g__semantex_data_tl_#1_#2 } -% { -% \use:c { g__semantex_data_tl_#1_#2 } -% } -% { -% \tl_if_eq:nnTF { #1 } { SemantexBaseObject } -% { -% \msg_error:nnnn { semantex } { data_tl_not_found } { #2 } { #3 } -% } -% { -% \semantex_data_tl_get_proto:nnn { \semantex_data_tl_get:nn { #1 } { parent } } { #2 } { #1 } -% } -% } -%} -% -%\cs_new:Npn \semantex_data_tl_get:nn#1#2 -%{ -% \semantex_data_tl_get_proto:nnn { #1 } { #2 } { #1 } -%} - - - -% COMMANDS FOR HANDLING THE PARENT OF A CLASS/OBJECT: - -\cs_new:Npn \semantex_data_parent_get:n#1 -{ - % #1 = object - % A command to get the parent of an object - \use:c { g__semantex_data_tl_#1_parent } -} - -\cs_new:Npn \semantex_data_parent_set:nn#1#2 +\cs_new_protected:Npn\semantex_spar:nn#1#2 { - \semantex_class_if_exist:NTF { #2 } + % Abbreviation for "symbol parentheses" + % Adds parentheses around the current symbol + \semantex_return:n { #1 } + \tl_if_blank:nTF { #2 } { - \tl_set:cx { g__semantex_data_tl_#1_parent } { class_\cs_to_str:N#2 } + \semantex_data_tl_get_store:nnN { #1 } { sparsize } + \l__semantex_spar_sparsize_temp_tl } { - \semantex_error_output_format:nN { #1 } \l__semantex_data_parent_set_temp_tl - \msg_error:nnxnn { semantex } { class_not_found } { \l__semantex_data_parent_set_temp_tl } { parent } { #2 } + \tl_set:Nn \l__semantex_spar_sparsize_temp_tl { #2 } } + \__semantex_symbol_parentheses_store:xxxxN + { \exp_not:V\l__semantex_spar_sparsize_temp_tl } + { \semantex_data_tl_get_exp_not:nn { #1 } { leftspar } } + { \semantex_data_tl_get_exp_not:nn { #1 } { rightspar } } + { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } + \l__semantex_spar_temp_tl + \semantex_data_tl_set:nnx { #1 } { symbol } + { + \exp_not:V \l__semantex_spar_temp_tl + } + \semantex_spar_set_height_phantom_to_parentheses_size:nx { #1 } + { \exp_not:V \l__semantex_spar_sparsize_temp_tl } } -\cs_new:Npn \semantex_data_class_set:nn#1#2 +\cs_new_protected:Npn\semantex_other_spar:nnn#1#2#3 { - \semantex_class_if_exist:NTF { #2 } - { - \tl_set:cx { g__semantex_data_tl_#1_parent } { class_\cs_to_str:N#2 } - } + \semantex_return:n { #1 } + \semantex_data_tl_get_store:nnN { #1 } { sparsize } + \l__semantex_other_spar_sparsize_temp_tl + \__semantex_symbol_parentheses_store:xxxxN + { \exp_not:V \l__semantex_other_spar_sparsize_temp_tl } + { \exp_not:n { #2 } } + { \exp_not:n { #3 } } + { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } + \l__semantex_other_spar_temp_tl + \semantex_data_tl_set:nnx { #1 } { symbol } { - \semantex_error_output_format:nN { #1 } \l__semantex_data_class_set_temp_tl - \msg_error:nnxnn { semantex } { class_not_found } { \l__semantex_data_class_set_temp_tl } { class } { #2 } + \exp_not:V \l__semantex_other_spar_temp_tl } + \semantex_spar_set_height_phantom_to_parentheses_size:nx { #1 } + { \exp_not:V \l__semantex_other_spar_sparsize_temp_tl } } -\cs_generate_variant:Nn \semantex_data_class_set:nn { xn } - -\cs_new:Npn \semantex_data_copy_object:nn#1#2 +\cs_new_protected:Npn\semantex_other_spar_with_size:nnnn#1#2#3#4 { - \semantex_object_if_exist:NTF { #2 } - { - \tl_set:cx { g__semantex_data_tl_#1_parent } { object_\cs_to_str:N#2 } - } + \semantex_return:n { #1 } + \__semantex_symbol_parentheses_store:xxxxN + { \exp_not:n { #4 } } + { \exp_not:n { #2 } } + { \exp_not:n { #3 } } + { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } + \l__semantex_other_spar_with_size_temp_tl + \semantex_data_tl_set:nnx { #1 } { symbol } { - \semantex_error_output_format:nN { #1 } \l__semantex_data_copy_object_temp_tl - \msg_error:nnxnn { semantex } { object_not_found } { \l__semantex_data_copy_object_temp_tl } { copy } { #2 } + \exp_not:V \l__semantex_other_spar_with_size_temp_tl } + \semantex_spar_set_height_phantom_to_parentheses_size:nn { #1 } + { #4 } } -\cs_new:Npn \semantex_data_clone_object:nn#1#2 +\cs_new_protected:Npn\semantex_spar_set_height_phantom_to_parentheses_size:nn#1#2 { - \semantex_object_if_exist:NTF { #2 } + % #1 = register + % #2 = parentheses size + \str_case:nnF { #2 } { - \tl_set:cx { g__semantex_data_tl_#1_parent } { object_\cs_to_str:N#2 } + { normal } { + \semantex_data_tl_set:nnn { #1 } { heightphantom } { \vert } + } + { auto } { + \semantex_data_tl_set:nnx { #1 } { heightphantom } + { + \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + } + } + { * } { + \semantex_data_tl_set:nnx { #1 } { heightphantom } + { + \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + } + } } { - \semantex_error_output_format:nN { #1 } \l__semantex_data_clone_object_temp_tl - \msg_error:nnxnn { semantex } { object_not_found } { \l__semantex_data_clone_object_temp_tl } { clone } { #2 } + \semantex_data_tl_set:nnx { #1 } { heightphantom } + { + \exp_not:n { #2 \vert } + } } } -% COMMANDS FOR HANDLING DATA CONSISTING OF COMMAND SEQUENCES: +\cs_generate_variant:Nn \semantex_spar_set_height_phantom_to_parentheses_size:nn { nx } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% COMMANDS FOR MODIFYING AND OBTAINING DATA +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% COMMANDS FOR HANDLING THE PARENT OF A CLASS/OBJECT: -\cs_new:Npn\semantex_data_cs_set:nnn#1#2#3 +\cs_new:Npn \semantex_data_parent_get:n#1 { - \cs_set:cn { __semantex_data_cs_#1_#2 } { #3 } + % #1 = register + % A command to get the parent of an object + \use:c { g__semantex_data_tl_#1_parent } } -\cs_generate_variant:Nn \cs_set:Nn { cn } - -\cs_generate_variant:Nn \semantex_data_cs_set:nnn { nno , nnV , nnv } +\cs_new_protected:Npn \semantex_data_parent_set:nn#1#2 +{ + % #1 = reigster + % Sets the parent + \semantex_class_if_exist:NTF { #2 } + { + \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_class_to_register:N #2 } + } + { + \semantex_msg_error:nnnn { #1 } { class_not_found } { parent } { #2 } + } +} -\cs_new:Npn\semantex_data_cs_get:nn#1#2 +\cs_new_protected:Npn \semantex_data_class_set:nn#1#2 { - % #1 = name of the object - % #2 = command sequence to get - \cs_if_exist:cTF { __semantex_data_cs_#1_#2 } + % #1 = register + % Sets the parent to be a class + \semantex_class_if_exist:NTF { #2 } { - \use:c { __semantex_data_cs_#1_#2 } + \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_class_to_register:N #2 } } { - \str_if_eq:nnTF { #1 } { class_SemantexVariable } - { - % should probably throw an error by now, but later! - } - { - \semantex_data_cs_get:fn { \semantex_data_parent_get:n {#1} } { #2 } - } + \semantex_msg_error:nnnn { #1 } { class_not_found } { class } { #2 } } } -\cs_generate_variant:Nn \semantex_data_cs_get:nn { fn } +\cs_generate_variant:Nn \semantex_data_class_set:nn { xn } -\cs_new:Npn\semantex_data_cs_get_exp_not:nn#1#2 +\cs_new_protected:Npn \semantex_data_copy_object:nn#1#2 { - % #1 = name of the object - % #2 = command sequence to get - \cs_if_exist:cTF { __semantex_data_cs_#1_#2 } + \semantex_object_if_exist:NTF { #2 } { - \exp_not:c { __semantex_data_cs_#1_#2 } + \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_object_to_register:N #2 } } { - \str_if_eq:nnTF { #1 } { class_SemantexVariable } - { - % should probably throw an error by now, but later! - } - { - \semantex_data_cs_get_exp_not:fn { \semantex_data_parent_get:n {#1} } { #2 } - } + \semantex_msg_error:nnnn { #1 } { object_not_found } { copy } { #2 } } } -\cs_generate_variant:Nn \semantex_data_cs_get_exp_not:nn { fn } - -\cs_new:Npn\semantex_data_cs_clear:nn#1#2 +\cs_new_protected:Npn \semantex_data_clone_object:nn#1#2 { - \cs_set:cn { __semantex_data_cs_#1_#2 } {} + \semantex_object_if_exist:NTF { #2 } + { + \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_object_to_register:N #2 } + } + { + \semantex_msg_error:nnnn { #1 } { object_not_found } { clone } { #2 } + } } % COMMANDS FOR HANDLING DATA CONSISTING OF TOKEN LISTS @@ -1704,24 +2259,19 @@ \__semantex_data_tl_get_auxiliary:nnn { #1 } { #2 } { #1 } } -\cs_generate_variant:Nn \str_if_eq:nnTF { fnTF } - -\cs_generate_variant:Nn \tl_if_eq:nnTF { fnTF } - \cs_new:Npn \__semantex_data_tl_get_auxiliary:nnn#1#2#3 { - % #1 = name of class/object + % #1 = name of register % #2 = the data to get - % #3 = the original class/object, used for error messaging + % #3 = the original register, used for error messaging \tl_if_exist:cTF { g__semantex_data_tl_#1_#2 } { \use:c { g__semantex_data_tl_#1_#2 } } { - \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } % Apparently, f-type expansion seemed to work here for once + \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #3 } \l__semantex_data_tl_get_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_tl_not_found } { \l__semantex_data_tl_get_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #3 } { data_tl_not_found } { #2 } } { \__semantex_data_tl_get_auxiliary:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -1731,40 +2281,26 @@ \cs_generate_variant:Nn \__semantex_data_tl_get_auxiliary:nnn { fnn } -%\cs_new:Npn \semantex_data_tl_get_exp_not:nn#1#2 -%{ -% % #1 = name of object -% % #2 = the data to get -% \tl_if_exist:cTF { g__semantex_data_tl_#1_#2 } -% { -% \exp_not:v { g__semantex_data_tl_#1_#2 } -% } -% { -% \semantex_data_tl_get:nn { \semantex_data_parent_get:n { #1 } } { #2 } -% } -%} - \cs_new:Npn \semantex_data_tl_get_exp_not:nn#1#2 { - % #1 = name of object + % #1 = name of register % #2 = the data to get \__semantex_data_tl_get_exp_not_auxiliary:nnn { #1 } { #2 } { #1 } } \cs_new:Npn \__semantex_data_tl_get_exp_not_auxiliary:nnn#1#2#3 { - % #1 = name of class/object + % #1 = name of register % #2 = the data to get - % #3 = the original class/object, used for error messaging + % #3 = the original register, used for error messaging \tl_if_exist:cTF { g__semantex_data_tl_#1_#2 } { \exp_not:v { g__semantex_data_tl_#1_#2 } } { - \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } % Apparently, f-type expansion seemed to work here for once + \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #3 } \l__semantex_data_tl_get_exp_not_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_tl_not_found } { \l__semantex_data_tl_get_exp_not_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #3 } { data_tl_not_found } { #2 } } { \__semantex_data_tl_get_exp_not_auxiliary:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -1774,8 +2310,7 @@ \cs_generate_variant:Nn \__semantex_data_tl_get_exp_not_auxiliary:nnn { fnn } - -\cs_new:Npn \semantex_data_tl_get_store:nnN#1#2#3% maybe should be PROTECTED?? +\cs_new_protected:Npn \semantex_data_tl_get_store:nnN#1#2#3 { % #1 = name of object % #2 = the data to get @@ -1783,11 +2318,12 @@ \__semantex_data_tl_get_store_auxiliary:nnNn { #1 } { #2 } #3 { #1 } } -\cs_new:Npn \__semantex_data_tl_get_store_auxiliary:nnNn#1#2#3#4% maybe should be PROTECTED?? +\cs_new_protected:Npn \__semantex_data_tl_get_store_auxiliary:nnNn#1#2#3#4 { - % #1 = name of object + % #1 = name of register % #2 = the data to get % #3 = where to store it + % #4 = name of original register, for error message purposes \tl_if_exist:cTF { g__semantex_data_tl_#1_#2 } { \tl_set_eq:Nc #3 { g__semantex_data_tl_#1_#2 } @@ -1795,8 +2331,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #4 } \l__semantex_data_tl_get_store_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_tl_not_found } { \l__semantex_data_tl_get_store_auxiliary_temp_tl } { #2 } + \msg_error:nnn { #4 } { data_tl_not_found } { #2 } } { \__semantex_data_tl_get_store_auxiliary:fnNn { \semantex_data_parent_get:n { #1 } } { #2 } #3 { #4 } @@ -1808,17 +2343,19 @@ \cs_generate_variant:Nn \semantex_data_tl_get_store:nnN { nnc } -\cs_new:Npn\semantex_data_tl_provide:nn#1#2 +\cs_new_protected:Npn\semantex_data_tl_provide:nn#1#2 { + % #1 = name of register + % #2 = the data to provide \tl_if_exist:cF { g__semantex_data_tl_#1_#2 } { \tl_set:cn { g__semantex_data_tl_#1_#2 } {} } } -\cs_new:Npn\semantex_data_tl_inherit:nn#1#2 +\cs_new_protected:Npn\semantex_data_tl_inherit:nn#1#2 { - % #1 = object + % #1 = register % #2 = piece of token list data % Takes the data #2 from the parent of #1 and saves it locally % to the object #1. After this, no more inheritance is taking place @@ -1830,21 +2367,15 @@ } } -\cs_set_eq:NN\semantex_data_tl_inherit_x:nn\semantex_data_tl_inherit:nn - % The same as inherit; historically, this one did an x type - % expansion first, but after changes in other places, this - % no longer appeard to be necessary. I decided to keep up the - % separation of the two, just in case. - -\cs_new:Npn \semantex_data_tl_set:nnn#1#2#3 +\cs_new_protected:Npn \semantex_data_tl_set:nnn#1#2#3 { \tl_set:cn { g__semantex_data_tl_#1_#2 } { #3 } } -\cs_generate_variant:Nn \semantex_data_tl_set:nnn { nnx , xnn , xnx } +\cs_generate_variant:Nn \semantex_data_tl_set:nnn { nnx } -\cs_new:Npn \semantex_data_tl_put_right:nnn#1#2#3 +\cs_new_protected:Npn \semantex_data_tl_put_right:nnn#1#2#3 { \semantex_data_tl_inherit:nn { #1 } { #2 } \tl_put_right:cn { g__semantex_data_tl_#1_#2 } { #3 } @@ -1852,7 +2383,7 @@ \cs_generate_variant:Nn \semantex_data_tl_put_right:nnn { nnx } -\cs_new:Npn \semantex_data_tl_put_left:nnn#1#2#3 +\cs_new_protected:Npn \semantex_data_tl_put_left:nnn#1#2#3 { \semantex_data_tl_inherit:nn { #1 } { #2 } \tl_put_left:cn { g__semantex_data_tl_#1_#2 } { #3 } @@ -1860,7 +2391,7 @@ \cs_generate_variant:Nn \semantex_data_tl_put_left:nnn { nnx } -\cs_new:Npn \semantex_data_tl_clear:nn#1#2 +\cs_new_protected:Npn \semantex_data_tl_clear:nn#1#2 { \semantex_data_tl_provide:nn { #1 } { #2 } \tl_clear:c { g__semantex_data_tl_#1_#2 } @@ -1868,7 +2399,7 @@ % DATA OF TYPE INTEGER: -\cs_new:Npn\semantex_data_int_provide:nn#1#2 +\cs_new_protected:Npn\semantex_data_int_provide:nn#1#2 { \bool_if_exist:cTF { g__semantex_data_int_#1_#2_bool_if_provided } { @@ -1884,13 +2415,14 @@ } } -\cs_new:Npn\semantex_data_int_inherit:nn#1#2 +\cs_new_protected:Npn\semantex_data_int_inherit:nn#1#2 { \bool_if_exist:cTF { g__semantex_data_int_#1_#2_bool_if_provided } { \bool_if:cF { g__semantex_data_int_#1_#2_bool_if_provided } { - \semantex_data_int_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } { g__semantex_data_int_#1_#2 } + \semantex_data_int_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } + { g__semantex_data_int_#1_#2 } \bool_set_true:c { g__semantex_data_int_#1_#2_bool_if_provided } } } @@ -1898,21 +2430,21 @@ \bool_new:c { g__semantex_data_int_#1_#2_bool_if_provided } \bool_set_true:c { g__semantex_data_int_#1_#2_bool_if_provided } \int_new:c { g__semantex_data_int_#1_#2 } - \semantex_data_int_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } { g__semantex_data_int_#1_#2 } + \semantex_data_int_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } + { g__semantex_data_int_#1_#2 } } } -\cs_new:Npn \semantex_data_int_get:nn#1#2{% maybe should be PROTECTED?? +\cs_new:Npn \semantex_data_int_get:nn#1#2{ % #1 = name of object % #2 = the intuence to get - % #3 = the command to store it in \__semantex_data_int_get_auxiliary:nnn { #1 } { #2 } { #1 } } -\cs_new:Npn \__semantex_data_int_get_auxiliary:nnn#1#2#3{% maybe should be PROTECTED?? +\cs_new:Npn \__semantex_data_int_get_auxiliary:nnn#1#2#3{ % #1 = name of object % #2 = the intuence to get - % #3 = the command to store it in + % #3 = stores the original register, for error message purposes \bool_if_exist:cTF { g__semantex_data_int_#1_#2_bool_if_provided } { \bool_if:cTF { g__semantex_data_int_#1_#2_bool_if_provided } @@ -1922,8 +2454,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #3 } \__semantex_data_int_get_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_int_not_found } { \__semantex_data_int_get_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #3 } { data_int_not_found } { #2 } } { \__semantex_data_int_get_auxiliary:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -1933,8 +2464,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #3 } \__semantex_data_int_get_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_int_not_found } { \__semantex_data_int_get_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #3 } { data_int_not_found } { #2 } } { \__semantex_data_int_get_auxiliary:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -1945,14 +2475,14 @@ \cs_generate_variant:Nn \__semantex_data_int_get_auxiliary:nnn { fnn } -\cs_new:Npn \semantex_data_int_get_store:nnN#1#2#3{% maybe should be PROTECTED?? +\cs_new_protected:Npn \semantex_data_int_get_store:nnN#1#2#3{ % #1 = name of object % #2 = the intuence to get % #3 = the command to store it in \__semantex_data_int_get_store_auxiliary:nnNn { #1 } { #2 } #3 { #1 } } -\cs_new:Npn\__semantex_data_int_get_store_auxiliary:nnNn#1#2#3#4{% maybe should be PROTECTED?? +\cs_new_protected:Npn\__semantex_data_int_get_store_auxiliary:nnNn#1#2#3#4{ % #1 = name of object % #2 = the intuence to get % #3 = the command to store it in @@ -1965,8 +2495,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #4 } \l__semantex_data_int_get_store_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_int_not_found } { \l__semantex_data_int_get_store_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #4 } { data_int_not_found } { #2 } } { \__semantex_data_int_get_store_auxiliary:fnNn { \semantex_data_parent_get:n { #1 } } { #2 } #3 { #4 } @@ -1976,8 +2505,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #4 } \l__semantex_data_int_get_store_auxiliary_temp_tl - \msg_error:nnxn { semantex } { data_int_not_found } { \l__semantex_data_int_get_store_auxiliary_temp_tl } { #2 } + \semantex_msg_error:nnn { #4 } { data_int_not_found } { #2 } } { \__semantex_data_int_get_store_auxiliary:fnNn { \semantex_data_parent_get:n { #1 } } { #2 } #3 { #4 } @@ -1989,59 +2517,29 @@ \cs_generate_variant:Nn \semantex_data_int_get_store:nnN { nnc } -\cs_new:Npn\semantex_data_int_incr:nn#1#2 +\cs_new_protected:Npn\semantex_data_int_incr:nn#1#2 { \semantex_data_int_inherit:nn { #1 } { #2 } \int_incr:c { g__semantex_data_int_#1_#2 } } -\cs_new:Npn\semantex_data_int_set:nnn#1#2#3 +\cs_new_protected:Npn\semantex_data_int_set:nnn#1#2#3 { \semantex_data_int_provide:nn { #1 } { #2 } \int_set:cn { g__semantex_data_int_#1_#2 } { #3 } } -\cs_new:Npn\semantex_data_int_if_positive:nnTF#1#2#3#4 +\cs_new_protected:Npn\semantex_data_int_if_positive:nnTF#1#2#3#4 { -% \semantex_data_int_inherit:nn { #1 } { #2 } % This should not be necessary, ubt is, for unkonwn reasons \int_compare:nNnTF { \semantex_data_int_get:nn { #1 } { #2 } } > { 0 } { #3 } { #4 } } -\cs_generate_variant:Nn\semantex_data_int_if_positive:nnTF { nnT } - -\cs_new:Npn\semantex_data_int_if_positive:nnF#1#2#3 -{ - \semantex_data_int_if_positive:nnTF { #1 } { #2 } { } { #3 } -} - -\cs_new:Npn\semantex_data_int_if_greater_than_one:nnTF#1#2#3#4 +\cs_new_protected:Npn\semantex_data_int_if_greater_than_one:nnTF#1#2#3#4 { \int_compare:nNnTF { \semantex_data_int_get:nn { #1 } { #2 } } > { 1 } { #3 } { #4 } } -\cs_generate_variant:Nn\semantex_data_int_if_greater_than_one:nnTF { nnT } - -\cs_new:Npn\semantex_data_int_if_greater_than_one:nnF#1#2#3 -{ - \semantex_data_int_if_greater_than_one:nnTF { #1 } { #2 } { } { #3 } -} - -\cs_new:Npn\semantex_data_int_if_greater_than:nnnTF#1#2#3#4#5 -{ - \int_compare:nNnTF { \semantex_data_int_get:nn { #1 } { #2 } } > { #3 } { #4 } { #5 } -} - -\cs_new:Npn\semantex_data_int_if_less_than:nnnTF#1#2#3#4#5 -{ - \int_compare:nNnTF { \semantex_data_int_get:nn { #1 } { #2 } } < { #3 } { #4 } { #5 } -} - -\cs_new:Npn\semantex_data_int_if_equal:nnnTF#1#2#3#4#5 -{ - \int_compare:nNnTF { \semantex_data_int_get:nn { #1 } { #2 } } < { #3 } { #4 } { #5 } -} - -\cs_new:Npn\semantex_data_int_clear:nn#1#2 +\cs_new_protected:Npn\semantex_data_int_clear:nn#1#2 { \semantex_data_int_provide:nn { #1 } { #2 } \int_zero:c { g__semantex_data_int_#1_#2 } @@ -2049,7 +2547,7 @@ % COMMANDS FOR HANDLING DATA OF SEQUENCE TYPE -\cs_new:Npn \semantex_data_seq_get_store:nnN#1#2#3{% maybe should be PROTECTED?? +\cs_new_protected:Npn \semantex_data_seq_get_store:nnN#1#2#3{ % #1 = name of object % #2 = the sequence to get % #3 = the command to store it in @@ -2060,17 +2558,17 @@ \seq_set_eq:Nc#3 { g__semantex_data_seq_#1_#2 } } { - \semantex_data_seq_get_store:nnN{ \semantex_data_parent_get:n { #1 } }{#2}#3 + \semantex_data_seq_get_store:nnN { \semantex_data_parent_get:n { #1 } } { #2 } #3 } } { - \semantex_data_seq_get_store:nnN{ \semantex_data_parent_get:n { #1 } }{#2}#3% + \semantex_data_seq_get_store:nnN { \semantex_data_parent_get:n { #1 } } { #2 } #3 } } -\cs_generate_variant:Nn \semantex_data_seq_get_store:nnN { vnN, nnc, vnc } % Remove these later +\cs_generate_variant:Nn \semantex_data_seq_get_store:nnN { nnc } -\cs_new:Npn\semantex_data_seq_provide:nn#1#2 +\cs_new_protected:Npn\semantex_data_seq_provide:nn#1#2 { \bool_if_exist:cTF { g__semantex_data_seq_#1_#2_bool_if_provided } { @@ -2086,7 +2584,7 @@ } } -\cs_new:Npn\semantex_data_seq_inherit:nn#1#2 +\cs_new_protected:Npn\semantex_data_seq_inherit:nn#1#2 { \bool_if_exist:cTF { g__semantex_data_seq_#1_#2_bool_if_provided } { @@ -2097,20 +2595,20 @@ } } { - \semantex_data_seq_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } { g__semantex_data_seq_#1_#2 } \bool_new:c { g__semantex_data_seq_#1_#2_bool_if_provided } \bool_set_true:c { g__semantex_data_seq_#1_#2_bool_if_provided } \seq_if_exist:cF { g__semantex_data_seq_#1_#2 } { \seq_new:c { g__semantex_data_seq_#1_#2 } } + \semantex_data_seq_get_store:nnc { \semantex_data_parent_get:n { #1 } } { #2 } { g__semantex_data_seq_#1_#2 } } } -\cs_new:Npn\semantex_data_seq_put_right:nnn#1#2#3 +\cs_new_protected:Npn\semantex_data_seq_put_right:nnn#1#2#3 { \semantex_data_seq_inherit:nn { #1 } { #2 } \seq_put_right:cn { g__semantex_data_seq_#1_#2 } { #3 } } -\cs_new:Npn\semantex_data_seq_clear:nn#1#2 +\cs_new_protected:Npn\semantex_data_seq_clear:nn#1#2 { \semantex_data_seq_provide:nn { #1 } { #2 } \seq_clear:c { g__semantex_data_seq_#1_#2 } @@ -2151,16 +2649,16 @@ } } -\cs_generate_variant:Nn \semantex_data_bool_get:nnTF { onTF, fnTF, xnTF, vnTF, nnT } +\cs_generate_variant:Nn \semantex_data_bool_get:nnTF { fnTF, nnT } \cs_new:Npn\semantex_data_bool_get:nnF#1#2#3 { \semantex_data_bool_get:nnTF { #1 } { #2 } { } { #3 } } -\cs_new:Npn\semantex_data_bool_provide:nn#1#2 +\cs_new_protected:Npn\semantex_data_bool_provide:nn#1#2 { - % #1 = name of the object + % #1 = name of the register % #2 = boolean to provide \bool_if_exist:cTF { g__semantex_data_bool_#1_if_#2_bool_if_provided } { @@ -2176,73 +2674,99 @@ } } -\cs_new:Npn\semantex_data_bool_set_true:nn#1#2 +\cs_new_protected:Npn\semantex_data_bool_set_true:nn#1#2 { - % #1 = name of the object - % #2 = boolean to provide + % #1 = name of the register + % #2 = boolean to set true \semantex_data_bool_provide:nn { #1 } { #2 } \bool_set_true:c { g__semantex_data_bool_#1_if_#2 } } -\cs_generate_variant:Nn \semantex_data_bool_set_true:nn { xn } - -\cs_new:Npn\semantex_data_bool_set_false:nn#1#2 +\cs_new_protected:Npn\semantex_data_bool_set_false:nn#1#2 { - % #1 = name of the object - % #2 = boolean to provide + % #1 = name of the register + % #2 = boolean to set false \semantex_data_bool_provide:nn { #1 } { #2 } \bool_set_false:c { g__semantex_data_bool_#1_if_#2 } } -% COMMANDS FOR HANDLING COMMAND SEQUENCE DATA AND KEYVAL SYNTAX: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% COMMANDS FOR HANDLING KEYVAL INTERFACES +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_generate_variant:Nn \keyval_parse:NNn { cco , ccn } +\cs_generate_variant:Nn \semantex_keyval_parse:NNn { ccn } -\cs_new:Npn \semantex_keys_set:nn#1#2 +\cs_new_protected:Npn \semantex_keys_set:nn#1#2 { - \semantex_provide_user_commands:n { #1 } + \cs_set_eq:NN\l__semantex_keys_set_old_this_temp_cs:\semantex_this: + \cs_set:Nn\semantex_this:{#1} % The central command for doing keyval setup % #1 = object % #2 = keys - \keyval_parse:ccn % Used to use o-type expansions, but no longer seems necessary - { __semantex_data_cs_#1_singlekey:n } - { __semantex_data_cs_#1_valuekey:nn } - { #2 } + \semantex_keyval_parse:ccn % Used to use o-type expansions, but no longer seems necessary + { __semantex_data_cs_#1_singlekey:n } + { __semantex_data_cs_#1_valuekey:nn } + { #2 } + \cs_set_eq:NN\semantex_this:\l__semantex_keys_set_old_this_temp_cs: } -\cs_new:Npn \semantex_arg_keys_set:nn#1#2 +\cs_new_protected:Npn \semantex_keys_set_x:nn#1#2 +{ + \cs_set_eq:NN\l__semantex_keys_set_old_this_temp_cs:\semantex_this: + \cs_set:Nn\semantex_this:{#1} + % The central command for doing expanded keyval setup + % #1 = object + % #2 = keys + \semantex_keyval_parse:ccn % Used to use o-type expansions, but no longer seems necessary + { __semantex_data_cs_#1_singlekey_x:n } + { __semantex_data_cs_#1_valuekey:nx } + { #2 } + \cs_set_eq:NN\semantex_this:\l__semantex_keys_set_old_this_temp_cs: +} + +\cs_new_protected:Npn \semantex_arg_keys_set:nn#1#2 { % The central command for doing keyval setup for the argument % #1 = object % #2 = keys - \keyval_parse:ccn % See last command - { __semantex_data_cs_#1_arg_singlekey:n } - { __semantex_data_cs_#1_arg_valuekey:nn } - { #2 } + \semantex_keyval_parse:ccn % See last command + { __semantex_data_cs_#1_arg_singlekey:n } + { __semantex_data_cs_#1_arg_valuekey:nn } + { #2 } +} + +\cs_new_protected:Npn \semantex_arg_keys_set_x:nn#1#2 +{ + % The central command for doing expanded keyval setup for the argument + % #1 = object + % #2 = keys + \semantex_keyval_parse:ccn % See last command + { __semantex_data_cs_#1_arg_singlekey_x:n } + { __semantex_data_cs_#1_arg_valuekey:nx } + { #2 } } \cs_generate_variant:Nn \clist_map_function:nN { nc } -\cs_new:Npn \semantex_arg_singlekeys_set:nn#1#2 +\cs_new_protected:Npn \semantex_arg_singlekeys_set:nn#1#2 { % This command is necessary because you sometimes want to only allow singlekeys % and not valuekeys in arguments (for instance, if you allow valuekeys, anything - % containing an equality sign will die horribly in the argument of any object + % containing an equality sign will die horribly in the argument of any object) \clist_map_function:nc {#2} { __semantex_data_cs_#1_arg_singlekey:n } } -\cs_generate_variant:Nn \semantex_keys_set:nn { xn } - \DeclareDocumentCommand\SetupClass{mm}{ % a user-level command for setting up the object % #1 = class % #2 = setup \semantex_class_if_exist:NTF #1 { - \semantex_keys_set:xn { class_\cs_to_str:N #1 }{ #2 } + \semantex_keys_set:nn { \semantex_class_to_register:N #1 }{ #2 } } { - \semantex_error_output_format:xN { class_\cs_to_str:N #1 } \l__setup_class_temp_tl - \msg_error:nnx { semantex } { setup_unknown_class } { \l__setup_class_temp_tl } + \semantex_msg_error:nn { \semantex_class_to_register:N #1 } { setup_unknown_class } } } @@ -2251,25 +2775,25 @@ % #2 = setup \semantex_object_if_exist:NTF #1 { - \semantex_keys_set:xn { object_\cs_to_str:N #1 }{ #2 } + \semantex_keys_set:nn { \semantex_object_to_register:N #1 }{ #2 } } { - \semantex_error_output_format:xN { object_\cs_to_str:N #1 } \l__setup_object_temp_tl - \msg_error:nnx { semantex } { setup_unknown_object } { \l__setup_object_temp_tl } + \semantex_msg_error:nn { \semantex_object_to_register:N #1 } { setup_unknown_object } } } -\cs_new:Npn\semantex_valuekey:nnn#1#2#3 +\cs_new_protected:Npn\semantex_valuekey:nnn#1#2#3 { + % The central command for executing valuekeys, + % i.e. keys taking a value + % #1 = register + % #2 = name of the key + % #3 = value \__semantex_valuekey:nnnn { #1 } { #2 } { #3 } { #1 } } -\cs_new:Npn \__semantex_valuekey:nnnn#1#2#3#4 +\cs_new_protected:Npn \__semantex_valuekey:nnnn#1#2#3#4 { - % Takes care of valuekeys, keys taking a value - % #1 = class/object - % #2 = name of the key - % #3 = value \cs_if_exist:cTF { __semantex_data_cs_custom_valuekey_#1_#2:nn } { \use:c { __semantex_data_cs_custom_valuekey_#1_#2:nn } { #4 } { #3 } @@ -2277,8 +2801,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #4 } \l__semantex_valuekey_unknown_key_temp_tl - \msg_error:nnxn { semantex } { valuekey_not_found } { \l__semantex_valuekey_unknown_key_temp_tl } { #2 } + \semantex_msg_error:nnn { #4 } { valuekey_not_found } { #2 } } { \__semantex_valuekey:fnnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } { #4 } @@ -2288,18 +2811,37 @@ \cs_generate_variant:Nn \__semantex_valuekey:nnnn { fnnn } -\cs_generate_variant:Nn \semantex_valuekey:nnn { xnn } +\cs_generate_variant:Nn \semantex_valuekey:nnn { nnx } -\cs_new:Npn\semantex_singlekey:nn#1#2 +\cs_new_protected:Npn\semantex_base_object_valuekey:nnn#1#2#3 { - \__semantex_singlekey:nnn { #1 } { #2 } { #1 } + % Skips through the steps above to go directly to the + % valuekey as defined by \SemantexBaseObject. + % This is only being used in the rendering routine, + % so so far, an corresponding command for singlekeys + % has not been needed. + % #1 = register + % #2 = key + % #3 = value + \use:c { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_#2:nn } { #1 } { #3 } } -\cs_new:Npn\__semantex_singlekey:nnn#1#2#3 +\cs_new_protected:Npn\semantex_singlekey:nn#1#2 { - % #1 = class/object + % The central command for executing singlekeys, + % i.e. keys taking no + % #1 = register % #2 = name of the key - \cs_if_exist:cTF { \tl_to_str:n{__semantex_data_cs_custom_singlekey_#1_#2:n } } + \__semantex_singlekey:nnn { #1 } { #2 } { #1 } +} + +\cs_new_protected:Npn\__semantex_singlekey:nnn#1#2#3 +{ + \cs_if_exist:cTF { __semantex_data_cs_custom_singlekey_#1_\tl_to_str:n{ #2 }:n } + % This is necessary in order to allow the case where something nasty + % and unexpandable gets passed as singlekey -- this often happens + % because of the convention that \<Object>[<something not a key>] + % just prints <something not a key> { \use:c { __semantex_data_cs_custom_singlekey_#1_#2:n } { #3 } } @@ -2307,7 +2849,6 @@ \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { \semantex_valuekey:nnn { #3 } { default } { #2 } - %#2 } { \__semantex_singlekey:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -2317,22 +2858,48 @@ \cs_generate_variant:Nn \__semantex_singlekey:nnn { fnn } -\cs_generate_variant:Nn \semantex_singlekey:nn { xn } +\cs_new_protected:Npn\semantex_singlekey_x:nn#1#2 +{ + % The central command for executing expanded singlekeys, + % i.e. keys taking no + % #1 = register + % #2 = name of the key + \__semantex_singlekey_x:nnn { #1 } { #2 } { #1 } +} -\cs_new:Npn\semantex_arg_valuekey:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_singlekey_x:nnn#1#2#3 { - % CHANGE ORDER OF KEYS - \__semantex_arg_valuekey:nnnn { #1 } { #2 } { #3 } { #1 } + \cs_if_exist:cTF { __semantex_data_cs_custom_singlekey_#1_\tl_to_str:n{ #2 }:n } + { + \use:c { __semantex_data_cs_custom_singlekey_#1_#2:n } { #3 } + % and no, we don't want :x here; we don't need to expand + % the name of the register + } + { + \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } + { + \semantex_valuekey:nnx { #3 } { default } { #2 } + } + { + \__semantex_singlekey_x:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } + } + } } -\cs_new:Npn \__semantex_arg_valuekey:nnnn#1#2#3#4 +\cs_generate_variant:Nn \__semantex_singlekey_x:nnn { fnn } + +\cs_new_protected:Npn\semantex_arg_valuekey:nnn#1#2#3 { - % Takes care of valuekeys, keys with a value - % For the sake of implementation, the arguments - % come in a strange order - % #1 = class/object + % Takes care of argument valuekeys, + % i.e. argument keys with a value + % #1 = register % #2 = name of the key % #3 = value of the key + \__semantex_arg_valuekey:nnnn { #1 } { #2 } { #3 } { #1 } +} + +\cs_new_protected:Npn \__semantex_arg_valuekey:nnnn#1#2#3#4 +{ \cs_if_exist:cTF { __semantex_data_cs_custom_arg_valuekey_#1_#2:nn } { \use:c { __semantex_data_cs_custom_arg_valuekey_#1_#2:nn } { #4 } { #3 } @@ -2340,8 +2907,7 @@ { \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { - \semantex_error_output_format:nN { #4 } \l__semantex_valuekey_unknown_arg_key_temp_tl - \msg_error:nnxn { semantex } { arg_valuekey_not_found } { \l__semantex_valuekey_unknown_arg_key_temp_tl } { #2 } + \msg_error:nnn { #1 } { arg_valuekey_not_found } { #2 } } { \__semantex_arg_valuekey:fnnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } { #4 } @@ -2351,16 +2917,20 @@ \cs_generate_variant:Nn \__semantex_arg_valuekey:nnnn { fnnn } -\cs_new:Npn \semantex_arg_singlekey:nn#1#2 +\cs_generate_variant:Nn \semantex_arg_valuekey:nnn { nnx } + +\cs_new_protected:Npn \semantex_arg_singlekey:nn#1#2 { + % The central command for executing argument singlekeys, + % i.e. keys taking no + % #1 = register + % #2 = name of the key \__semantex_arg_singlekey:nnn { #1 } { #2 } { #1 } } -\cs_new:Npn \__semantex_arg_singlekey:nnn#1#2#3 +\cs_new_protected:Npn \__semantex_arg_singlekey:nnn#1#2#3 { - % #1 = class/object - % #2 = name of the key - \cs_if_exist:cTF { \tl_to_str:n{__semantex_data_cs_custom_arg_singlekey_#1_#2:n } } + \cs_if_exist:cTF { __semantex_data_cs_custom_arg_singlekey_#1_\tl_to_str:n{ #2 }:n } { \use:c { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } { #3 } } @@ -2368,7 +2938,6 @@ \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } { \semantex_arg_valuekey:nnn { #3 } { default } { #2 } - %#2 } { \__semantex_arg_singlekey:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } @@ -2378,4018 +2947,2734 @@ \cs_generate_variant:Nn \__semantex_arg_singlekey:nnn { fnn } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% THE VALUEKEYS FOR \SemantexBaseObject -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% Now for the commands that are the basis of the keyval interface, -% namely the keys providing the keyval interface for the -% class \SemantexBaseObject. For historical reasons, they are defined -% as below as standalone commands and not when delcaring the -% class \SemantexBaseObject. I hope to change this in the future, but -% this is purely a matter of aesthetics, with no practical consequences. - -% For all of them, #1 = name of the class/object, and #2 = value of -% the key. - -% First, some very simple keys that we shall need over and over again: - -\cs_new:Npn\semantex_grab_first_argument_of_two:nn#1#2{#1} -\cs_new:Npn\semantex_grab_second_argument_of_two:nn#1#2{#2} - -\cs_new:Npn\semantex_grab_first_argument_of_three:nnn#1#2#3{#1} -\cs_new:Npn\semantex_grab_second_argument_of_three:nnn#1#2#3{#2} -\cs_new:Npn\semantex_grab_third_argument_of_three:nnn#1#2#3{#3} - -\cs_new:Npn\semantex_grab_first_argument_of_four:nnnn#1#2#3#4{#1} -\cs_new:Npn\semantex_grab_second_argument_of_four:nnnn#1#2#3#4{#2} -\cs_new:Npn\semantex_grab_third_argument_of_four:nnnn#1#2#3#4{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_four:nnnn#1#2#3#4{#4} - -\cs_new:Npn\semantex_grab_first_argument_of_five:nnnnn#1#2#3#4#5{#1} -\cs_new:Npn\semantex_grab_second_argument_of_five:nnnnn#1#2#3#4#5{#2} -\cs_new:Npn\semantex_grab_third_argument_of_five:nnnnn#1#2#3#4#5{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_five:nnnnn#1#2#3#4#5{#4} -\cs_new:Npn\semantex_grab_fifth_argument_of_five:nnnnn#1#2#3#4#5{#5} - -\cs_new:Npn\semantex_grab_first_argument_of_six:nnnnnn#1#2#3#4#5#6{#1} -\cs_new:Npn\semantex_grab_second_argument_of_six:nnnnnn#1#2#3#4#5#6{#2} -\cs_new:Npn\semantex_grab_third_argument_of_six:nnnnnn#1#2#3#4#5#6{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_six:nnnnnn#1#2#3#4#5#6{#4} -\cs_new:Npn\semantex_grab_fifth_argument_of_six:nnnnnn#1#2#3#4#5#6{#5} -\cs_new:Npn\semantex_grab_sixth_argument_of_six:nnnnnn#1#2#3#4#5#6{#6} - -\cs_new:Npn\semantex_grab_first_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#1} -\cs_new:Npn\semantex_grab_second_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#2} -\cs_new:Npn\semantex_grab_third_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#4} -\cs_new:Npn\semantex_grab_fifth_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#5} -\cs_new:Npn\semantex_grab_sixth_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#6} -\cs_new:Npn\semantex_grab_seventh_argument_of_seven:nnnnnnn#1#2#3#4#5#6#7{#7} - -\cs_new:Npn\semantex_grab_first_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#1} -\cs_new:Npn\semantex_grab_second_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#2} -\cs_new:Npn\semantex_grab_third_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#4} -\cs_new:Npn\semantex_grab_fifth_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#5} -\cs_new:Npn\semantex_grab_sixth_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#6} -\cs_new:Npn\semantex_grab_seventh_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#7} -\cs_new:Npn\semantex_grab_eighth_argument_of_eight:nnnnnnnn#1#2#3#4#5#6#7#8{#8} - -\cs_new:Npn\semantex_grab_first_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#1} -\cs_new:Npn\semantex_grab_second_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#2} -\cs_new:Npn\semantex_grab_third_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#3} -\cs_new:Npn\semantex_grab_fourth_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#4} -\cs_new:Npn\semantex_grab_fifth_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#5} -\cs_new:Npn\semantex_grab_sixth_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#6} -\cs_new:Npn\semantex_grab_seventh_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#7} -\cs_new:Npn\semantex_grab_eighth_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#8} -\cs_new:Npn\semantex_grab_ninth_argument_of_nine:nnnnnnnnn#1#2#3#4#5#6#7#8#9{#9} - - -\cs_generate_variant:Nn\str_if_eq:nnTF {xxTF,ooTF} - -\cs_generate_variant:Nn\str_if_eq:nnT {xxT, ooT} - -\cs_generate_variant:Nn\str_if_eq:nnF {xxF, ooF} - -\cs_generate_variant:Nn\tl_if_blank:nTF { xTF, xT } - -\cs_generate_variant:Nn \tl_if_blank:nF { xF } - -\cs_new:Npn\semantex_provide_user_commands:n#1 -{ - % This keys just executes whatever data you plug into it. - % Possibly, going forward, it might make more sense to define all - % of these commands in the keyval handling command - % so that the get commands are accessible from all keys. - \cs_set:Npn\SemantexDataProvide##1{\semantex_data_tl_provide:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexDataSet##1##2{\semantex_data_tl_set:nnn{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataSetx##1##2{\semantex_data_tl_set:nnx{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataPutRight##1##2{\semantex_data_tl_put_right:nnn{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataPutRightx##1##2{\semantex_data_tl_put_right:nnx{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataPutLeft##1##2{\semantex_data_tl_put_left:nnn{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataPutLeftx##1##2{\semantex_data_tl_put_left:nnx{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexDataGet##1{\semantex_data_tl_get:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexDataGetExpNot##1{\semantex_data_tl_get_exp_not:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexDataClear##1{\semantex_data_tl_clear:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexKeysSet##1{\semantex_keys_set:nn{#1}{##1}} - \cs_set:Npn\SemantexKeysSetx##1{\semantex_keys_set:nx{#1}{##1}} - \cs_set:Npn\SemantexStrIfEqTF##1##2##3##4{\str_if_eq:xxTF{##1}{##2}{##3}{##4}} - \cs_set:Npn\SemantexStrIfEqT##1##2##3{\str_if_eq:xxT{##1}{##2}{##3}} - \cs_set:Npn\SemantexStrIfEqF##1##2##3{\str_if_eq:xxF{##1}{##2}{##3}} - \cs_set:Npn\SemantexIfBlankTF##1##2##3{\tl_if_blank:xTF{##1}{##2}{##3}} - \cs_set:Npn\SemantexIfBlankT##1##2{\tl_if_blank:xT{##1}{##2}} - \cs_set:Npn\SemantexIfBlankF##1##2{\tl_if_blank:xF{##1}{##2}} - \cs_set:Npn\SemantexBoolProvide##1{\semantex_data_bool_provide:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexBoolSetTrue##1{\semantex_data_bool_set_true:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexBoolSetFalse##1{\semantex_data_bool_set_false:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexBoolIfTF##1##2##3{\semantex_data_bool_get:nnTF{#1}{\tl_trim_spaces:n{##1}}{##2}{##3}} - \cs_set:Npn\SemantexBoolIfT##1##2{\semantex_data_bool_get:nnTF{#1}{\tl_trim_spaces:n{##1}}{##2}{}} - \cs_set:Npn\SemantexBoolIfF##1##2{\semantex_data_bool_get:nnTF{#1}{\tl_trim_spaces:n{##1}}{}{##2}} - \cs_set:Npn\SemantexIntProvide##1{\semantex_data_int_provide:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexIntGet##1{\semantex_data_int_get:nn{#1}{\tl_trim_spaces:n{\tl_trim_spaces:n{##1}}}} - \cs_set:Npn\SemantexIntClear##1{\semantex_data_int_clear:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexIntIncr##1{\semantex_data_int_incr:nn{#1}{\tl_trim_spaces:n{##1}}} - \cs_set:Npn\SemantexIntSet##1##2{\semantex_data_int_set:nnn{#1}{\tl_trim_spaces:n{##1}}{##2}} - \cs_set:Npn\SemantexIntIfGreaterThanTF##1##2##3##4 - { - \int_compare:nNnTF - { ##1 } - > - { ##2 } - { ##3 } - { ##4 } - } - \cs_set:Npn\SemantexIntIfGreaterThanT##1##2##3 - { - \int_compare:nNnTF - { ##1 } - > - { ##2 } - { ##3 } - { } - } - \cs_set:Npn\SemantexIntIfGreaterThanF##1##2##3 - { - \int_compare:nNnTF - { ##1 } - > - { ##2 } - { } - { ##3 } - } - \cs_set:Npn\SemantexIntIfEqualTF##1##2##3##4 - { - \int_compare:nNnTF - { ##1 } - = - { ##2 } - { ##3 } - { ##4 } - } - \cs_set:Npn\SemantexIntIfEqualT##1##2##3 - { - \int_compare:nNnTF - { ##1 } - = - { ##2 } - { ##3 } - { } - } - \cs_set:Npn\SemantexIntIfEqualF##1##2##3 - { - \int_compare:nNnTF - { ##1 } - = - { ##2 } - { } - { ##3 } - } - \cs_set:Npn\SemantexIntIfLessThanTF##1##2##3##4 - { - \int_compare:nNnTF - { ##1 } - < - { ##2 } - { ##3 } - { ##4 } - } - \cs_set:Npn\SemantexIntIfLessThanT##1##2##3 - { - \int_compare:nNnTF - { ##1 } - < - { ##2 } - { ##3 } - { } - } - \cs_set:Npn\SemantexIntIfLessThanF##1##2##3 - { - \int_compare:nNnTF - { ##1 } - < - { ##2 } - { } - { ##3 } - } - \cs_set:Npn\SemantexExpNot##1{\exp_not:n{##1}} - \cs_set:Npn\SemantexERRORKeyValueNotFound##1 - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERRORkeyvaluenotfound_temp_tl - \msg_error:nnxoo { semantex } { key_value_not_found } - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERRORkeyvaluenotfound_temp_tl } - { \semantex_grab_first_argument_of_two:nn ##1 } - { \semantex_grab_second_argument_of_two:nn ##1 } - } - - \cs_set:Npn\SemantexERROR##1 - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERROR_temp_tl - \msg_error:nnxoo { semantex } { generic_error } - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERROR_temp_tl } - { \semantex_grab_first_argument_of_two:nn ##1 } - { \semantex_grab_second_argument_of_two:nn ##1 } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataprovide:nn#1#2 -{ - \semantex_data_tl_provide:nn { #1 } { #2 } -} - -\cs_generate_variant:Nn \semantex_data_tl_set:nnn { noo , nox , nno , nnx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataset:nn#1#2 -{ - \semantex_data_tl_set:nno { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_datasetx:nn#1#2 -{ - \semantex_data_tl_set:nnx { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_generate_variant:Nn \semantex_data_tl_put_right:nnn { noo , nox } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataputright:nn#1#2{ - \semantex_data_tl_put_right:nno { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataputrightx:nn#1#2{ - \semantex_data_tl_put_right:nnx { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_generate_variant:Nn \semantex_data_tl_put_left:nnn { noo , nox } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataputleft:nn#1#2 -{ - \semantex_data_tl_put_left:nno { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataputleftx:nn#1#2 -{ - \semantex_data_tl_put_left:nnx { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dataclear:nn#1#2 -{ - \semantex_data_tl_clear:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_keysset:nn#1#2 -{ - \semantex_keys_set:nn { #1 } { #2 } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setkeys:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_keysset:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_keyssetx:nn#1#2 -{ - \semantex_keys_set:nx { #1 }{ #2 } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setkeysx:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_keyssetx:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifeqTF:nn#1#2 -{ - \str_if_eq:xxTF - { \semantex_grab_first_argument_of_four:nnnn #2 } - { \semantex_grab_second_argument_of_four:nnnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_four:nnnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_fourth_argument_of_four:nnnn #2 } } -} - -\cs_generate_variant:Nn \str_if_eq:nnTF { ffTF } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifeqT:nn#1#2 -{ - \str_if_eq:xxTF - { \semantex_grab_first_argument_of_three:nnn #2 } - { \semantex_grab_second_argument_of_three:nnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } - { } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifeqF:nn#1#2 -{ - \str_if_eq:xxTF - { \semantex_grab_first_argument_of_three:nnn #2 } - { \semantex_grab_second_argument_of_three:nnn #2 } - { } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } -} - -\cs_generate_variant:Nn \semantex_keys_set:nn { no } - -\cs_generate_variant:Nn \tl_if_blank:nTF { fTF } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifblankTF:nn#1#2 -{ - \tl_if_blank:xTF - { \semantex_grab_first_argument_of_three:nnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_three:nnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifblankT:nn#1#2 -{ - \tl_if_blank:xTF - { \semantex_grab_first_argument_of_two:nn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_two:nn #2 } } - { } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifblankF:nn#1#2 -{ - \tl_if_blank:xTF - { \semantex_grab_first_argument_of_two:nn #2 } - { } - { semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_two:nn #2 } } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolprovide:nn#1#2 -{ - \semantex_data_bool_provide:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolsettrue:nn#1#2 -{ - \semantex_data_bool_set_true:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolsetfalse:nn#1#2 -{ - \semantex_data_bool_set_false:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_generate_variant:Nn \semantex_data_bool_get:nnTF { noTF, nfTF , neTF , ffTF } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolifTF:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_three:nnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_three:nnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolifT:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_two:nn #2 } } - { } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_boolifF:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { } - { \semantex_keys_set:no { #1 } { \semantex_grab_second_argument_of_two:nn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intprovide:nn#1#2 -{ - \semantex_data_int_provide:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intclear:nn#1#2 -{ - \semantex_data_int_clear:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intincr:nn#1#2 -{ - \semantex_data_int_incr:nn { #1 } { \tl_trim_spaces:n { #2 } } -} - -\cs_generate_variant:Nn \semantex_data_int_set:nnn { noo , nno } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intset:nn#1#2 -{ - \semantex_data_int_set:noo { #1 } - { \tl_trim_spaces:n { \semantex_grab_first_argument_of_two:nn #2 } } - { \semantex_grab_second_argument_of_two:nn #2 } -} - -\cs_generate_variant:Nn \int_compare:nNnTF { oNoTF , fNfTF , xNxTF } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifgreaterthanTF:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_four:nnnn #2 } - > - { \semantex_grab_second_argument_of_four:nnnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_four:nnnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_fourth_argument_of_four:nnnn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifgreaterthanT:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - > - { \semantex_grab_second_argument_of_three:nnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } - { } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifgreaterthanF:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - > - { \semantex_grab_second_argument_of_three:nnn #2 } - { } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifequalTF:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_four:nnnn #2 } - = - { \semantex_grab_second_argument_of_four:nnnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_four:nnnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_fourth_argument_of_four:nnnn #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifequalT:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - = - { \semantex_grab_second_argument_of_three:nnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } - { } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intifequalF:nn#1#2 +\cs_new_protected:Npn \semantex_arg_singlekey_x:nn#1#2 { - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - = - { \semantex_grab_second_argument_of_three:nnn #2 } - { } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } + % The central command for executing expanded argument singlekeys, + % i.e. keys taking no + % #1 = register + % #2 = name of the key + \__semantex_arg_singlekey_x:nnn { #1 } { #2 } { #1 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intiflessthanTF:nn#1#2 +\cs_new_protected:Npn \__semantex_arg_singlekey_x:nnn#1#2#3 { - \int_compare:oNoTF - { \semantex_grab_first_argument_of_four:nnnn #2 } - < - { \semantex_grab_second_argument_of_four:nnnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_four:nnnn #2 } } - { \semantex_keys_set:no { #1 } { \semantex_grab_fourth_argument_of_four:nnnn #2 } } + \cs_if_exist:cTF { \tl_to_str:n{__semantex_data_cs_custom_arg_singlekey_#1_#2:n } } + { + \use:c { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } { #3 } + % and no, we don't want :x here; we don't need to expand + % the name of the register + } + { + \str_if_eq:nnTF { #1 } { class_SemantexBaseObject } + { + \semantex_arg_valuekey:nnx { #3 } { default } { #2 } + } + { + \__semantex_arg_singlekey:fnn { \semantex_data_parent_get:n { #1 } } { #2 } { #3 } + } + } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intiflessthanT:nn#1#2 -{ - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - < - { \semantex_grab_second_argument_of_three:nnn #2 } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } - { } -} +\cs_generate_variant:Nn \__semantex_arg_singlekey_x:nnn { fnn } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_intiflessthanF:nn#1#2 +\cs_new_protected:Npn\semantex_arg_without_keyval:nn#1#2 { - \int_compare:oNoTF - { \semantex_grab_first_argument_of_three:nnn #2 } - < - { \semantex_grab_second_argument_of_three:nnn #2 } - { } - { \semantex_keys_set:no { #1 } { \semantex_grab_third_argument_of_three:nnn #2 } } + % Sets the argument (no keyval interface allowed) + \semantex_data_tl_put_right:nnn { #1 } { arg } { #2 } + \semantex_data_int_incr:nn { #1 } { numberofarguments } + \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } } -\cs_generate_variant:Nn\msg_error:nnnnn { nnxoo } +\cs_generate_variant:Nn \semantex_arg_without_keyval:nn { nx } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERRORkeyvaluenotfound:nn#1#2 -{ - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERRORkeyvaluenotfound_temp_tl - \msg_error:nnxoo { semantex } { key_value_not_found } - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERRORkeyvaluenotfound_temp_tl } - { \semantex_grab_first_argument_of_two:nn #2 } - { \semantex_grab_second_argument_of_two:nn #2 } -} +% NOW SOME KEYS FOR DEFINING NEW KEYS: -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERROR:nn#1#2 -{ - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERROR_temp_tl - \msg_error:nnxoo { semantex } { generic_error } - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ERROR_temp_tl } - { \semantex_grab_first_argument_of_two:nn #2 } - { \semantex_grab_second_argument_of_two:nn #2 } -} +% First, we define the central commands for preprocessing keys -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_execute:nn#1#2 -{ - %\exp_not:n{#2} - % how about forget? - #2 -} +\cs_generate_variant:Nn \semantex_keyval_parse:NNn { NNo } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parse:nn#1#2 +\cs_new_protected:Npn\semantex_preprocess_keys:nN#1#2 { - % This command runs all the keys that the user may have - % stored via the parseoptions key - %\semantex_data_tl_inherit:nn { #1 } { parseoptions } -% \semantex_keys_set:nx { #1 } { -% \semantex_data_tl_get_exp_not:nn { #1 } { parseoptions } -% } -% \semantex_data_tl_clear:nn { #1 } { parseoptions } % this is probably necessary - \semantex_data_cs_get:nn { #1 } { parseoptions:n } { #1 } - \semantex_data_tl_clear:nn { #1 } { parseoptions } % this is probably necessary - \semantex_data_cs_clear:nn { #1 } { parseoptions:n } -} - -%\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parseoptions:nn#1#2 -%{ -% % This adds keys to the parseoptions token list -% \semantex_data_tl_put_right:nnn { #1 } { parseoptions } { #2 } -%} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parseoptions:nn#1#2{ - \tl_set:Nn\l__semantex_parseoptions_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_parseoptions_auxiliary_singlekey_temp_cs:n##1 - { - \__semantex_parseoptions_process_singlekey:nnN { ####1 } { ##1 } \l__semantex_parseoptions_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_parseoptions_auxiliary_valuekey_temp_cs:nn##1##2 + \cs_set:Npn\l__semantex_preprocess_singlekey_temp_cs:n##1 { - \__semantex_parseoptions_process_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_parseoptions_auxiliary_temp_tl + \__semantex_preprocess_singlekey:nnN { ####1 } { ##1 } #2 } - \keyval_parse:NNn - \l__semantex_parseoptions_auxiliary_singlekey_temp_cs:n - \l__semantex_parseoptions_auxiliary_valuekey_temp_cs:nn - { #2 } - \semantex_data_tl_put_right:nno { #1 } { parseoptions } { \l__semantex_parseoptions_auxiliary_temp_tl } - %\exp_args:NNno\exp_args:Nno\cs_set:co { __semantex_data_cs_#1_parseoptions:n } - %\exp_args:Nnno - \semantex_data_cs_set:nnx { #1 } { parseoptions:n } + \cs_set:Npn\l__semantex_preprocess_valuekey_temp_cs:nn##1##2 { -% g__semantex_data_tl_#1_parseoptions -% \semantex_data_tl_get:nn { #1 } { parseoptions } - \semantex_data_tl_get_exp_not:nn { #1 } { parseoptions } - %\l__semantex_parseoptions_auxiliary_temp_tl + \__semantex_preprocess_valuekey:nnnN { ####1 } { ##1 } { ##2 } #2 } + \semantex_keyval_parse:NNn + \l__semantex_preprocess_singlekey_temp_cs:n + \l__semantex_preprocess_valuekey_temp_cs:nn + { #1 } } +\cs_generate_variant:Nn \semantex_preprocess_keys:nN { oN } -\cs_new:Npn\__semantex_parseoptions_process_singlekey:nnN#1#2#3 +\cs_new_protected:Npn\__semantex_preprocess_singlekey:nnN#1#2#3 { \tl_put_right:Nn#3 { \semantex_singlekey:nn { #1 } { #2 } } } - -\cs_new:Npn\__semantex_parseoptions_process_valuekey:nnnN#1#2#3#4 +\cs_new_protected:Npn\__semantex_preprocess_valuekey:nnnN#1#2#3#4 { - \tl_if_eq:nnTF { #2 } { execute } + \str_case:nnF { #2 } { - \tl_put_right:Nn#4 - { - #3 + { execute }{ + \tl_put_right:Nn #4 { #3 } } - } - { - \tl_put_right:Nn#4 - { - \semantex_valuekey:nnn { #1 } { #2 } { #3 } + { setkeys }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_return:nn#1#2 -{ - % This is an umbrella key that runs all of the three - % return routines, innerreturn, rightreturn, and leftreturn - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_innerreturn:nn { #1 }{} - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightreturn:nn { #1 }{} - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftreturn:nn { #1 }{} -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_innerreturn:nn#1#2 -{ - % This adds all of the commands added via the command key - % to the symbol - \semantex_data_tl_inherit:nn { #1 } { symbol } - \semantex_data_seq_inherit:nn { #1 } { commands_sequence } - \semantex_data_seq_get_store:nnN { #1 } { commands_sequence } \l__semantex_data_seq_commands_sequence_temp - \seq_map_inline:Nn \l__semantex_data_seq_commands_sequence_temp - { - \semantex_data_tl_set:nnx { #1 } { symbol } + { keysset }{ + \semantex_preprocess_keys:nN { #3 } #4 + } + { setkeysx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 + } + { keyssetx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 + } + { setargkeys }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 + } + { argkeysset }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 + } + { setargkeysx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 + } + { argkeyssetx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 + } + { setargsinglekeys }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 + } + { argsinglekeysset }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 + } + { setargsinglekeysx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 + } + { argsinglekeyssetx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 + } + { parseoptions }{ + \tl_put_right:Nn#4 { - \exp_not:n {\exp_not:N ##1} { - \semantex_data_tl_get_exp_not:nn { #1 } { symbol } + \semantex_add_raw_commands_to_parse_options:nn { #1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { #3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + { outputoptions }{ + \tl_put_right:Nn#4 + { + \semantex_add_raw_commands_to_output_options:nn { #1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_pre_temp_tl {} + \semantex_preprocess_keys:nN { #3 } \l__semantex_preprocess_valuekey_keys_pre_temp_tl + \cs_set:Npo\l__semantex_preprocess_valuekey_keys_temp_cs:nn##1##2 + { + \l__semantex_preprocess_valuekey_keys_pre_temp_tl + } + \tl_set:No\l__semantex_preprocess_valuekey_keys_temp_tl + { + \l__semantex_preprocess_valuekey_keys_temp_cs:nn { ###1 } { ##2 } } - % This was the solution that happened to solve - % the expansion issues best + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } } } - \semantex_data_seq_clear:nn { #1 } { commands_sequence } -} - -\cs_generate_variant:Nn \semantex_keys_set:nn { nx , no } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightreturn:nn#1#2 -{ - \semantex_right_indices_return_store:nN { #1 } \l_semantex_rightreturn_right_indices_temp - \semantex_data_tl_put_right:nnx { #1 } { symbol } - { - \exp_not:V\l_semantex_rightreturn_right_indices_temp - } - \semantex_data_bool_get:nnTF { #1 } { leftargument } - { - % do nothing - } - { - \semantex_arg_return_store:nN { #1 } \l_semantex_rightreturn_arg_temp - \semantex_data_tl_put_right:nnx { #1 } { symbol } - { - \exp_not:V\l_semantex_rightreturn_arg_temp + { boolifTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifTF_temp_cs:nTF##1##2##3 + { + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_boolifTF_temp_cs:nTF #3 } - } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftreturn:nn#1#2 -{ - \semantex_left_indices_return_store:nN { #1 } \l_semantex_leftreturn_left_indices_temp - \semantex_data_tl_put_left:nnx { #1 } { symbol } - { - \exp_not:V\l_semantex_leftreturn_left_indices_temp - } - \semantex_data_bool_get:nnTF { #1 } { leftargument } - { - \semantex_arg_return_store:nN { #1 } \l_semantex_leftreturn_arg_temp - \semantex_data_tl_put_left:nnx { #1 } { symbol } - { - \exp_not:V\l_semantex_leftreturn_arg_temp + { boolifT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifT_temp_cs:nT##1##2 + { + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_boolifT_temp_cs:nT #3 } - } - { - % do nothing - } -} - -\cs_new:Npn \semantex_left_indices_return_store:nN#1#2 -{ - \semantex_data_tl_inherit_x:nn { #1 } { upperleft } - \semantex_data_tl_inherit_x:nn { #1 } { lowerleft } - \semantex_data_tl_inherit_x:nn { #1 } { preupperleft } - \semantex_data_tl_inherit_x:nn { #1 } { postupperleft } - \semantex_data_tl_inherit_x:nn { #1 } { prelowerleft } - \semantex_data_tl_inherit_x:nn { #1 } { postlowerleft } - \tl_set:Nn#2{} - \semantex_data_int_if_positive:nnTF { #1 } { numberofupperleftindices } - { - \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerleftindices } - { - \tl_put_right:Nx#2 + { boolifF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifF_temp_cs:nF##1##2 { - {}\sp{ - \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } - \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } - \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } } - \sb{ - \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } - \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } - \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } } } + \l__semantex_preprocess_valuekey_boolifF_temp_cs:nF #3 } - { - \tl_put_right:Nx#2 + { ifblankTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankTF_temp_cs:nTF##1##2##3 { - {}\sp{ - \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } - \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } - \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } } } + \l__semantex_preprocess_valuekey_ifblankTF_temp_cs:nTF #3 } - } - { - \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerleftindices } - { - \tl_put_right:Nx#2 + { ifblankT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankT_temp_cs:nT##1##2 { - {}\sb{ - \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } - \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } - \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } } } + \l__semantex_preprocess_valuekey_ifblankT_temp_cs:nT #3 } - { - % do nothing + { ifblankF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankF_temp_cs:nF##1##2 + { + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_ifblankF_temp_cs:nF #3 } - } - \semantex_data_tl_clear:nn { #1 } { upperleft } - \semantex_data_bool_provide:nn { #1 } { nextupperleftwithsep } % is it necessary to provide it before declaring it false? - \semantex_data_bool_set_false:nn { #1 } { nextupperleftwithsep } - \semantex_data_tl_clear:nn { #1 } { lowerleft } - \semantex_data_bool_provide:nn { #1 } { nextlowerleftwithsep } % is it necessary to provide it before declaring it false? - \semantex_data_bool_set_false:nn { #1 } { nextlowerleftwithsep } - \semantex_data_tl_clear:nn { #1 } { preupperleft } - \semantex_data_tl_clear:nn { #1 } { postupperleft } - \semantex_data_tl_clear:nn { #1 } { prelowerleft } - \semantex_data_tl_clear:nn { #1 } { postlowerleft } - \semantex_data_int_clear:nn { #1 } { numberofupperleftindices } - \semantex_data_int_clear:nn { #1 } { numberoflowerleftindices } -} - - -\cs_new:Npn \semantex_arg_return_store:nN#1#2 -{ - \semantex_data_tl_inherit_x:nn { #1 } { arg } - \semantex_data_int_inherit:nn { #1 } { numberofarguments } - %\semantex_data_tl_inherit:nn { #1 } { parsize } % This was necessary for unkonwn reasons -- otherwise it will fail when doing inheritance - \semantex_data_tl_get_store:nnN { #1 } { parsize } \l__arg_return_store_parsize_temp_tl - \semantex_data_bool_get:nnTF { #1 } { par } - { - \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } - { - \__semantex_parentheses_store:nnnnN - { \l__arg_return_store_parsize_temp_tl } - { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } - { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } + { strifeqTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqTF_temp_cs:nnTF##1##2##3##4 { - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \tl_put_right:Nn#4 + { + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } } - #2 + \l__semantex_preprocess_valuekey_strifeqTF_temp_cs:nnTF #3 } - { - \tl_set:Nn#2{} + { strifeqT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_strifeqT_temp_cs:nnT #3 } - } - { - \semantex_data_bool_get:nnTF { #1 } { flexpar } - { - \semantex_data_int_if_greater_than_one:nnTF { #1 } { numberofarguments } + { strifeqF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqF_temp_cs:nnF##1##2##3 { - \__semantex_parentheses_store:nnnnN - { \l__arg_return_store_parsize_temp_tl } - { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } - { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } + \tl_put_right:Nn#4 { - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } } - #2 } + \l__semantex_preprocess_valuekey_strifeqF_temp_cs:nnF #3 + } + { intifgreaterTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterTF_temp_cs:nnTF##1##2##3##4 { - \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } + \tl_put_right:Nn#4 { - \__semantex_no_parentheses_store:nN - { - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } - } - #2 + \int_compare:nNnTF { ##1 } > { ##2 } } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 { - \tl_set:Nn#2{} + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } } } + \l__semantex_preprocess_valuekey_intifgreaterTF_temp_cs:nnTF #3 } - { - \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } + { intifgreaterT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterT_temp_cs:nnT##1##2##3 { - \__semantex_no_parentheses_store:nN + \tl_put_right:Nn#4 { - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \int_compare:nNnTF { ##1 } > { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } } - #2 } + \l__semantex_preprocess_valuekey_intifgreaterT_temp_cs:nnT #3 + } + { intifgreaterF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterF_temp_cs:nnF##1##2##3 { - \tl_set:Nn#2{} + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } > { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } } + \l__semantex_preprocess_valuekey_intifgreaterF_temp_cs:nnF #3 } - } - \semantex_data_tl_clear:nn { #1 } { arg } - \semantex_data_tl_clear:nn { #1 } { prearg } % Is it right to clear these? - \semantex_data_tl_clear:nn { #1 } { postarg } - \semantex_data_int_clear:nn { #1 } { numberofarguments } - \semantex_data_bool_provide:nn { #1 } { nextargwithsep } % is it necessary to provide it before declaring it false? - \semantex_data_bool_set_false:nn { #1 } { nextargwithsep } -} - -\cs_new:Npn \semantex_right_indices_return_store:nN#1#2 -{ - \semantex_data_tl_inherit_x:nn { #1 } { upper } - \semantex_data_tl_inherit_x:nn { #1 } { lower } - \semantex_data_tl_inherit_x:nn { #1 } { preupper } - \semantex_data_tl_inherit_x:nn { #1 } { postupper } - \semantex_data_tl_inherit_x:nn { #1 } { prelower } - \semantex_data_tl_inherit_x:nn { #1 } { postlower } - \tl_set:Nn#2{} - \semantex_data_int_if_positive:nnTF { #1 } { numberofupperindices } - { - \tl_put_right:Nx#2 - { - \sp{ - \semantex_data_tl_get_exp_not:nn { #1 } { preupper } - \semantex_data_tl_get_exp_not:nn { #1 } { upper } - \semantex_data_tl_get_exp_not:nn { #1 } { postupper } + { intifeqTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } } + \l__semantex_preprocess_valuekey_intifeqTF_temp_cs:nnTF #3 } - } - { - % do nothing - } - \semantex_data_int_if_positive:nnTF { #1 } { numberoflowerindices } - { - \tl_put_right:Nx#2 - { - \sb{ - \semantex_data_tl_get_exp_not:nn { #1 } { prelower } - \semantex_data_tl_get_exp_not:nn { #1 } { lower } - \semantex_data_tl_get_exp_not:nn { #1 } { postlower } + { intifeqT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } } + \l__semantex_preprocess_valuekey_intifeqT_temp_cs:nnT #3 } - } - { - % do nothing - } - \semantex_data_tl_clear:nn { #1 } { upper } - \semantex_data_bool_provide:nn { #1 } { nextupperwithsep } % is it necessary to provide it before declaring it false? - \semantex_data_bool_set_false:nn { #1 } { nextupperwithsep } - \semantex_data_tl_clear:nn { #1 } { lower } - \semantex_data_bool_provide:nn { #1 } { nextlowerwithsep } % is it necessary to provide it before declaring it false? - \semantex_data_bool_set_false:nn { #1 } { nextlowerwithsep } - \semantex_data_tl_clear:nn { #1 } { preupper } - \semantex_data_tl_clear:nn { #1 } { postupper } - \semantex_data_tl_clear:nn { #1 } { prelower } - \semantex_data_tl_clear:nn { #1 } { postlower } - \semantex_data_int_clear:nn { #1 } { numberofupperindices } - \semantex_data_int_clear:nn { #1 } { numberoflowerindices } -} - - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parent:nn#1#2{ - % Must inherit everything from the parent class - \semantex_data_parent_set:nn { #1 } { #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_class:nn#1#2{ - % Must inherit everything from the parent class - \semantex_data_class_set:nn { #1 } { #2 } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_class:nn { xn } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_copy:nn#1#2{ - % Similarly to parent and class, but inherits from other objects rather than classes - \semantex_data_copy_object:nn { #1 } { #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clone:nn#1#2{ - % Similarly to parent and class, but inherits from other objects rather than classes - \semantex_data_clone_object:nn { #1 } { #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_valuekeys:nn#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_process_singlekey:nnN#1#2#3 -{ - \tl_put_right:Nn#3 - { - \semantex_singlekey:nn { #1 } { #2 } - } -} - -\cs_generate_variant:Nn \semantex_valuekey:nnn { nnx } - -\cs_new:Npn\__semantex_process_valuekey:nnnN#1#2#3#4 -{ - \tl_if_eq:nnTF { #2 } { execute } - { - \tl_put_right:Nn#4 - { - #3 + { intifeqF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intifeqF_temp_cs:nnF #3 + } + { intiflessTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intiflessTF_temp_cs:nnTF #3 + } + { intiflessT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_intiflessT_temp_cs:nnT #3 + } + { intiflessF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intiflessF_temp_cs:nnF #3 } } { \tl_put_right:Nn#4 { \semantex_valuekey:nnn { #1 } { #2 } { #3 } - } - } -} - -\cs_new:Npn\__semantex_valuekey_format_auxiliary:nnn#1#2#3 -{ - \tl_set:Nn\l__semantex_valuekey_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_valuekey_auxiliary_singlekey_temp_cs:n##1 - { - \__semantex_process_singlekey:nnN { ####1 } { ##1 } \l__semantex_valuekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_valuekey_auxiliary_valuekey_temp_cs:nn##1##2 - { - \__semantex_process_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_valuekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_valuekey_auxiliary_temp_cs:n##1 { #3 } - \keyval_parse:NNo - \l__semantex_valuekey_auxiliary_singlekey_temp_cs:n - \l__semantex_valuekey_auxiliary_valuekey_temp_cs:nn - { - \l__semantex_valuekey_auxiliary_temp_cs:n { ##2 } } - \cs_set:cpo { __semantex_data_cs_custom_valuekey_#1_#2:nn } ##1##2 { - \l__semantex_valuekey_auxiliary_temp_tl } - % remove spaces } -\cs_generate_variant:Nn \cs_set:Npn { cpo } - -\cs_generate_variant:Nn \keyval_parse:NNn { NNo } +% The x version: -%CHECK - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_singlekeys:nn#1#2{ - % Add keys taking no values - \clist_map_inline:nn { #2 }{ - \__semantex_singlekeys_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn \__semantex_singlekeys_format_auxiliary:nnn#1#2#3{ - \tl_set:Nn\l__semantex_singlekey_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_singlekey_auxiliary_singlekey_temp_cs:n##1 +\cs_new_protected:Npn\semantex_preprocess_keys_x:nN#1#2 +{ + \cs_set:Npn\l__semantex_preprocess_singlekey_x_temp_cs:n##1 { - \__semantex_process_singlekey:nnN { ####1 } { ##1 } \l__semantex_singlekey_auxiliary_temp_tl + \__semantex_preprocess_singlekey_x:nnN { ####1 } { ##1 } #2 } - \cs_set:Npn\l__semantex_singlekey_auxiliary_valuekey_temp_cs:nn##1##2 + \cs_set:Npn\l__semantex_preprocess_valuekey_x_temp_cs:nn##1##2 { - \__semantex_process_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_singlekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_singlekey_auxiliary_temp_cs: { #3 } - \keyval_parse:NNo - \l__semantex_singlekey_auxiliary_singlekey_temp_cs:n - \l__semantex_singlekey_auxiliary_valuekey_temp_cs:nn - { \l__semantex_singlekey_auxiliary_temp_cs: } - \cs_set:cpo { __semantex_data_cs_custom_singlekey_#1_#2:n } ##1 { - \l__semantex_singlekey_auxiliary_temp_tl - } -% \seq_put_right:cn { g__semantex_data_seq_#1_list_of_singlekeys } { #2 } -% %IM Remove spaces in #2 -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removesinglekey:nn#1#2 -{ - \cs_undefine:c { __semantex_data_cs_custom_singlekey_#1_#2:n } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removevaluekey:nn#1#2 -{ - \cs_undefine:c { __semantex_data_cs_custom_valuekey_#1_#2:nn } -} - -\cs_set_eq:cN { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_1valuekeys:nn } \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_valuekeys:nn - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_2valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_two_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_preprocess_valuekey_x:nnnN { ####1 } { ##1 } { ##2 } #2 } + \semantex_keyval_parse:NNn + \l__semantex_preprocess_singlekey_x_temp_cs:n + \l__semantex_preprocess_valuekey_x_temp_cs:nn + { #1 } } -\cs_new:Npn\__semantex_two_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_preprocess_singlekey_x:nnN#1#2#3 { - \cs_set:Npn\l__semantex_two_valuekey_format_auxiliary_temp:nn##1##2{#3} - %IM Remove spaces in #2 - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } + \tl_put_right:Nn#3 { - \l__semantex_two_valuekey_format_auxiliary_temp:nn - { - \semantex_grab_first_argument_of_two:nn ##1 - } - { - \semantex_grab_second_argument_of_two:nn ##1 - } - } -} -\cs_generate_variant:Nn \__semantex_valuekey_format_auxiliary:nnn { nno } - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_3valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_three_valuekey_format_auxiliary:nnn{#1}##1 + \semantex_singlekey_x:nn { #1 } { #2 } } } -\cs_new:Npn\__semantex_three_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_preprocess_valuekey_x:nnnN#1#2#3#4 { - \cs_set:Npn\l__semantex_three_valuekey_format_auxiliary_temp:nnn##1##2##3{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } + \str_case:nnF { #2 } { - \l__semantex_three_valuekey_format_auxiliary_temp:nnn - { - \semantex_grab_first_argument_of_three:nnn ##1 + { execute } { + \tl_put_right:Nn#4 + { + #3 + } } - { - \semantex_grab_second_argument_of_three:nnn ##1 + { setkeys }{ + \semantex_preprocess_keys:nN { #3 } #4 } - { - \semantex_grab_third_argument_of_three:nnn ##1 + { keysset }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_4valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_four_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_four_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_four_valuekey_format_auxiliary_temp:nnnn##1##2##3##4{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } - { - \l__semantex_four_valuekey_format_auxiliary_temp:nnnn - { - \semantex_grab_first_argument_of_four:nnnn ##1 + { setkeysx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - { - \semantex_grab_second_argument_of_four:nnnn ##1 + { keyssetx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - { - \semantex_grab_third_argument_of_four:nnnn ##1 + { setargkeys }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - { - \semantex_grab_fourth_argument_of_four:nnnn ##1 + { argkeysset }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_5valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_five_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_five_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_five_valuekey_format_auxiliary_temp:nnnnn##1##2##3##4##5{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } - { - \l__semantex_five_valuekey_format_auxiliary_temp:nnnnn - { - \semantex_grab_first_argument_of_five:nnnnn ##1 + { setargkeysx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - { - \semantex_grab_second_argument_of_five:nnnnn ##1 + { argkeyssetx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - { - \semantex_grab_third_argument_of_five:nnnnn ##1 + { setargsinglekeys }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - { - \semantex_grab_fourth_argument_of_five:nnnnn ##1 + { argsinglekeysset }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - { - \semantex_grab_fifth_argument_of_five:nnnnn ##1 + { setargsinglekeysx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_6valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_six_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_six_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_six_valuekey_format_auxiliary_temp:nnnnnn##1##2##3##4##5##6{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } - { - \l__semantex_six_valuekey_format_auxiliary_temp:nnnnnn - { - \semantex_grab_first_argument_of_six:nnnnnn ##1 + { argsinglekeyssetx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 } - { - \semantex_grab_second_argument_of_six:nnnnnn ##1 + { parseoptions }{ + \tl_put_right:Nn#4 + { + \semantex_add_raw_commands_to_parse_options:nn { #1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { #3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } } - { - \semantex_grab_third_argument_of_six:nnnnnn ##1 + { outputoptions }{ + \tl_put_right:Nn#4 + { + \semantex_add_raw_commands_to_output_options:nn { #1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_pre_temp_tl {} + \semantex_preprocess_keys_x:nN { #3 } \l__semantex_preprocess_valuekey_keys_pre_temp_tl + \cs_set:Npo\l__semantex_preprocess_valuekey_keys_temp_cs:nn##1##2 + { + \l__semantex_preprocess_valuekey_keys_pre_temp_tl + } + \tl_set:No\l__semantex_preprocess_valuekey_keys_temp_tl + { + \l__semantex_preprocess_valuekey_keys_temp_cs:nn { ###1 } { ##2 } + } + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } } - { - \semantex_grab_fourth_argument_of_six:nnnnnn ##1 + { boolifTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifTF_temp_cs:nTF##1##2##3 + { + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_boolifTF_temp_cs:nTF #3 } - { - \semantex_grab_fifth_argument_of_six:nnnnnn ##1 + { boolifT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifT_temp_cs:nT##1##2 + { + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_boolifT_temp_cs:nT #3 } - { - \semantex_grab_sixth_argument_of_six:nnnnnn ##1 + { boolifF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_boolifF_temp_cs:nF##1##2 + { + \tl_put_right:Nn#4 + { + \semantex_data_bool_get:nnTF { ####1 } { \tl_trim_spaces:n { ##1 } } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_boolifF_temp_cs:nF #3 } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_7valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_seven_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_seven_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_seven_valuekey_format_auxiliary_temp:nnnnnnn##1##2##3##4##5##6##7{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } - { - \l__semantex_seven_valuekey_format_auxiliary_temp:nnnnnnn - { - \semantex_grab_first_argument_of_seven:nnnnnnn ##1 + { ifblankTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankTF_temp_cs:nTF##1##2##3 + { + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_ifblankTF_temp_cs:nTF #3 } - { - \semantex_grab_second_argument_of_seven:nnnnnnn ##1 + { ifblankT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankT_temp_cs:nT##1##2 + { + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_ifblankT_temp_cs:nT #3 } - { - \semantex_grab_third_argument_of_seven:nnnnnnn ##1 + { ifblankF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_ifblankF_temp_cs:nF##1##2 + { + \tl_put_right:Nn#4 + { + \tl_if_blank:xTF { ##1 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##2 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_ifblankF_temp_cs:nF #3 } - { - \semantex_grab_fourth_argument_of_seven:nnnnnnn ##1 + { strifeqTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_strifeqTF_temp_cs:nnTF #3 } - { - \semantex_grab_fifth_argument_of_seven:nnnnnnn ##1 + { strifeqT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_strifeqT_temp_cs:nnT #3 } - { - \semantex_grab_sixth_argument_of_seven:nnnnnnn ##1 + { strifeqF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_strifeqF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \str_if_eq:xxTF { ##1 } { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_strifeqF_temp_cs:nnF #3 } - { - \semantex_grab_seventh_argument_of_seven:nnnnnnn ##1 + { intifgreaterTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } > { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intifgreaterTF_temp_cs:nnTF #3 } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_8valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_eight_valuekey_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn\__semantex_eight_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_eight_valuekey_format_auxiliary_temp:nnnnnnnn##1##2##3##4##5##6##7##8{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } - { - \l__semantex_eight_valuekey_format_auxiliary_temp:nnnnnnnn - { - \semantex_grab_first_argument_of_eight:nnnnnnnn ##1 + { intifgreaterT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } > { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_intifgreaterT_temp_cs:nnT #3 } - { - \semantex_grab_second_argument_of_eight:nnnnnnnn ##1 + { intifgreaterF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifgreaterF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } > { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intifgreaterF_temp_cs:nnF #3 } - { - \semantex_grab_third_argument_of_eight:nnnnnnnn ##1 + { intifeqTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intifeqTF_temp_cs:nnTF #3 } - { - \semantex_grab_fourth_argument_of_eight:nnnnnnnn ##1 + { intifeqT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_intifeqT_temp_cs:nnT #3 } - { - \semantex_grab_fifth_argument_of_eight:nnnnnnnn ##1 + { intifeqF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intifeqF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } = { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intifeqF_temp_cs:nnF #3 } - { - \semantex_grab_sixth_argument_of_eight:nnnnnnnn ##1 + { intiflessTF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessTF_temp_cs:nnTF##1##2##3##4 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##4 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V \l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intiflessTF_temp_cs:nnTF #3 } - { - \semantex_grab_seventh_argument_of_eight:nnnnnnnn ##1 + { intiflessT }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessT_temp_cs:nnT##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + { } + } + } + \l__semantex_preprocess_valuekey_intiflessT_temp_cs:nnT #3 + } + { intiflessF }{ + \cs_set:Npn \l__semantex_preprocess_valuekey_intiflessF_temp_cs:nnF##1##2##3 + { + \tl_put_right:Nn#4 + { + \int_compare:nNnTF { ##1 } < { ##2 } + } + \group_begin: + \tl_set:Nn\l__semantex_preprocess_valuekey_keys_temp_tl {} + \semantex_preprocess_keys_x:nN { ##3 } \l__semantex_preprocess_valuekey_keys_temp_tl + \exp_args:NNNx + \group_end: + \tl_put_right:Nn#4 + { + { } + { \exp_not:V\l__semantex_preprocess_valuekey_keys_temp_tl } + } + } + \l__semantex_preprocess_valuekey_intiflessF_temp_cs:nnF #3 } + } + { + \tl_put_right:Nn#4 { - \semantex_grab_eighth_argument_of_eight:nnnnnnnn ##1 + \semantex_valuekey:nnx { #1 } { #2 } { #3 } } } - %IM Remove spaces in #2 } -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_9valuekeys:nn }#1#2{ +\cs_new_protected:Npn\semantex_define_valuekeys:nn#1#2 +{ % Add new valuekeys \clist_map_inline:nn { #2 }{ - \__semantex_nine_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_valuekey_format_auxiliary:nnn { #1 } ##1 } } -\cs_new:Npn\__semantex_nine_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_valuekey_format_auxiliary:nnn#1#2#3 { - \cs_set:Npn\l__semantex_nine_valuekey_format_auxiliary_temp:nnnnnnnnn##1##2##3##4##5##6##7##8##9{#3} - \__semantex_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set:Npn\l__semantex_valuekey_auxiliary_temp_cs:n##1 { #3 } + \tl_set:Nn \l__semantex_valuekey_auxiliary_temp_tl {} + \semantex_preprocess_keys:oN { - \l__semantex_nine_valuekey_format_auxiliary_temp:nnnnnnnnn - { - \semantex_grab_first_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_second_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_third_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_sixth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_seventh_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_eighth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_ninth_argument_of_nine:nnnnnnnnn ##1 - } + \l__semantex_valuekey_auxiliary_temp_cs:n { ##2 } + } \l__semantex_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 + { + \l__semantex_valuekey_auxiliary_temp_tl } - %IM Remove spaces in #2 } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_novaluekeys:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_singlekeys:nn % Previously, "singlekeys" was called "novaluekeys", so I am keeping this alias for backwards compatibility - -\cs_set_eq:cN { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_0valuekeys:nn } \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_singlekeys:nn - - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removenovaluekey:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removesinglekey:nn % Previously, "singlekeys" was called "novaluekeys", so I am keeping this alias for backwards compatibility +\cs_generate_variant:Nn \cs_set:Npn { Npo } -\cs_set_eq:cN { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_remove0valuekey:nn } \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removesinglekey:nn +\cs_generate_variant:Nn \cs_set_protected:Npn { cpo , Npo } -% KEYS FOR SETTING UP THE ARGUMENT KEYVAL INTERFACE: - -\cs_new:Npn\__semantex_process_arg_singlekey:nnN#1#2#3 +\cs_new_protected:Npn\semantex_remove_valuekey:nn#1#2 { - \tl_put_right:Nn#3 - { - \semantex_arg_singlekey:nn { #1 } { #2 } - } + \cs_undefine:c { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } } -\cs_generate_variant:Nn \semantex_valuekey:nnn { nnx } - -\cs_new:Npn\__semantex_process_arg_valuekey:nnnN#1#2#3#4 +\cs_new_protected:Npn\semantex_define_singlekeys:nn#1#2 { - \tl_put_right:Nn#4 - { - \semantex_arg_valuekey:nnn { #1 } { #2 } { #3 } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argvaluekeys:nn#1#2{ - % Add argument valuekeys + % Add keys taking no values \clist_map_inline:nn { #2 }{ - \__semantex_arg_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_singlekeys_format_auxiliary:nnn { #1 } ##1 } } -\cs_new:Npn \__semantex_arg_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn \__semantex_singlekeys_format_auxiliary:nnn#1#2#3 { - \tl_set:Nn\l__semantex_arg_valuekey_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_arg_valuekey_auxiliary_singlekey_temp_cs:n##1 - { - \__semantex_process_arg_singlekey:nnN { ####1 } { ##1 } \l__semantex_arg_valuekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_arg_valuekey_auxiliary_valuekey_temp_cs:nn##1##2 - { - \__semantex_process_arg_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_arg_valuekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_arg_valuekey_auxiliary_temp_cs:n##1 { #3 } - \keyval_parse:NNo - \l__semantex_arg_valuekey_auxiliary_singlekey_temp_cs:n - \l__semantex_arg_valuekey_auxiliary_valuekey_temp_cs:nn - { - \l__semantex_arg_valuekey_auxiliary_temp_cs:n { ##2 } - } - \cs_set:cpo { __semantex_data_cs_custom_arg_valuekey_#1_#2:nn } ##1##2 { - \l__semantex_arg_valuekey_auxiliary_temp_tl - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argsinglekeys:nn#1#2{ - % Add argument keys taking no values - \clist_map_inline:nn { #2 }{ - \__semantex_arg_singlekeys_format_auxiliary:nnn{#1}##1 - } -} - -\cs_new:Npn \__semantex_arg_singlekeys_format_auxiliary:nnn#1#2#3{ - \tl_set:Nn\l__semantex_arg_singlekey_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_arg_singlekey_auxiliary_singlekey_temp_cs:n##1 + \cs_set:Npn\l__semantex_singlekey_auxiliary_temp_cs: { #3 } + \tl_set:Nn \l__semantex_singlekey_auxiliary_temp_tl {} + \semantex_preprocess_keys:oN { - \__semantex_process_arg_singlekey:nnN { ####1 } { ##1 } \l__semantex_arg_singlekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_arg_singlekey_auxiliary_valuekey_temp_cs:nn##1##2 + \l__semantex_singlekey_auxiliary_temp_cs: + } \l__semantex_singlekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_singlekey_#1_\tl_trim_spaces:n{#2}:n } ##1 { - \__semantex_process_arg_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_arg_singlekey_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_arg_singlekey_auxiliary_temp_cs: { #3 } - \keyval_parse:NNo - \l__semantex_arg_singlekey_auxiliary_singlekey_temp_cs:n - \l__semantex_arg_singlekey_auxiliary_valuekey_temp_cs:nn - { \l__semantex_arg_singlekey_auxiliary_temp_cs: } - \cs_set:cpo { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } ##1 { - \l__semantex_arg_singlekey_auxiliary_temp_tl + \l__semantex_singlekey_auxiliary_temp_tl } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removeargsinglekey:nn#1#2 +\cs_new_protected:Npn\semantex_remove_singlekey:nn#1#2 { - \cs_undefine:c { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } + \cs_undefine:c { __semantex_data_cs_custom_singlekey_#1_#2:n } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removeargvaluekey:nn#1#2 +\cs_new_protected:Npn\semantex_define_two_valuekeys:nn#1#2 { - \cs_undefine:c { __semantex_data_cs_custom_arg_valuekey_#1_#2:nn } -} - -\cs_set_eq:cN { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg1valuekeys:nn } \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_arg_valuekeys:nn - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg2valuekeys:nn }#1#2{ - % Add new valuekeys + % Add new valuekeys with 2 values \clist_map_inline:nn { #2 }{ - \__semantex_two_arg_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_two_valuekey_format_auxiliary:nnn { #1 } ##1 } } -\cs_generate_variant:Nn \__semantex_arg_valuekey_format_auxiliary:nnn { nno } - -\cs_new:Npn\__semantex_two_arg_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_two_valuekey_format_auxiliary:nnn#1#2#3 { - \cs_set:Npn\l__semantex_two_arg_valuekey_format_auxiliary_temp:nn##1##2{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set:Npn\l__semantex_two_valuekey_auxiliary_temp_cs:nn##1##2 { #3 } + \tl_set:Nn\l__semantex_two_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \l__semantex_two_arg_valuekey_format_auxiliary_temp:nn - { - \semantex_grab_first_argument_of_two:nn ##1 - } - { - \semantex_grab_second_argument_of_two:nn ##1 - } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg3valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_three_arg_valuekey_format_auxiliary:nnn{#1}##1 + \l__semantex_two_valuekey_auxiliary_temp_cs:nn { ##2 } { ##3 } + } \l__semantex_two_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } ##1##2##3 + { + \l__semantex_two_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_three_arg_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_three_arg_valuekey_format_auxiliary_temp:nnn##1##2##3{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \l__semantex_three_arg_valuekey_format_auxiliary_temp:nnn - { - \semantex_grab_first_argument_of_three:nnn ##1 - } - { - \semantex_grab_second_argument_of_three:nnn ##1 - } - { - \semantex_grab_third_argument_of_three:nnn ##1 - } + \use:c { __semantex_data_cs_custom_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } { ##1 } ##2 } - %IM Remove spaces in #2 } -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg4valuekeys:nn }#1#2{ - % Add new valuekeys +\cs_new_protected:Npn\semantex_define_three_valuekeys:nn#1#2 +{ + % Add new valuekeys with 3 values \clist_map_inline:nn { #2 }{ - \__semantex_four_arg_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_three_valuekey_format_auxiliary:nnn {#1} ##1 } } -\cs_new:Npn\__semantex_four_arg_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_three_valuekey_format_auxiliary:nnn#1#2#3 { - \cs_set:Npn\l__semantex_four_arg_valuekey_format_auxiliary_temp:nnnn##1##2##3##4{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set:Npn\l__semantex_three_valuekey_auxiliary_temp_cs:nnn##1##2##3 { #3 } + \tl_set:Nn\l__semantex_three_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \l__semantex_four_arg_valuekey_format_auxiliary_temp:nnnn - { - \semantex_grab_first_argument_of_four:nnnn ##1 - } - { - \semantex_grab_second_argument_of_four:nnnn ##1 - } - { - \semantex_grab_third_argument_of_four:nnnn ##1 - } - { - \semantex_grab_fourth_argument_of_four:nnnn ##1 - } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg5valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_five_arg_valuekey_format_auxiliary:nnn{#1}##1 + \l__semantex_three_valuekey_auxiliary_temp_cs:nnn { ##2 } { ##3 } { ##4 } + } \l__semantex_three_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } ##1##2##3##4 + { + \l__semantex_three_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_five_arg_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_five_arg_valuekey_format_auxiliary_temp:nnnnn##1##2##3##4##5{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \l__semantex_five_arg_valuekey_format_auxiliary_temp:nnnnn - { - \semantex_grab_first_argument_of_five:nnnnn ##1 - } - { - \semantex_grab_second_argument_of_five:nnnnn ##1 - } - { - \semantex_grab_third_argument_of_five:nnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_five:nnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_five:nnnnn ##1 - } + \use:c { __semantex_data_cs_custom_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } { ##1 } ##2 } - %IM Remove spaces in #2 } -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg6valuekeys:nn }#1#2{ - % Add new valuekeys +\cs_new_protected:Npn\semantex_define_four_valuekeys:nn#1#2 +{ + % Add new valuekeys with 4 values \clist_map_inline:nn { #2 }{ - \__semantex_six_arg_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_four_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_new:Npn\__semantex_six_arg_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_four_valuekey_format_auxiliary:nnn#1#2#3 { - \cs_set:Npn\l__semantex_six_arg_valuekey_format_auxiliary_temp:nnnnnn##1##2##3##4##5##6{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set:Npn\l__semantex_four_valuekey_auxiliary_temp_cs:nnnn##1##2##3##4 { #3 } + \tl_set:Nn\l__semantex_four_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \l__semantex_six_arg_valuekey_format_auxiliary_temp:nnnnnn - { - \semantex_grab_first_argument_of_six:nnnnnn ##1 - } - { - \semantex_grab_second_argument_of_six:nnnnnn ##1 - } - { - \semantex_grab_third_argument_of_six:nnnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_six:nnnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_six:nnnnnn ##1 - } - { - \semantex_grab_sixth_argument_of_six:nnnnnn ##1 - } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg7valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_seven_arg_valuekey_format_auxiliary:nnn{#1}##1 + \l__semantex_four_valuekey_auxiliary_temp_cs:nnnn { ##2 } { ##3 } { ##4 } { ##5 } + } \l__semantex_four_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } ##1##2##3##4##5 + { + \l__semantex_four_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_seven_arg_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_seven_arg_valuekey_format_auxiliary_temp:nnnnnnn##1##2##3##4##5##6##7{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \l__semantex_seven_arg_valuekey_format_auxiliary_temp:nnnnnnn - { - \semantex_grab_first_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_second_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_third_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_sixth_argument_of_seven:nnnnnnn ##1 - } - { - \semantex_grab_seventh_argument_of_seven:nnnnnnn ##1 - } + \use:c { __semantex_data_cs_custom_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } { ##1 } ##2 } - %IM Remove spaces in #2 } -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg8valuekeys:nn }#1#2{ - % Add new valuekeys +\cs_new_protected:Npn\semantex_define_five_valuekeys:nn#1#2 +{ + % Add new valuekeys with 5 values \clist_map_inline:nn { #2 }{ - \__semantex_eight_arg_valuekey_format_auxiliary:nnn{#1}##1 + \__semantex_five_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_new:Npn\__semantex_eight_arg_valuekey_format_auxiliary:nnn#1#2#3 +\cs_new_protected:Npn\__semantex_five_valuekey_format_auxiliary:nnn#1#2#3 { - \cs_set:Npn\l__semantex_eight_arg_valuekey_format_auxiliary_temp:nnnnnnnn##1##2##3##4##5##6##7##8{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set:Npn\l__semantex_five_valuekey_auxiliary_temp_cs:nnnnn##1##2##3##4##5 { #3 } + \tl_set:Nn\l__semantex_five_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \l__semantex_eight_arg_valuekey_format_auxiliary_temp:nnnnnnnn - { - \semantex_grab_first_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_second_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_third_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_sixth_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_seventh_argument_of_eight:nnnnnnnn ##1 - } - { - \semantex_grab_eighth_argument_of_eight:nnnnnnnn ##1 - } - } - %IM Remove spaces in #2 -} - -\cs_new:cpn { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_arg9valuekeys:nn }#1#2{ - % Add new valuekeys - \clist_map_inline:nn { #2 }{ - \__semantex_nine_arg_valuekey_format_auxiliary:nnn{#1}##1 + \l__semantex_five_valuekey_auxiliary_temp_cs:nnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } + } \l__semantex_five_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } ##1##2##3##4##5##6 + { + \l__semantex_five_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_nine_arg_valuekey_format_auxiliary:nnn#1#2#3 -{ - \cs_set:Npn\l__semantex_nine_arg_valuekey_format_auxiliary_temp:nnnnnnnnn##1##2##3##4##5##6##7##8##9{#3} - \__semantex_arg_valuekey_format_auxiliary:nno { #1 } { #2 } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \l__semantex_nine_arg_valuekey_format_auxiliary_temp:nnnnnnnnn - { - \semantex_grab_first_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_second_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_third_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_fourth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_fifth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_sixth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_seventh_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_eighth_argument_of_nine:nnnnnnnnn ##1 - } - { - \semantex_grab_ninth_argument_of_nine:nnnnnnnnn ##1 - } + \use:c { __semantex_data_cs_custom_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } { ##1 } ##2 } - %IM Remove spaces in #2 -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argnovaluekeys:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argsinglekeys:nn % Previously, "singlekeys" was called "novaluekeys", so I am keeping this alias for backwards compatibility - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removeargnovaluekey:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removeargsinglekey:nn % Previously, "singlekeys" was called "novaluekeys", so I am keeping this alias for backwards compatibility - -\cs_set_eq:cN { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removearg0valuekey:nn } \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_removeargsinglekey:nn - -% THESE ARE REALLY THE COMMANDS MANIPULATING DATA: - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbol:nn#1#2{ - % Sets the value of the symbol - \semantex_data_tl_set:nnn { #1 } { symbol } { \exp_not:n { #2 } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbol:nn { xn } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_texclass:nn#1#2{ - % Sets the TeX class of the output, e.g. \mathord, \mathbin, \mathop etc. - \semantex_data_tl_set:nnn { #1 } { texclass } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setslot:nn#1#2{ - % Sets the argument slot, i.e. the - in f(-,x) - \semantex_data_tl_set:nnn { #1 } { argslot } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbolputright:nn#1#2{ - % Add something to the right of the symbol - \semantex_data_tl_put_right:nnn { #1 } { symbol } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_symbolputleft:nn#1#2{ - % Add something to the left of the symbol - \semantex_data_tl_put_left:nnn { #1 } { symbol } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_command:nn#1#2{ - % Adds one entry on the left of the command - % sequence to be applied to the symbol - \semantex_data_seq_put_right:nnn { #1 } { commands_sequence } { #2 } %IM maybe \exp_not:n { #2 }? -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearcommand:nn#1#2{ - % Adds one entry on the left of the command - % sequence to be applied to the symbol - \semantex_data_seq_clear:nn { #1 } { commands_sequence } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argwithkeyval:nn#1#2{ - % Sets the argument (allows keyval interface) - \semantex_arg_keys_set:nn { #1 } { #2 } - %IMPORTANT: Previously, we needed three braces around #2, but suddenly - % this changed, even though I did not really change anything related - % to this (except I added _auxiliary_ in the command names related - % to arg keyvals) -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argwithsinglekeys:nn#1#2{ - % Sets the argument (only allows singlekeys) - \semantex_arg_singlekeys_set:nn { #1 } { #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argwithonesinglekey:nn#1#2{ - % Sets the argument (only allows one singlekey) - \use:c { __semantex_data_cs_#1_arg_singlekey:n } { #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_argwithoutkeyval:nn#1#2{ - % Sets the argument (no keyval interface allowed) - \semantex_data_tl_put_right:nnn { #1 } { arg } { \exp_not:n { #2 } } - \semantex_data_int_incr:nn { #1 } { numberofarguments } % Check if this has been added elsewhere - \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setargsep:nn#1#2 +\cs_new_protected:Npn\semantex_define_six_valuekeys:nn#1#2 { - % Sets the argument separator - \semantex_data_tl_set:nnn { #1 } { argsep } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setargdots:nn#1#2 -{ - % Sets the argument dot command - \semantex_data_tl_set:nnn { #1 } { argdots } { \exp_not:n { #2 } } + % Add new valuekeys with 6 values + \clist_map_inline:nn { #2 }{ + \__semantex_six_valuekey_format_auxiliary:nnn{#1}##1 + } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setargslot:nn#1#2 +\cs_new_protected:Npn\__semantex_six_valuekey_format_auxiliary:nnn#1#2#3 { - % Sets the argument dot command - \semantex_data_tl_set:nnn { #1 } { argslot } { \exp_not:n { #2 } } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prearg:nn#1#2{ - % Sets something to write before the argument - \tl_if_blank:nF{#2} + \cs_set:Npn\l__semantex_six_valuekey_auxiliary_temp_cs:nnnnnn##1##2##3##4##5##6 { #3 } + \tl_set:Nn\l__semantex_six_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN + { + \l__semantex_six_valuekey_auxiliary_temp_cs:nnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } + } \l__semantex_six_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } ##1##2##3##4##5##6##7 { - \semantex_data_tl_put_left:nnn { #1 } { prearg } { \exp_not:n { #2 } } + \l__semantex_six_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprearg:nn#1#2 -{ - \semantex_data_tl_clear:nn { #1 } { prearg } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postarg:nn#1#2{ - % Sets something to write after the argument - \tl_if_blank:nF{#2} + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \semantex_data_tl_put_right:nnn { #1 } { postarg } { \exp_not:n{ #2 } } + \use:c { __semantex_data_cs_custom_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } { ##1 } ##2 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostarg:nn#1#2 -{ - \semantex_data_tl_clear:nn { #1 } { postarg } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_output:nn#1#2 +\cs_new_protected:Npn\semantex_define_seven_valuekeys:nn#1#2 { - % Tells what class the object is supposed to output - \semantex_class_if_exist:NTF { #2 } - { - \semantex_data_tl_set:nnx { #1 } { output } { class_\cs_to_str:N #2 } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_output_temp_tl - \msg_error:nnxnn { semantex } { class_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_output_temp_tl } { output } { #2 } + % Add new valuekeys with 7 values + \clist_map_inline:nn { #2 }{ + \__semantex_seven_valuekey_format_auxiliary:nnn{#1}##1 } - % Maybe allow output=self } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_outputoptions:nn#1#2{ - \tl_set:Nn\l__semantex_outputoptions_auxiliary_temp_tl{} - \cs_set:Npn\l__semantex_outputoptions_auxiliary_singlekey_temp_cs:n##1 +\cs_new_protected:Npn\__semantex_seven_valuekey_format_auxiliary:nnn#1#2#3 +{ + \cs_set:Npn\l__semantex_seven_valuekey_auxiliary_temp_cs:nnnnnnn##1##2##3##4##5##6##7 { #3 } + \tl_set:Nn\l__semantex_seven_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \__semantex_outputoptions_process_singlekey:nnN { ####1 } { ##1 } \l__semantex_outputoptions_auxiliary_temp_tl - } - \cs_set:Npn\l__semantex_outputoptions_auxiliary_valuekey_temp_cs:nn##1##2 + \l__semantex_seven_valuekey_auxiliary_temp_cs:nnnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } + } \l__semantex_seven_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } ##1##2##3##4##5##6##7##8 { - \__semantex_outputoptions_process_valuekey:nnnN { ####1 } { ##1 } { ##2 } \l__semantex_outputoptions_auxiliary_temp_tl + \l__semantex_seven_valuekey_auxiliary_temp_tl } - \keyval_parse:NNn - \l__semantex_outputoptions_auxiliary_singlekey_temp_cs:n - \l__semantex_outputoptions_auxiliary_valuekey_temp_cs:nn - { #2 } - \semantex_data_tl_put_right:nno { #1 } { outputoptions } { \l__semantex_outputoptions_auxiliary_temp_tl } - %\exp_args:NNno\exp_args:Nno\cs_set:co { __semantex_data_cs_#1_outputoptions:n } - %\exp_args:Nnno - \semantex_data_cs_set:nnx { #1 } { outputoptions:n } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { -% g__semantex_data_tl_#1_outputoptions -% \semantex_data_tl_get:nn { #1 } { outputoptions } - \semantex_data_tl_get_exp_not:nn { #1 } { outputoptions } - %\l__semantex_outputoptions_auxiliary_temp_tl + \use:c { __semantex_data_cs_custom_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } { ##1 } ##2 } } -\cs_generate_variant:Nn \semantex_data_cs_set:nnn { nnf , nnv , nnx } - -\cs_generate_variant:Nn \semantex_data_tl_put_right:nnn { nno } - - -\cs_new:Npn\__semantex_outputoptions_process_singlekey:nnN#1#2#3 +\cs_new_protected:Npn\semantex_define_eight_valuekeys:nn#1#2 { - \tl_put_right:Nn#3 - { - \exp_not:N\semantex_singlekey:nn { #1 } { \exp_not:n { #2 } } + % Add new valuekeys with 8 values + \clist_map_inline:nn { #2 }{ + \__semantex_eight_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_generate_variant:Nn \semantex_valuekey:nnn { nnx } - -\cs_new:Npn\__semantex_outputoptions_process_valuekey:nnnN#1#2#3#4 +\cs_new_protected:Npn\__semantex_eight_valuekey_format_auxiliary:nnn#1#2#3 { - \tl_if_eq:nnTF { #2 } { execute } + \cs_set:Npn\l__semantex_eight_valuekey_auxiliary_temp_cs:nnnnnnnn##1##2##3##4##5##6##7##8 { #3 } + \tl_set:Nn\l__semantex_eight_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_keys:oN { - \tl_put_right:Nn#4 - { - \exp_not:n { #3 } - } + \l__semantex_eight_valuekey_auxiliary_temp_cs:nnnnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } + } \l__semantex_eight_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##1##2##3##4##5##6##7##8##9 + { + \l__semantex_eight_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \tl_put_right:Nn#4 - { - \exp_not:N\semantex_valuekey:nnn { #1 } { #2 } { \exp_not:n { #3 } } - } + \use:c { __semantex_data_cs_custom_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } ##2 } } -%---------------- - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifleftargument:nn#1#2{ - % Tells whether to rightreturn before rendering the output. - \str_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { leftargument } - } - { - \str_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { leftargument } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifleftargumen_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifleftargumen_temp_tl } { ifleftargument } { #2 } - } +\cs_new_protected:Npn\semantex_define_nine_valuekeys:nn#1#2 +{ + % Add new valuekeys with 9 values + \clist_map_inline:nn { #2 }{ + \__semantex_nine_valuekey_format_auxiliary:nnn{#1}##1 } } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifoutput:nn#1#2{ %IMPLEMENT THIS - % Tells whether to output or not - \str_if_eq:nnTF { #2 } { true } + +\cs_new_protected:Npn\__semantex_nine_valuekey_format_auxiliary:nnn#1#2#3 +{ + \cs_set:Npn\l__semantex_nine_valuekey_auxiliary_temp_cs:nnnnnnnnn##1##2##3##4##5##6##7##8##9 { #3 } + \tl_set:Nn\l__semantex_nine_valuekey_auxiliary_temp_tl{} + \cs_set:Npn\l__semantex_nine_valuekey_auxiliary_singlekey_temp_cs:n##1 { - \semantex_data_bool_set_true:nn { #1 } { output } + \__semantex_preprocess_singlekey:nnN { \__semantex_nine_valuekey_format_auxiliary_name_of_register_temp_tl } { ##1 } \l__semantex_nine_valuekey_auxiliary_temp_tl } + \cs_set:Npn\l__semantex_nine_valuekey_auxiliary_valuekey_temp_cs:nn##1##2 { - \str_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { output } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifoutput_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifoutput_temp_tl } { ifoutput } { #2 } - } + \__semantex_preprocess_valuekey:nnnN { \__semantex_nine_valuekey_format_auxiliary_name_of_register_temp_tl } { ##1 } { ##2 } \l__semantex_nine_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_gradingposition:nn#1#2{ - % Tells whether to use upper or lower indices - \semantex_data_bool_provide:nn { #1 } { uppergrading } - \str_if_eq:nnTF { #2 } { upper } - { - \semantex_data_bool_set_true:nn { #1 } { uppergrading } - } + \semantex_keyval_parse:NNo + \l__semantex_nine_valuekey_auxiliary_singlekey_temp_cs:n + \l__semantex_nine_valuekey_auxiliary_valuekey_temp_cs:nn { - \str_if_eq:nnTF { #2 } { lower } - { - \semantex_data_bool_set_false:nn { #1 } { uppergrading } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_gradingposition_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_gradingposition_temp_tl } { gradingposition } { #2 } - } + \l__semantex_nine_valuekey_auxiliary_temp_cs:nnnnnnnnn { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } } -} - -\cs_set_eq:NN \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_gradingpos:nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_gradingposition:nn - -% Upper and lower right indices: - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nn#1#2{ - % adds to the upper index - \tl_if_blank:nF{#2}{ - \semantex_data_tl_put_right:nnn { #1 } { upper } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } - } -} - - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nn#1#2{ - % Adds to the upper index, with a separator - \tl_if_blank:nF{#2} + \cs_set_protected:cpo { __semantex_data_cs_custom_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##1##2##3##4##5##6##7##8##9 { - \semantex_data_bool_get:nnTF { #1 } { nextupperwithsep } - { - \semantex_data_tl_put_right:nnx { #1 } { upper } - { \exp_not:n { \semantex_data_tl_get:nn { #1 } { uppersep } } } - \semantex_data_tl_put_right:nnn { #1 } { upper } { \exp_not:n { #2 } } - } - { - \semantex_data_tl_put_right:nnn { #1 } { upper } { \exp_not:n { #2 } } - } - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperputleft:nn#1#2{ - % Adds to the left of the upper index - \tl_if_blank:nF{#2}{ - \semantex_data_tl_put_left:nnn { #1 } { upper } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } + \l__semantex_nine_valuekey_auxiliary_temp_tl } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupper:nn#1#2{ - % Sets what to write before upper - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_left:nnn { #1 } { preupper } { \exp_not:n{ #2 } } - } -} -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupper:nn#1#2{ - % Sets what to write after upper - \tl_if_blank:nF{#2} + \cs_set_protected:cpn { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \semantex_data_tl_put_right:nnn { #1 } { postupper } { \exp_not:n{ #2 } } + \tl_set:Nn \__semantex_nine_valuekey_format_auxiliary_name_of_register_temp_tl { ##1 } + \use:c { __semantex_data_cs_custom_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##2 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearupper:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { upper } - \semantex_data_bool_set_false:nn { #1 } { nextupperwithsep } - \semantex_data_int_clear:nn { #1 } { numberofupperindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpreupper:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { preupper } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostupper:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { postupper } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperdots:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { upperdots } { \exp_not:n { #2 } } -} - -\cs_generate_variant:Nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperslot:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { upperslot } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperslot } } -} -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nn { nx } +% SETTING UP THE ARGUMENT KEYVAL INTERFACE -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdotswithothersep:nn#1#2 +\cs_new_protected:Npn\semantex_preprocess_arg_keys:nN#1#2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { upperdots } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslotwithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { upperslot } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nn#1#2{ - % Adds to the lower index - \tl_if_blank:nF{#2} + \cs_set:Npn\l__semantex_preprocess_arg_singlekey_temp_cs:n##1 { - \semantex_data_tl_put_right:nnn { #1 } { lower } { \exp_not:n { #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerindices } + \__semantex_preprocess_arg_singlekey:nnN { ####1 } { ##1 } #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nn#1#2{ - % Adds to the lower index, with a separator - \tl_if_blank:nF{#2} + \cs_set:Npn\l__semantex_preprocess_arg_valuekey_temp_cs:nn##1##2 { - \semantex_data_bool_get:nnTF { #1 } { nextlowerwithsep } - { - \semantex_data_tl_put_right:nnx { #1 } { lower } - { \exp_not:n { \semantex_data_tl_get:nn { #1 } { lowersep } } } - \semantex_data_tl_put_right:nnn { #1 } { lower } { \exp_not:n { #2 } } - } - { - \semantex_data_tl_put_right:nnn { #1 } { lower } { \exp_not:n { #2 } } - } - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerputleft:nn#1#2{ - % Adds to the lower index - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_left:nnn { #1 } { lower } { \exp_not:n { #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerindices } + \__semantex_preprocess_arg_valuekey:nnnN { ####1 } { ##1 } { ##2 } #2 } + \semantex_keyval_parse:NNn + \l__semantex_preprocess_arg_singlekey_temp_cs:n + \l__semantex_preprocess_arg_valuekey_temp_cs:nn + { #1 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelower:nn#1#2{ - % Sets what to write before the lower index - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_left:nnn { #1 } { prelower } { \exp_not:n { #2 } } - } -} +\cs_generate_variant:Nn \semantex_preprocess_arg_keys:nN { oN } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlower:nn#1#2{ - % Sets what to write after the lower index - \tl_if_blank:nF{#2} +\cs_new_protected:Npn\semantex_preprocess_arg_singlekeys:nN#1#2 +{ + \cs_set:Npn\l__semantex_preprocess_arg_singlekey_temp_cs:n##1 { - \semantex_data_tl_put_right:nnn { #1 } { postlower } { \exp_not:n{ #2 } } + \__semantex_preprocess_arg_singlekey:nnN { ####1 } { ##1 } #2 } + \clist_map_function:nN { #1 } \l__semantex_preprocess_arg_singlekey_temp_cs:n } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearlower:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { lower } - \semantex_data_bool_set_false:nn { #1 } { nextlowerwithsep } - \semantex_data_int_clear:nn { #1 } { numberoflowerindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprelower:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { prelower } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostlower:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { postlower } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerdots:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { lowerdots } { \exp_not:n { #2 } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerslot:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { lowerslot } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nn { nx } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerdots:nn#1#2 +\cs_new_protected:Npn\__semantex_preprocess_arg_singlekey:nnN#1#2#3 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerslot } } + \tl_put_right:Nn#3 + { + \semantex_arg_singlekey:nn { #1 } { #2 } + } } -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdotswithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { lowerdots } } } -} -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslotwithothersep:nn#1#2 +\cs_new_protected:Npn\__semantex_preprocess_arg_valuekey:nnnN#1#2#3#4 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { lowerslot } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nn#1#2{ - % upperwithsep={separator}{contents} adds contents to the upper index - % with the appropriate index separator - \semantex_data_bool_get:nnTF { #1 } { nextupperwithsep } + \str_case:nnF { #2 } { - \semantex_data_tl_put_right:nnn { #1 } { upper } { - \exp_not:n { - \semantex_grab_first_argument_of_two:nn #2 - \semantex_grab_second_argument_of_two:nn #2 + { execute }{ + \tl_put_right:Nn#4 + { + #3 } } - } - { - \semantex_data_tl_put_right:nnn { #1 } { upper } { - \exp_not:n { - \semantex_grab_second_argument_of_two:nn #2 - } + { setkeys }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nn#1#2{ - % lowerwithsep={separator}{contents} adds contents to the lower index - % with the appropriate index separator - \semantex_data_bool_get:nnTF { #1 } { nextlowerwithsep } - { - \semantex_data_tl_put_right:nnn { #1 } { lower } { - \exp_not:n { - \semantex_grab_first_argument_of_two:nn #2 - \semantex_grab_second_argument_of_two:nn #2 - } + { keysset }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } - { - \semantex_data_tl_put_right:nnn { #1 } { lower } { - \exp_not:n { - \semantex_grab_second_argument_of_two:nn #2 - } + { setkeysx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - } - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nn#1#2{ - % Adds to the upper index, with a comma as separator - \tl_if_blank:nF{#2} - { - \semantex_data_bool_get:nnTF { #1 } { nextupperwithsep } - { - \semantex_data_tl_put_right:nnn { #1 } { upper } { , \exp_not:n { #2 } } + { keyssetx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - { - \semantex_data_tl_put_right:nnn { #1 } { upper } { \exp_not:n { #2 } } + { setargkeys }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperindices } - } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nn#1#2{ - % Adds to the lower index, with a comma as separator - \tl_if_blank:nF{#2} - { - \semantex_data_bool_get:nnTF { #1 } { nextlowerwithsep } - { - \semantex_data_tl_put_right:nnn { #1 } { lower } { , \exp_not:n { #2 } } + { argkeysset }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - { - \semantex_data_tl_put_right:nnn { #1 } { lower } { \exp_not:n { #2 } } + { setargkeysx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep:nn#1#2 -{ - % Tells whether the upper index is the first one - \tl_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { nextupperwithsep } - } - { - \tl_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { nextupperwithsep } + { argkeyssetx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep_temp_tl } { ifnextupperwithsep } { #2 } + { setargsinglekeys }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep:nn#1#2 % should be removed later -{ - % Tells whether the lower index is the first one - \tl_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { nextlowerwithsep } - } - { - \tl_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { nextlowerwithsep } + { argsinglekeysset }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep_temp_tl } { ifnextlowerwithsep } { #2 } + { setargsinglekeysx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 + } + { argsinglekeyssetx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setuppersep:nn#1#2 -{ - % Sets the separator for the upper index - \semantex_data_tl_set:nnn { #1 } { uppersep } { \exp_not:n { #2 }} -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowersep:nn#1#2 -{ - % Sets the separator for the lower index - \semantex_data_tl_set:nnn { #1 } { lowersep } { \exp_not:n { #2 }} -} - -%--------------- Left indices: (I don't repeat all of the documentation) - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleft:nn#1#2{ - % adds to the upper left index - \tl_if_blank:nF{#2}{ - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperleftindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleft:nn#1#2{ - \tl_if_blank:nF{#2} { - \semantex_data_bool_get:nnTF { #1 } { nextupperwithsep } - { - \semantex_data_tl_put_left:nnx { #1 } { upperleft } - { \exp_not:n { \semantex_data_tl_get:nn { #1 } { uppersep } } } - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { \exp_not:n { #2 } } - } + \tl_put_right:Nn#4 { - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { \exp_not:n { #2 } } + \semantex_arg_valuekey:nnn { #1 } { #2 } { #3 } } - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperleftindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftputright:nn#1#2{ - \tl_if_blank:nF{#2}{ - \semantex_data_tl_put_right:nnn { #1 } { upperleft } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperleftindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupperleft:nn#1#2{ - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_left:nnn { #1 } { preupperleft } { \exp_not:n{ #2 } } } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupperleft:nn#1#2{ - % adds to the lower index - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_right:nnn { #1 } { postupperleft } { \exp_not:n{ #2 } } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearupperleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { upperleft } - \semantex_data_bool_set_false:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_clear:nn { #1 } { numberofupperleftindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpreupperleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { preupperleft } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostupperleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { preupperleft } -} +% The x version: -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperleftdots:nn#1#2 +\cs_new_protected:Npn\semantex_preprocess_arg_keys_x:nN#1#2 { - \semantex_data_tl_set:nnn { #1 } { upperleftdots } { \exp_not:n { #2 } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperleftslot:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { upperleftslot } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { upperleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftwithothersep:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftdotswithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { upperleftdots } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftslotwithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { upperleftslot } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleft:nn#1#2{ - \tl_if_blank:nF{#2} + \cs_set:Npn\l__semantex_preprocess_arg_singlekey_x_temp_cs:n##1 { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerleftindices } + \__semantex_preprocess_arg_singlekey_x:nnN { ####1 } { ##1 } #2 } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleft:nn#1#2{ - \tl_if_blank:nF{#2} + \cs_set:Npn\l__semantex_preprocess_arg_valuekey_x_temp_cs:nn##1##2 { - \semantex_data_bool_get:nnTF { #1 } { nextlowerleftwithsep } - { - \semantex_data_tl_put_left:nnx { #1 } { lowerleft } - { \exp_not:n { \semantex_data_tl_get:nn { #1 } { lowerleftsep } } } - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { \exp_not:n { #2 } } - } - { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { \exp_not:n { #2 } } - } - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerleftindices } + \__semantex_preprocess_arg_valuekey_x:nnnN { ####1 } { ##1 } { ##2 } #2 } + \semantex_keyval_parse:NNn + \l__semantex_preprocess_arg_singlekey_x_temp_cs:n + \l__semantex_preprocess_arg_valuekey_x_temp_cs:nn + { #1 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftputright:nn#1#2{ - \tl_if_blank:nF{#2} %This test really shouldn’t be made. +\cs_new_protected:Npn\semantex_preprocess_arg_singlekeys_x:nN#1#2 +{ + \cs_set:Npn\l__semantex_preprocess_arg_singlekey_x_temp_cs:n##1 { - \semantex_data_tl_put_right:nnn { #1 } { lowerleft } { \exp_not:n{ #2 } } - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerleftindices } + \__semantex_preprocess_arg_singlekey_x:nnN { ####1 } { ##1 } #2 } + \clist_map_function:nN { #1 } \l__semantex_preprocess_arg_singlekey_x_temp_cs:n } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelowerleft:nn#1#2{ - \tl_if_blank:nF{#2} - { - \semantex_data_tl_put_left:nnn { #1 } { prelowerleft } { \exp_not:n{ #2 } } - } -} -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlowerleft:nn#1#2{ - \tl_if_blank:nF{#2} +\cs_new_protected:Npn\__semantex_preprocess_arg_singlekey_x:nnN#1#2#3 +{ + \tl_put_right:Nn#3 { - \semantex_data_tl_put_right:nnn { #1 } { postlowerleft } { \exp_not:n{ #2 } } + \semantex_arg_singlekey_x:nn { #1 } { #2 } } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperleftwithothersep:nn#1#2{ - \semantex_data_bool_get:nnTF { #1 } { nextupperleftwithsep } - { - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { - \exp_not:n { \semantex_grab_second_argument_of_two:nn #2 \semantex_grab_first_argument_of_two:nn #2 } - } - } +\cs_new_protected:Npn\__semantex_preprocess_arg_valuekey_x:nnnN#1#2#3#4 +{ + \str_case:nnF { #2 } { - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { - \exp_not:n { \semantex_grab_second_argument_of_two:nn #2 } + { execute } { + \tl_put_right:Nn#4 + { + #3 + } } - } - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperleftindices } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftwithothersep:nn#1#2{ - \semantex_data_bool_get:nnTF { #1 } { nextlowerleftwithsep } - { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { - \exp_not:n { \semantex_grab_second_argument_of_two:nn #2 \semantex_grab_first_argument_of_two:nn #2 } + { setkeys }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } - { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { - \exp_not:n { \semantex_grab_second_argument_of_two:nn #2 } + { keysset }{ + \semantex_preprocess_keys:nN { #3 } #4 } - } - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerleftindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearlowerleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { lowerleft } - \semantex_data_bool_set_false:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_clear:nn { #1 } { numberoflowerleftindices } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprelowerleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { prelowerleft } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostlowerleft:nn#1#2{ - \semantex_data_tl_clear:nn { #1 } { prelowerleft } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerleftdots:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { lowerleftdots } { \exp_not:n { #2 } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerleftslot:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { lowerleftslot } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleft:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleftdots:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftdots } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleftslot:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleft:nx { #1 } { \semantex_data_tl_get:nn { #1 } { lowerleftslot } } -} - -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftwithothersep:nn { nx } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftdotswithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { lowerleftdots } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftslotwithothersep:nn#1#2 -{ - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerleftwithothersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get:nn { #1 } { lowerleftslot } } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperleft:nn#1#2{ - \tl_if_blank:nF{#2} - { - \semantex_data_bool_get:nnTF { #1 } { nextupperleftwithsep } - { - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { \exp_not:n { #2 } , } + { setkeysx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - { - \semantex_data_tl_put_left:nnn { #1 } { upperleft } { \exp_not:n { #2 } } + { keyssetx }{ + \semantex_preprocess_keys_x:nN { #3 } #4 } - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberofupperleftindices } - } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerleft:nn#1#2{ - \tl_if_blank:nF{#2} - { - \semantex_data_bool_get:nnTF { #1 } { nextlowerleftwithsep } - { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { \exp_not:n { #2 } , } + { setargkeys }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - { - \semantex_data_tl_put_left:nnn { #1 } { lowerleft } { \exp_not:n { #2 } } + { argkeysset }{ + \semantex_preprocess_arg_keys:nN { #3 } #4 } - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } - \semantex_data_int_incr:nn { #1 } { numberoflowerleftindices } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperleftwithsep:nn#1#2 -{ - \tl_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { nextupperleftwithsep } - } - { - \tl_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { nextupperleftwithsep } + { setargkeysx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperleftwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperleftwithsep_temp_tl } { ifnextupperleftwithsep } { #2 } + { argkeyssetx }{ + \semantex_preprocess_arg_keys_x:nN { #3 } #4 } - } -} - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerleftwithsep:nn#1#2 -{ - \tl_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { nextlowerleftwithsep } - } - { - \tl_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { nextlowerleftwithsep } + { setargsinglekeys }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - { - semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerleftwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerleftwithsep_temp_tl } { ifnextlowerleftwithsep } { #2 } + { argsinglekeysset }{ + \semantex_preprocess_arg_singlekeys:nN { #3 } #4 } - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperleftsep:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { upperleftsep } { \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerleftsep:nn#1#2 -{ - \semantex_data_tl_set:nnn { #1 } { lowerleftsep } { \exp_not:n { #2 } } -} - -% Contrary to what you might think, the following commands ARE -% sometimes needed. - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdwithsep:nn#1#2 % should be removed later -{ - % Tells whether the d (degree) is empty or not - \str_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep:nn { #1 } { #2 } } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep:nn { #1 } { #2 } } - } - { - \str_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep:nn { #1 } { #2 } } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep:nn { #1 } { #2 } } + { setargsinglekeysx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdwithsep_temp_tl } { ifnextdwithsep } { #2 } + { argsinglekeyssetx }{ + \semantex_preprocess_arg_singlekeys_x:nN { #3 } #4 } } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdegwithsep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdwithsep - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdegreewithsep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextdwithsep - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextiwithsep:nn#1#2 -{ - % Tells whether the i (index) is empty or not - \str_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep:nn { #1 } { #2 } } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep:nn { #1 } { #2 } } - } { - \str_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextlowerwithsep:nn { #1 } { #2 } } - { \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextupperwithsep:nn { #1 } { #2 } } - } + \tl_put_right:Nn#4 { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextiwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextiwithsep_temp_tl } { ifnextiwithsep } { #2 } + \semantex_arg_valuekey:nnx { #1 } { #2 } { #3 } } } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextindexwithsep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextiwithsep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_d:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_valuekeys:nn#1#2 { - % adds to the d-index (upper by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nn { #1 } { #2 } + % Add new valuekeys + \clist_map_inline:nn { #2 }{ + \__semantex_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_deg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_d:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_d:nn +\cs_generate_variant:Nn \l__semantex_auxiliary_preprocess_arg_keys_temp:n { o } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sd:nn#1#2 +\cs_new_protected:Npn\__semantex_arg_valuekey_format_auxiliary:nnn#1#2#3 { - % adds to the d-index (upper by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sd:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sd:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cd:nn#1#2{ %IM Maybe remove this. - % adds to the d-index (upper by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cd:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cd:nn - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_i:nn#1#2{ - % adds to the i-index (lower by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lower:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upper:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_index:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_i:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_si:nn#1#2{ - % adds to the i-index (lower by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slower:nn { #1 } { #2 } - } + \cs_set:Npn\l__semantex_arg_valuekey_auxiliary_temp_cs:n##1 { #3 } + \tl_set:Nn \l__semantex_arg_valuekey_auxiliary_temp_tl {} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supper:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_si:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ci:nn#1#2{ - % adds to the i-index (lower by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \l__semantex_arg_valuekey_auxiliary_temp_cs:n { ##2 } + } \l__semantex_arg_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clower:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupper:nn { #1 } { #2 } + \l__semantex_arg_valuekey_auxiliary_temp_tl } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ci:nn - - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dwithothersep:nn#1#2 +\cs_new_protected:Npn\semantex_remove_arg_valuekey:nn#1#2 { - % adds to the d-index (upper by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degwithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dwithothersep:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreewithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dwithothersep:nn - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_iwithothersep:nn#1#2{ - % adds to the i-index (lower by default) - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerwithothersep:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperwithothersep:nn { #1 } { #2 } - } + \cs_undefine:c { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_indexwithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_iwithothersep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdsep:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_singlekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setuppersep:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowersep:nn { #1 } { #2 } + % Add keys taking no values + \clist_map_inline:nn { #2 }{ + \__semantex_arg_singlekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegsep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdsep:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegreesep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdsep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setisep:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } +\cs_new_protected:Npn \__semantex_arg_singlekey_format_auxiliary:nnn#1#2#3{ + \cs_set:Npn\l__semantex_arg_singlekey_auxiliary_temp_cs: { #3 } + \tl_set:Nn \l__semantex_arg_singlekey_auxiliary_temp_tl {} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowersep:nn { #1 } { #2 } - } + \l__semantex_arg_singlekey_auxiliary_temp_cs: + } \l__semantex_arg_singlekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_singlekey_#1_\tl_trim_spaces:n{#2}:n } ##1 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setuppersep:nn { #1 } { #2 } + \l__semantex_arg_singlekey_auxiliary_temp_tl } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setindexsep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setisep:nn -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_pred:nn#1#2 +\cs_new_protected:Npn\semantex_remove_arg_singlekey:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelower:nn { #1 } { #2 } - } + \cs_undefine:c { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_predeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_pred:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_predegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_pred:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postd:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_two_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlower:nn { #1 } { #2 } + % Add new argument valuekeys with 2 values + \clist_map_inline:nn { #2 }{ + \__semantex_arg_two_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postdeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postd:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postdegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postd:nn - - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleard:nn#1#2 +\cs_new_protected:Npn\__semantex_arg_two_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_two_valuekey_auxiliary_temp_cs:nn##1##2 { #3 } + \tl_set:Nn\l__semantex_arg_two_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearupper:nn { #1 } { #2 } - } + \l__semantex_arg_two_valuekey_auxiliary_temp_cs:nn { ##2 } { ##3 } + } \l__semantex_arg_two_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } ##1##2##3 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearlower:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleardeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleard:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleardegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleard:nn - - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpred:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpreupper:nn { #1 } { #2 } + \l__semantex_arg_two_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprelower:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpredeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpred:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpredegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpred:nn - - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostd:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_three_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostupper:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostlower:nn { #1 } { #2 } + % Add new argument valuekeys with 3 values + \clist_map_inline:nn { #2 }{ + \__semantex_three_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostdeg:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostd:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostdegree:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostd:nn - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prei:nn#1#2 +\cs_new_protected:Npn\__semantex_three_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_three_valuekey_auxiliary_temp_cs:nnn##1##2##3 { #3 } + \tl_set:Nn\l__semantex_arg_three_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prelower:nn { #1 } { #2 } - } + \l__semantex_arg_three_valuekey_auxiliary_temp_cs:nnn { ##2 } { ##3 } { ##4 } + } \l__semantex_arg_three_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } ##1##2##3##4 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preupper:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_preindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_prei:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_posti:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postlower:nn { #1 } { #2 } + \l__semantex_arg_three_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postupper:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_postindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_posti:nn - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleari:nn#1#2 +\cs_new:Npn\semantex_define_arg_four_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearlower:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearupper:nn { #1 } { #2 } + % Add new argument valuekeys with 4 values + \clist_map_inline:nn { #2 }{ + \__semantex_four_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cleari:nn - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprei:nn#1#2 +\cs_new_protected:Npn\__semantex_four_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprelower:nn { #1 } { #2 } - } + \cs_set:Npn\l__semantex_arg_four_valuekey_auxiliary_temp_cs:nnnn##1##2##3##4 { #3 } + \tl_set:Nn\l__semantex_arg_four_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpreupper:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpreindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearprei:nn - -\cs_set:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearposti:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \l__semantex_arg_four_valuekey_auxiliary_temp_cs:nnnn { ##2 } { ##3 } { ##4 } { ##5 } + } \l__semantex_arg_four_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } ##1##2##3##4##5 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostlower:nn { #1 } { #2 } + \l__semantex_arg_four_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostupper:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearpostindex:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clearposti:nn - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setddots:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_five_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \semantex_data_tl_set:nnn { #1 } { upperdots } { \exp_not:n s{ #2 } } - } - { - \semantex_data_tl_set:nnn { #1 } { lowerdots } { \exp_not:n { #2 } } + % Add new argument valuekeys with 5 values + \clist_map_inline:nn { #2 }{ + \__semantex_five_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setddots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setddots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddots:nn#1#2 +\cs_new_protected:Npn\__semantex_five_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_five_valuekey_auxiliary_temp_cs:nnnnn##1##2##3##4##5 { #3 } + \tl_set:Nn\l__semantex_arg_five_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdots:nn { #1 } { #2 } - } + \l__semantex_arg_five_valuekey_auxiliary_temp_cs:nnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } + } \l__semantex_arg_five_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } ##1##2##3##4##5##6 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdots:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdslot:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperslot:nn { #1 } { #2 } + \l__semantex_arg_five_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerslot:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdslot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdslot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslot:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_six_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslot:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslot:nn { #1 } { #2 } + % Add new argument valuekeys with 6 values + \clist_map_inline:nn { #2 }{ + \__semantex_six_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sddots:nn#1#2 +\cs_new_protected:Npn\__semantex_six_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_six_valuekey_auxiliary_temp_cs:nnnnnn##1##2##3##4##5##6 { #3 } + \tl_set:Nn\l__semantex_arg_six_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperdots:nn { #1 } { #2 } - } + \l__semantex_arg_six_valuekey_auxiliary_temp_cs:nnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } + } \l__semantex_arg_six_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } ##1##2##3##4##5##6##7 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerdots:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sddots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sddots:nn - - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdslot:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperslot:nn { #1 } { #2 } + \l__semantex_arg_six_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerslot:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdslot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdslot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cddots:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_seven_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperdots:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerdots:nn { #1 } { #2 } + % Add new argument valuekeys with 7 values + \clist_map_inline:nn { #2 }{ + \__semantex_seven_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cddots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cddots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdslot:nn#1#2 +\cs_new_protected:Npn\__semantex_seven_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperslot:nn { #1 } { #2 } - } + \cs_set:Npn\l__semantex_arg_seven_valuekey_auxiliary_temp_cs:nnnnnnn##1##2##3##4##5##6##7 { #3 } + \tl_set:Nn\l__semantex_arg_seven_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerslot:nn { #1 } { #2 } - } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdslot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdslot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddotswithothersep:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \l__semantex_arg_seven_valuekey_auxiliary_temp_cs:nnnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } + } \l__semantex_arg_seven_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } ##1##2##3##4##5##6##7##8 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdotswithothersep:nn { #1 } { #2 } + \l__semantex_arg_seven_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdotswithothersep:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degdotswithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddotswithothersep:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreedotswithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ddotswithothersep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslotwithothersep:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_eight_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslotwithothersep:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslotwithothersep:nn { #1 } { #2 } + % Add new argument valuekeys with 8 values + \clist_map_inline:nn { #2 }{ + \__semantex_eight_arg_valuekey_format_auxiliary:nnn{#1}##1 } } - - -%---------------------------------------------------------- - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setidots:nn#1#2 +\cs_new_protected:Npn\__semantex_eight_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_eight_valuekey_auxiliary_temp_cs:nnnnnnnn##1##2##3##4##5##6##7##8 { #3 } + \tl_set:Nn\l__semantex_arg_eight_valuekey_auxiliary_temp_tl{} + \semantex_preprocess_arg_keys:oN { - \semantex_data_tl_set:nnn { #1 } { lowerdots } { \exp_not:n { #2 } } - } + \l__semantex_arg_eight_valuekey_auxiliary_temp_cs:nnnnnnnn { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } + } \l__semantex_arg_eight_valuekey_auxiliary_temp_tl + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##1##2##3##4##5##6##7##8##9 { - \semantex_data_tl_set:nnn { #1 } { upperdots } { \exp_not:n { #2 } } + \l__semantex_arg_eight_valuekey_auxiliary_temp_tl } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setindexdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setidots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setidots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idots:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdots:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdots:nn { #1 } { #2 } + \use:c { __semantex_data_cs_custom_arg_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_indexdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setislot:nn#1#2 +\cs_new_protected:Npn\semantex_define_arg_nine_valuekeys:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setlowerslot:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setupperslot:nn { #1 } { #2 } + % Add new argument valuekeys with 9 values + \clist_map_inline:nn { #2 }{ + \__semantex_nine_arg_valuekey_format_auxiliary:nnn{#1}##1 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setindexslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setislot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_setislot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_islot:nn#1#2 +\cs_new_protected:Npn\__semantex_nine_arg_valuekey_format_auxiliary:nnn#1#2#3 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \cs_set:Npn\l__semantex_arg_nine_valuekey_auxiliary_temp_cs:nnnnnnnnn##1##2##3##4##5##6##7##8##9 { #3 } + \tl_set:Nn\l__semantex_arg_nine_valuekey_auxiliary_temp_tl{} + \cs_set:Npn\l__semantex_arg_nine_valuekey_auxiliary_singlekey_temp_cs:n##1 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslot:nn { #1 } { #2 } + \__semantex_preprocess_arg_singlekey:nnN { \__semantex_arg_nine_valuekey_format_auxiliary_name_of_register_temp_tl } { ##1 } \l__semantex_arg_nine_valuekey_auxiliary_temp_tl } + \cs_set:Npn\l__semantex_arg_nine_valuekey_auxiliary_valuekey_temp_cs:nn##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslot:nn { #1 } { #2 } + \__semantex_preprocess_arg_valuekey:nnnN { \__semantex_arg_nine_valuekey_format_auxiliary_name_of_register_temp_tl } { ##1 } { ##2 } \l__semantex_arg_nine_valuekey_auxiliary_temp_tl } -} - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_indexslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_islot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_islot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sidots:nn#1#2 -{ - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + \semantex_keyval_parse:NNo + \l__semantex_arg_nine_valuekey_auxiliary_singlekey_temp_cs:n + \l__semantex_arg_nine_valuekey_auxiliary_valuekey_temp_cs:nn + { + \l__semantex_arg_nine_valuekey_auxiliary_temp_cs:nnnnnnnnn { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } + } + \cs_set_protected:cpo { __semantex_data_cs_custom_arg_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##1##2##3##4##5##6##7##8##9 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerdots:nn { #1 } { #2 } + \l__semantex_arg_nine_valuekey_auxiliary_temp_tl } + \cs_set_protected:cpn { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } ##1##2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperdots:nn { #1 } { #2 } + \tl_set:Nn \__semantex_arg_nine_valuekey_format_auxiliary_name_of_register_temp_tl { ##1 } + \use:c { __semantex_data_cs_custom_arg_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } ##2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sindexdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sidots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sidots:nn - +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% COMMANDS HANDLING THE PARSE ROUTINE +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sislot:nn#1#2 +\cs_new_protected:Npn\semantex_parse:n#1 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_slowerslot:nn { #1 } { #2 } - } + % This command runs all the keys that the user may have + % stored via the parseoptions key + \exp_args:NNx\cs_set_protected:Nn\l__semantex_parse_temp_cs:n + % \cs_set:Nx gave us ##1 where we wanted #1 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_supperslot:nn { #1 } { #2 } + \semantex_data_tl_get_exp_not:nn { #1 } { parseoptions } } + \l__semantex_parse_temp_cs:n { #1 } + \semantex_data_tl_clear:nn { #1 } { parseoptions } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sindexslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sislot:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sislot:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cidots:nn#1#2 +\cs_new_protected:Npn\semantex_add_to_parse_options:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerdots:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperdots:nn { #1 } { #2 } - } + \tl_set:Nn\l__semantex_parseoptions_auxiliary_temp_tl{} + \semantex_preprocess_keys:nN { #2 } \l__semantex_parseoptions_auxiliary_temp_tl + \semantex_add_raw_commands_to_parse_options:no { #1 } { \l__semantex_parseoptions_auxiliary_temp_tl } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cindexdots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cidots:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegreedots:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cidots:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cislot:nn#1#2 +\cs_new_protected:Npn\semantex_add_raw_commands_to_parse_options:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_clowerslot:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cupperslot:nn { #1 } { #2 } - } + \semantex_data_tl_put_right:nnn { #1 } { parseoptions } { #2 } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cindexslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cislot:nn +\cs_generate_variant:Nn \semantex_add_raw_commands_to_parse_options:nn { no } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cdegreeslot:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_cislot:nn +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% COMMANDS HANDLING OUTPUT OPTIONS +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idotswithothersep:nn#1#2 +\cs_new_protected:Npn\semantex_set_output:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } + % Tells what class the register is supposed to output + \semantex_class_if_exist:NTF #2 { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerdotswithothersep:nn { #1 } { #2 } + \semantex_data_tl_set:nnx { #1 } { output } { \semantex_class_to_register:N #2 } } { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperdotswithothersep:nn { #1 } { #2 } + \semantex_msg_error:nnnn { #1 } { class_not_found } { output } { #2 } } } -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_indexdotswithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idotswithothersep:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreedotswithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_idotswithothersep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_islotwithothersep:nn#1#2 +\cs_new_protected:Npn\semantex_add_to_output_options:nn#1#2 { - \semantex_data_bool_get:nnTF { #1 } { uppergrading } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_lowerslotwithothersep:nn { #1 } { #2 } - } - { - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_upperslotwithothersep:nn { #1 } { #2 } - } + \tl_set:Nn\l__semantex_output_options_auxiliary_temp_tl{} + \semantex_preprocess_keys:nN { #2 } \l__semantex_output_options_auxiliary_temp_tl + \semantex_add_raw_commands_to_output_options:no { #1 } { \l__semantex_output_options_auxiliary_temp_tl } } -%---------------------------------------------------------- - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degslotwithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslotwithothersep:nn - -\cs_set_eq:NN\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_degreeslotwithothersep:nn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_dslotwithothersep:nn - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_par:nn#1#2{ - % Turns parentheses on, and sets their size - \semantex_data_tl_set:nnn { #1 } { parsize }{ \exp_not:n { #2 } } - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifpar:nn { #1 } { true } +\cs_new_protected:Npn\semantex_add_raw_commands_to_output_options:nn#1#2 +{ + \semantex_data_tl_put_right:nnn { #1 } { outputoptions } { #2 } } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_parsize:nn#1#2{ - % Sets the size of the parentheses - \semantex_data_tl_set:nnn { #1 } { parsize }{ \exp_not:n { #2 } } -} +\cs_generate_variant:Nn \semantex_add_raw_commands_to_output_options:nn { no } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftpar:nn#1#2{ - \semantex_data_tl_set:nnn { #1 } { leftpar }{ \exp_not:n { #2 } } -} -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftpar:nn { xn } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% USER-LEVEL PROGRAMMING KEYS +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightpar:nn#1#2{ - \semantex_data_tl_set:nnn { #1 } { rightpar }{ \exp_not:n { #2 } } -} +\cs_generate_variant:Nn\str_if_eq:nnTF { xxTF } -\cs_generate_variant:Nn \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightpar:nn { xn } +\cs_generate_variant:Nn\str_if_eq:nnT { xxT } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifpar:nn#1#2{ %IMPLEMENT THIS - % tells whether to use the output class or not - \semantex_data_bool_provide:nn { #1 } { par } - \str_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { par } - \semantex_data_bool_set_false:nn { #1 } { flexpar } - } - { - \str_if_eq:nnTF { #2 } { never } - { - \semantex_data_bool_set_false:nn { #1 } { par } - \semantex_data_bool_set_false:nn { #1 } { flexpar } - } - { - \str_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { par } - \semantex_data_bool_set_true:nn { #1 } { flexpar } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifpar_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifpar_temp_tl } { ifpar } { #2 } - } - } - } -} -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar:nn#1#2 -{ - % Abbreviation for "symbol parentheses" - % Adds parentheses around the current symbol - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_return:nn { #1 }{} - \semantex_data_tl_inherit:nn { #1 } { symbol } % Check if really necessary - \tl_if_blank:nTF { #2 } - { - \semantex_data_tl_get_store:nnN { #1 } { sparsize } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_sparsize_temp_tl - \__semantex_symbol_parentheses_store:nnnnN - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_sparsize_temp_tl } - { \semantex_data_tl_get:nn { #1 } { leftspar } } - { \semantex_data_tl_get:nn { #1 } { rightspar } } - { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } - \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_temp_tl - \semantex_data_tl_set:nnx { #1 } { symbol } - { - \exp_not:V\l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_temp_tl - } - } - { - \tl_set:Nn \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_sparsize_temp_tl { \exp_not:n { #2 } } - \__semantex_symbol_parentheses_store:nnnnN - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_sparsize_temp_tl } - { \semantex_data_tl_get:nn { #1 } { leftspar } } - { \semantex_data_tl_get:nn { #1 } { rightspar } } - { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } - \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_temp_tl - \semantex_data_tl_set:nnx { #1 } { symbol } - { - \exp_not:V\l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_spar_temp_tl - } - } -} +\cs_generate_variant:Nn\str_if_eq:nnF { xxF } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextargwithsep:nn#1#2 -{ - % Tells whether it is the first argument or not - \tl_if_eq:nnTF { #2 } { true } - { - \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } - } - { - \tl_if_eq:nnTF { #2 } { false } - { - \semantex_data_bool_set_false:nn { #1 } { nextargwithsep } - } - { - \semantex_error_output_format:nN { #1 } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextargwithsep_temp_tl - \msg_error:nnxnn { semantex } { key_value_not_found } { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifnextargwithsep_temp_tl } { ifnextargwithsep } { #2 } - } - } -} +\cs_generate_variant:Nn\tl_if_blank:nTF { xTF, xT } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar:nn#1#2 -{ - % Uses the syntax otherspar={leftpar}{rightpar} - % Adds a new spar, but with these as parentheses - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_auxiliary:nnn { #1 } #2 -} +\cs_generate_variant:Nn \tl_if_blank:nF { xF } -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_auxiliary:nnn#1#2#3 -{ - \semantex_data_tl_inherit:nn { #1 } { sparsize } % This is necessary for unknown reasons -- otherwise, it will crash when inheriting sparsize - \semantex_data_tl_inherit:nn { #1 } { symbol } - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_return:nn { #1 }{} - \semantex_data_tl_get_store:nnN { #1 } { sparsize } \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_sparsize_temp_tl - \__semantex_symbol_parentheses_store:nnnnN - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_sparsize_temp_tl } - { \exp_not:n { \exp_not:n { #2 } } } - { \exp_not:n { \exp_not:n { #3 } } } - { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } - \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_temp_tl - \semantex_data_tl_set:nnx { #1 } { symbol } - { - \exp_not:V\l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_otherspar_temp_tl - } +\cs_generate_variant:Nn \semantex_keys_set:nn { on } + +\cs_generate_variant:Nn \semantex_keys_set_x:nn { on } + +\cs_new:Npn\semantex_this:{ + \msg_error:nn { semantex } { SemantexThis_in_input_stream } +} +\cs_new:Npn\SemantexThis{\semantex_this:} +\cs_new_protected:Npn\SemantexDataProvide#1{\semantex_data_tl_provide:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexDataSet#1#2{\semantex_data_tl_set:nnn{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new_protected:Npn\SemantexDataSetx#1#2{\semantex_data_tl_set:nnx{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new_protected:Npn\SemantexDataPutRight#1#2{\semantex_data_tl_put_right:nnn{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new_protected:Npn\SemantexDataPutRightx#1#2{\semantex_data_tl_put_right:nnx{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new_protected:Npn\SemantexDataPutLeft#1#2{\semantex_data_tl_put_left:nnn{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new_protected:Npn\SemantexDataPutLeftx#1#2{\semantex_data_tl_put_left:nnx{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new:Npn\SemantexDataGet#1{\semantex_data_tl_get:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new:Npn\SemantexDataGetExpNot#1{\semantex_data_tl_get_exp_not:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexDataClear#1{\semantex_data_tl_clear:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexSetKeys#1{\semantex_keys_set:on{\semantex_this:}{#1}} +\cs_new_protected:Npn\SemantexKeysSet#1{\semantex_keys_set:on{\semantex_this:}{#1}} +\cs_new_protected:Npn\SemantexSetKeysx#1{\semantex_keys_set_x:on{\semantex_this:}{#1}} +\cs_new_protected:Npn\SemantexKeysSetx#1{\semantex_keys_set_x:on{\semantex_this:}{#1}} +\cs_new_protected:Npn\SemantexSetArgKeys#1{\semantex_arg_keys_set:nn { \semantex_this: } { #1 }} +\cs_new_protected:Npn\SemantexArgKeysSet#1{\semantex_arg_keys_set:nn { \semantex_this: } { #1 }} +\cs_new_protected:Npn\SemantexSetArgKeysx#1{\semantex_arg_keys_set_x:nn { \semantex_this: } { #1 }} +\cs_new_protected:Npn\SemantexArgKeysSetx#1{\semantex_arg_keys_set_x:nn { \semantex_this: } { #1 }} +\cs_new_protected:Npn\SemantexSetArgSingleKeys#1{\semantex_arg_singlekeys_set:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexArgSingleKeysSet#1{\semantex_arg_singlekeys_set:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexSetArgSingleKeysx#1{\semantex_arg_singlekeys_set_x:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexArgSingleKeysSetx#1{\semantex_arg_singlekeys_set_x:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexSetOneArgSingleKey#1{\semantex_arg_singlekey:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexOneSingleArgKeySet#1{\semantex_arg_singlekey:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexSetOneArgSingleKeyx#1{\semantex_arg_singlekey_x:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexOneSingleArgKeySetx#1{\semantex_arg_singlekey_x:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexSetArgWithoutKeyval#1{\semantex_arg_without_keyval:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexArgWithoutKeyvalSet#1{\semantex_arg_without_keyval:nn { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexSetArgWithoutKeyvalx#1{\semantex_arg_without_keyval:nx { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexArgWithoutKeyvalSetx#1{\semantex_arg_without_keyval:nx { \semantex_this: } { #1 } } +\cs_new_protected:Npn\SemantexStrIfEqTF#1#2#3#4{\str_if_eq:xxTF{#1}{#2}{#3}{#4}} +\cs_new_protected:Npn\SemantexStrIfEqT#1#2#3{\str_if_eq:xxT{#1}{#2}{#3}} +\cs_new_protected:Npn\SemantexStrIfEqF#1#2#3{\str_if_eq:xxF{#1}{#2}{#3}} +\cs_new_protected:Npn\SemantexIfBlankTF#1#2#3{\tl_if_blank:xTF{#1}{#2}{#3}} +\cs_new_protected:Npn\SemantexIfBlankT#1#2{\tl_if_blank:xT{#1}{#2}} +\cs_new_protected:Npn\SemantexIfBlankF#1#2{\tl_if_blank:xF{#1}{#2}} +\cs_new_protected:Npn\SemantexBoolProvide#1{\semantex_data_bool_provide:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexBoolSetTrue#1{\semantex_data_bool_set_true:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexBoolSetFalse#1{\semantex_data_bool_set_false:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new:Npn\SemantexBoolIfTF#1#2#3{\semantex_data_bool_get:nnTF{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}{#3}} +\cs_new:Npn\SemantexBoolIfT#1#2{\semantex_data_bool_get:nnTF{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}{}} +\cs_new:Npn\SemantexBoolIfF#1#2{\semantex_data_bool_get:nnTF{\semantex_this:}{\tl_trim_spaces:n{#1}}{}{#2}} +\cs_new_protected:Npn\SemantexIntProvide#1{\semantex_data_int_provide:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new:Npn\SemantexIntGet#1{\semantex_data_int_get:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexIntClear#1{\semantex_data_int_clear:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexIntIncr#1{\semantex_data_int_incr:nn{\semantex_this:}{\tl_trim_spaces:n{#1}}} +\cs_new_protected:Npn\SemantexIntSet#1#2{\semantex_data_int_set:nnn{\semantex_this:}{\tl_trim_spaces:n{#1}}{#2}} +\cs_new:Npn\SemantexIntIfGreaterTF#1#2#3#4 +{ + \int_compare:nNnTF + { #1 } + > + { #2 } + { #3 } + { #4 } } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar:nn#1#2 +\cs_new:Npn\SemantexIntIfGreaterT#1#2#3 { - % Uses the syntax otherspar={leftpar}{rightpar}{size} - % Adds a new spar, but with these as parentheses and size - \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_auxiliary:nnnn { #1 } #2 + \int_compare:nNnTF + { #1 } + > + { #2 } + { #3 } + { } } - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_auxiliary:nnnn#1#2#3#4 +\cs_new:Npn\SemantexIntIfGreaterF#1#2#3 { - \tl_set:Nn\l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_sparsize_temp_tl - { \exp_not:n { #4 } } - \__semantex_symbol_parentheses_store:nnnnN - { \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_sparsize_temp_tl } - { \exp_not:n { \exp_not:n { #2 } } } - { \exp_not:n { \exp_not:n { #3 } } } - { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } - \l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_temp_tl - \semantex_data_tl_set:nnx { #1 } { symbol } - { - \exp_not:V\l__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_Otherspar_temp_tl - } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_sparsize:nn#1#2{ - % sets the size of the parentheses - \semantex_data_tl_set:nnn { #1 } { sparsize }{ \exp_not:n { #2 } } -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_leftspar:nn#1#2{ - \semantex_data_tl_set:nnn { #1 } { leftspar }{ \exp_not:n { \exp_not:n { #2 } } } - %IM Two \exp_not necessary for unknown reasons - %IM Doing the same at leftpar yields an error. -} - -\cs_new:Npn\__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_rightspar:nn#1#2{ - \semantex_data_tl_set:nnn { #1 } { rightspar }{ \exp_not:n { \exp_not:n { #2 } } } - %IM Two \exp_not necessary for unknown reasons - %IM Doing the same at leftpar yields an error. + \int_compare:nNnTF + { #1 } + > + { #2 } + { } + { #3 } } - -\cs_generate_variant:Nn \semantex_keys_set:nn { nx, no, nV } % Only the first one is currently being used - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% COMMANDS CONTROLLING THE ARGUMENT KEYVAL INTERFACE -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_othersep:nn#1#2 +\cs_new:Npn\SemantexIntIfEqTF#1#2#3#4 { - % Uses syntax sep={separator}{argument}; adds an argument - % with the specified separator - \semantex_data_bool_get:nnTF { #1 } { nextargwithsep } - { - \semantex_data_tl_put_right:nnn { #1 } { arg } { - \exp_not:n { - \semantex_grab_first_argument_of_two:nn #2 - \semantex_grab_second_argument_of_two:nn #2 - } - } - } - { - \semantex_data_tl_put_right:nnn { #1 } { arg } { - \exp_not:n { - \semantex_grab_second_argument_of_two:nn #2 - } - } - %IM These do not use :x, unlike the ones below - } - \semantex_data_int_incr:nn { #1 } { numberofarguments } - \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } + \int_compare:nNnTF + { #1 } + = + { #2 } + { #3 } + { #4 } } - -\cs_generate_variant:Nn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_othersep:nn { nx } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_s:nn#1#2 +\cs_new:Npn\SemantexIntIfEqT#1#2#3 { - % Adds to the argument, with the standard separator - \semantex_data_bool_get:nnTF { #1 } { nextargwithsep } - { - \semantex_data_tl_put_right:nnx { #1 } { arg } { \exp_not:n { \semantex_data_tl_get:nn { #1 } { argsep } } } - \semantex_data_tl_put_right:nnn { #1 } { arg } {\exp_not:n { #2 } } - % As an experiment, I tried changing cx to cn, and it failed - % when changing the separator on the fly. - } - { - \semantex_data_tl_put_right:nnn { #1 } { arg } { \exp_not:n { #2 } } - %IM Recently corrected - % Previously, this was cx, but I didn’t see any point of this; - % this was mostly to create symmetry with the below case where - % cx is strictly necessary. - } -% \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifoutput:nn { #1 } { true } - \semantex_data_int_incr:nn { #1 } { numberofarguments } - \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } + \int_compare:nNnTF + { #1 } + = + { #2 } + { #3 } + { } } - -\cs_generate_variant:Nn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_s:nn { nx } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_c:nn#1#2 +\cs_new:Npn\SemantexIntIfEqF#1#2#3 { - % Adds to the argument, with the standard separator - \semantex_data_bool_get:nnTF { #1 } { nextargwithsep } - { - \semantex_data_tl_put_right:nnn { #1 } { arg } { , \exp_not:n { #2 } } - % As an experiment, I tried changing cx to cn, and it failed - % when changing the separator on the fly. - } - { - \semantex_data_tl_put_right:nnn { #1 } { arg } { \exp_not:n { #2 } } - %IM Recently corrected - % Previously, this was cx, but I didn’t see any point of this; - % this was mostly to create symmetry with the below case where - % cx is strictly necessary. - } -% \__semantex_data_cs_custom_valuekey_class_SemantexBaseObject_ifoutput:nn { #1 } { true } - \semantex_data_int_incr:nn { #1 } { numberofarguments } - \semantex_data_bool_set_true:nn { #1 } { nextargwithsep } + \int_compare:nNnTF + { #1 } + = + { #2 } + { } + { #3 } } - -\cs_generate_variant:Nn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_c:nn { nx } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_dots:nn#1#2 +\cs_new:Npn\SemantexIntIfLessTF#1#2#3#4 { - % Writes dots in the argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_s:nx { #1 } { \semantex_data_tl_get_exp_not:nn { #1 } { argdots } } + \int_compare:nNnTF + { #1 } + < + { #2 } + { #3 } + { #4 } } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_slot:nn#1#2 +\cs_new:Npn\SemantexIntIfLessT#1#2#3 { - % Writes the slot in teh argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_s:nx { #1 } { \semantex_data_tl_get_exp_not:nn { #1 } { argslot } } + \int_compare:nNnTF + { #1 } + < + { #2 } + { #3 } + { } } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_cdots:nn#1#2 +\cs_new:Npn\SemantexIntIfLessF#1#2#3 { - % Writes dots in the argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_c:nx { #1 } { \semantex_data_tl_get_exp_not:nn { #1 } { argdots } } + \int_compare:nNnTF + { #1 } + < + { #2 } + { } + { #3 } } - -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_cslot:nn#1#2 +\cs_new:Npn\SemantexExpNot#1{\exp_not:n{#1}} +\cs_new:Npn\SemantexERRORKeyValueNotFound#1#2 { - % Writes the slot in teh argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_c:nx { #1 } { \semantex_data_tl_get_exp_not:nn { #1 } { argslot } } + \semantex_error_key_value_not_found:nnn { \semantex_this: } { #1 } { #2 } } -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_dotswithothersep:nn#1#2 +\cs_new:Npn\SemantexERRORArgKeyValueNotFound#1#2 { - % Writes dots in the argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_othersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get_exp_not:nn { #1 } { argdots } } } + \semantex_error_arg_key_value_not_found:nnn { \semantex_this: } { #1 } { #2 } } -\cs_new:Npn \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_slotwithothersep:nn#1#2 +\cs_new:Npn\SemantexERROR#1 { - % Writes the slot in teh argument - \__semantex_data_cs_custom_arg_valuekey_class_SemantexBaseObject_othersep:nx { #1 } { { \exp_not:n { #2 } } { \semantex_data_tl_get_exp_not:nn { #1 } { argslot } } } + \semantex_error_generic:nn { \semantex_this: } { #1 } } - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% SETTING UP THE BASE CLASS SemantexBaseObject +% ERROR MESSAGES % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { output } - -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { output } { class_SemantexBaseObject } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upper } +\msg_new:nnnn { semantex } { semantex_setup_key_not_found } { Unknown~key~#1~passed~to~\SemantexSetup~on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { uppersep } +\msg_new:nnnn { semantex } { semantex_setup_key_value_not_found } { Unknown~value~#2~passed~to~key~#1~in~\SemantexSetup~on~line~\msg_line_number: } {} -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { uppersep } { , } +\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1 on~line~\msg_line_number: } {} -%IM Also, need commands like forgetupperindex, reverting to the class standard +\msg_new:nnnn { semantex } { arg_valuekey_not_found } { Unknown~argument~key~#2~passed~to~#1on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lower } +\msg_new:nnnn { semantex } { data_tl_not_found } { Unknown~data~#2~requested~from~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowersep } +\msg_new:nnnn { semantex } { data_int_not_found } { Unknown~integer~#2~requested~from~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { lowersep } { , } +\msg_new:nnnn { semantex } { data_bool_not_found } { Unknown~boolean~#2~requested~from~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { preupper } +\msg_new:nnnn { semantex } { data_cs_not_found } { Unknown~command~sequence~#2~requested~from~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { postupper } +\msg_new:nnnn { semantex } { data_prop_not_found } { Unknown~property~list~#2~requested~from~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { prelower } +\msg_new:nnnn { semantex } { key_value_not_found } { Unknown~value~#3~passed~to~key~#2~in~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { postlower } +\msg_new:nnnn { semantex } { arg_key_value_not_found } { Unknown~value~#3~passed~to~argument~key~#2~in~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperleft } +\msg_new:nnnn { semantex } { class_already_defined } { Class~#1 already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperleftsep } +\msg_new:nnnn { semantex } { object_already_defined } { Object~#1 already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {} -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { upperleftsep } { , } +\msg_new:nnnn { semantex } { class_not_found } { Unknown~class~#3 declared~as~#2~of~#1 on~line~\msg_line_number: } {} -%IM do the same with all the others, INCLUDING if_uppergrading and symbol -%IM Also, need commands like forgetupperindex, reverting to the class standard +\msg_new:nnnn { semantex } { object_not_found } { You~set~#1 as~#2~of~unknown~object~#3 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerleft } +\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1 declared~as~class~of~#2 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerleftsep } +\msg_new:nnnn { semantex } { used_unknown_class } { Unknown~class~#1 received~by~\token_to_str:N\UseClassInCommand~on~line~\msg_line_number: } {} -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { lowerleftsep } { , } +\msg_new:nnnn { semantex } { setup_unknown_class } { You~tried~setting~up~an~unknown~#1 on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { setup_unknown_object } { You~tried~setting~up~an~unknown~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { preupperleft } +\msg_new:nnnn { semantex } { created_a_SemantexBaseObject } { Never~create~objects~of~class~\token_to_str:N\SemantexBaseObject;~create~a~new~class~yourself~instead.~You~created~the~object~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { postupperleft } +\msg_new:nnnn { semantex } { SemantexThis_in_input_stream } { The~command~\token_to_str:N\SemantexThis~was~found~outside~a~class~or~object~on~line~\msg_line_number:;~did~you~forget~to~use~setkeysx={...}? } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { prelowerleft } +\msg_new:nnnn { semantex } { generic_error } { #2~#1 on~line~\msg_line_number: } {} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { postlowerleft } - -\semantex_data_int_provide:nn { class_SemantexBaseObject } { numberofarguments } - -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { nextargwithsep } - -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { nextupperleftwithsep } -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { nextlowerleftwithsep } - -\semantex_data_int_provide:nn { class_SemantexBaseObject } { numberofupperleftindices } -\semantex_data_int_provide:nn { class_SemantexBaseObject } { numberoflowerleftindices } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { prearg } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { postarg } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { arg } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { argsep } -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { argsep } {,} - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { argslot } -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { argslot } { \SemantexSlot } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { argdots } -\semantex_data_tl_set:nnn { class_SemantexBaseObject } { argdots } {\dots} - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { symbol } - -\semantex_data_seq_provide:nn { class_SemantexBaseObject } { commands_sequence } - -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { uppergrading } -\semantex_data_bool_set_true:nn { class_SemantexBaseObject } { uppergrading } - -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { output } - -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { outputoptions } +\cs_generate_variant:Nn \msg_error:nnnn { nnnx } -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { nextupperwithsep } -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { nextlowerwithsep } +\tl_new:N\l__semantex_error_output_format_temp -\semantex_data_int_provide:nn { class_SemantexBaseObject } { numberofupperindices } -\semantex_data_int_provide:nn { class_SemantexBaseObject } { numberoflowerindices } +\cs_new_protected:Npn\semantex_error_output_format:nN#1#2 +{ + \tl_set:Nn \l__semantex_error_output_format_temp { #1 } + \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_ } { object~\cs:w } + \tl_replace_all:Nnn \l__semantex_error_output_format_temp { class_ } { class~\cs:w } + \tl_put_right:Nn \l__semantex_error_output_format_temp { \cs_end: } + \tl_trim_spaces:N \l__semantex_error_output_format_temp + \tl_set_eq:NN #2 \l__semantex_error_output_format_temp +} -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { par } -\semantex_data_bool_set_true:nn { class_SemantexBaseObject } { par } +\cs_generate_variant:Nn \semantex_error_output_format:nN { xN } -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { flexpar } +\cs_generate_variant:Nn \msg_error:nnn { nnx } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { parseoptions } +\cs_generate_variant:Nn \msg_error:nnnn { nnxn } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { texclass } +\cs_generate_variant:Nn \msg_error:nnnnn { nnxnn } -\semantex_data_bool_provide:nn { class_SemantexBaseObject } { leftargument } +\cs_new_protected:Npn \semantex_msg_error:nn#1#2 +{ + \semantex_error_output_format:xN { #1 } \l__semantex_msg_error_nnn_temp_tl + \msg_error:nnx { semantex } { #2 } + { + \l__semantex_msg_error_nnn_temp_tl + } +} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperdots } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperslot } +\cs_new_protected:Npn \semantex_msg_error:nnn#1#2#3 +{ + \semantex_error_output_format:xN { #1 } \l__semantex_msg_error_nnnn_temp_tl + \msg_error:nnxn { semantex } { #2 } + { + \l__semantex_msg_error_nnnn_temp_tl + } { #3 } +} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerdots } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerslot } +\cs_new_protected:Npn \semantex_msg_error:nnnn#1#2#3#4 +{ + \semantex_error_output_format:xN { #1 } \l__semantex_msg_error_nnnnn_temp_tl + \msg_error:nnxnn { semantex } { #2 } + { + \l__semantex_msg_error_nnnnn_temp_tl + } { #3 } { #4 } +} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperleftdots } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { upperleftslot } +\cs_new_protected:Npn\semantex_error_key_value_not_found:nnn#1#2#3 +{ + \semantex_msg_error:nnnn { #1 } { key_value_not_found } { #2 } { #3 } +} -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerleftdots } -\semantex_data_tl_provide:nn { class_SemantexBaseObject } { lowerleftslot } +\cs_new_protected:Npn\semantex_error_arg_key_value_not_found:nnn#1#2#3 +{ + \semantex_msg_error:nnnn { #1 } { arg_key_value_not_found } { #2 } { #3 } +} -%\tl_set:Nn\g_objectmath_SemantexBaseObject_upper { hej } -%\tl_set:Nn \SemantexBaseObject_output { class_SemantexBaseObject } -%\bool_new:N \SemantexBaseObject_output_if_provided -%\bool_set_true:N \SemantexBaseObject_output_if_provided +\cs_new_protected:Npn\semantex_error_generic:nn#1#2 +{ + \semantex_msg_error:nnn { #1 } { generic_error } { #2 } +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% SETTING UP THE BASE CLASS \SemantexBaseObject +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\semantex_new_plain_class:Nw \SemantexBaseObject [ - %parent=SemantexBaseObject, +\semantex_define_valuekeys:nn { \semantex_class_to_register:N \SemantexBaseObject } +{ + {definekeys[1]}{execute={ \semantex_define_valuekeys:nn { ##1 } { #1 } }}, +} + +\semantex_new_simple_class:Nw \SemantexBaseObject [ + definekeys[1]={ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % THE MOST BASIC KEYS, INCLUDING PROGRAMMING KEYS + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + {execute}{ execute={#1} }, + % Yes, this really does make sense + % -- check how \semantex_define_valuekeys:nn was defined + % Keys for setting up the keyval interface + {definekeys}{ execute={ \semantex_define_singlekeys:nn { ##1 } { #1 } } }, + {definekeys[0]}{ execute={ \semantex_define_singlekeys:nn { ##1 } { #1 } } }, + {definekeys[{0}]}{ execute={ \semantex_define_singlekeys:nn { ##1 } { #1 } } }, + {definekeys[{1}]}{ execute={ \semantex_define_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[2]}{ execute={ \semantex_define_two_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{2}]}{ execute={ \semantex_define_two_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[3]}{ execute={ \semantex_define_three_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{3}]}{ execute={ \semantex_define_three_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[4]}{ execute={ \semantex_define_four_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{4}]}{ execute={ \semantex_define_four_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[5]}{ execute={ \semantex_define_five_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{5}]}{ execute={ \semantex_define_five_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[6]}{ execute={ \semantex_define_six_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{6}]}{ execute={ \semantex_define_six_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[7]}{ execute={ \semantex_define_seven_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{7}]}{ execute={ \semantex_define_seven_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[8]}{ execute={ \semantex_define_eight_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{8}]}{ execute={ \semantex_define_eight_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[9]}{ execute={ \semantex_define_nine_valuekeys:nn { ##1 } { #1 } } }, + {definekeys[{9}]}{ execute={ \semantex_define_nine_valuekeys:nn { ##1 } { #1 } } }, + {removekey}{ execute={ \semantex_remove_singlekey:nn { ##1 } { #1 } } }, + {removekey[0]}{ execute={ \semantex_remove_singlekey:nn { ##1 } { #1 } } }, + {removekey[{0}]}{ execute={ \semantex_remove_singlekey:nn { ##1 } { #1 } } }, + {removekey[1]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{1}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[2]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{2}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[3]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{3}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[4]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{5}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[6]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{6}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[7]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{7}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[8]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{8}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[9]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + {removekey[{9}]}{ execute={ \semantex_remove_valuekey:nn { ##1 } { #1 } } }, + % Keys for setting up the argument keyval interface: + {defineargkeys}{ execute={ \semantex_define_arg_singlekeys:nn { ##1 } { #1 } } }, + {defineargkeys[0]}{ execute={ \semantex_define_arg_singlekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{0}]}{ execute={ \semantex_define_arg_singlekeys:nn { ##1 } { #1 } } }, + {defineargkeys[1]}{ execute={ \semantex_define_arg_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{1}]}{ execute={ \semantex_define_arg_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[2]}{ execute={ \semantex_define_arg_two_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{2}]}{ execute={ \semantex_define_arg_two_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[3]}{ execute={ \semantex_define_arg_three_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{3}]}{ execute={ \semantex_define_arg_three_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[4]}{ execute={ \semantex_define_arg_four_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{4}]}{ execute={ \semantex_define_arg_four_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[5]}{ execute={ \semantex_define_arg_five_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{5}]}{ execute={ \semantex_define_arg_five_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[6]}{ execute={ \semantex_define_arg_six_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{6}]}{ execute={ \semantex_define_arg_six_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[7]}{ execute={ \semantex_define_arg_seven_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{7}]}{ execute={ \semantex_define_arg_seven_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[8]}{ execute={ \semantex_define_arg_eight_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{8}]}{ execute={ \semantex_define_arg_eight_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[9]}{ execute={ \semantex_define_arg_nine_valuekeys:nn { ##1 } { #1 } } }, + {defineargkeys[{9}]}{ execute={ \semantex_define_arg_nine_valuekeys:nn { ##1 } { #1 } } }, + {removeargkey}{ execute={ \semantex_remove_arg_singlekey:nn { ##1 } { #1 } } }, + {removeargkey[0]}{ execute={ \semantex_remove_arg_singlekey:nn { ##1 } { #1 } } }, + {removeargkey[{0}]}{ execute={ \semantex_remove_arg_singlekey:nn { ##1 } { #1 } } }, + {removeargkey[1]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{1}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[2]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{2}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[3]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{3}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[4]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{5}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[6]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{6}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[7]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{7}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[8]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{8}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[9]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + {removeargkey[{9}]}{ execute={ \semantex_remove_arg_valuekey:nn { ##1 } { #1 } } }, + % Keys for programming: + {dataprovide}{ execute={ \semantex_data_tl_provide:nn { ##1 } { \tl_trim_spaces:n { #1 } } } }, + {dataclear}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { \tl_trim_spaces:n { #1 } } }, + }, + {keysset}{ execute={ \semantex_keys_set:nn { ##1 } { #1 } } }, + {setkeys}{ execute={ \semantex_keys_set:nn { ##1 } { #1 } } }, + {keyssetx}{ execute={ \semantex_keys_set_x:nn { ##1 } { #1 } } }, + {setkeysx}{ execute={ \semantex_keys_set_x:nn { ##1 } { #1 } } }, + {boolprovide}{ + execute={ + \semantex_data_bool_provide:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {boolsettrue}{ + execute={ + \semantex_data_bool_set_true:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {boolsetfalse}{ + execute={ + \semantex_data_bool_set_false:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {intprovide}{ + execute={ + \semantex_data_int_provide:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {intclear}{ + execute={ + \semantex_data_int_clear:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {intincr}{ + execute={ + \semantex_data_int_incr:nn { ##1 } { \tl_trim_spaces:n { #1 } } + }, + }, + {ERROR}{ + execute={ + \semantex_error_generic:nn { ##1 } { #1 } + }, + }, + }, + definekeys[2]={ + {dataset}{ + execute={ + \semantex_data_tl_set:nnn { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {datasetx}{ + execute={ + \semantex_data_tl_set:nnx { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {dataputright}{ + execute={ + \semantex_data_tl_put_right:nnn { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {dataputrightx}{ + execute={ + \semantex_data_tl_put_right:nnx { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {dataputleft}{ + execute={ + \semantex_data_tl_put_left:nnn { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {dataputleftx}{ + execute={ + \semantex_data_tl_put_left:nnx { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {ifblankT}{ + execute={ + \tl_if_blank:xTF { #1 } + { \semantex_keys_set:nn { ##1 } { #2 } } + { } + }, + }, + {ifblankF}{ + execute={ + \tl_if_blank:xTF { #1 } + { } + { \semantex_keys_set:nn { ##1 } { #2 } } + }, + }, + {boolifT}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } + { \tl_trim_spaces:n { #1 } } + { \semantex_keys_set:nn { ##1 } { #2 } } + { } + }, + }, + {boolifF}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } + { \tl_trim_spaces:n { #1 } } + { } + { \semantex_keys_set:nn { ##1 } { #2 } } + }, + }, + {intset}{ + execute={ + \semantex_data_int_set:nnn { ##1 } { \tl_trim_spaces:n { #1 } } { #2 } + }, + }, + {ERRORkeyvaluenotfound}{ + execute={ + \semantex_error_key_value_not_found:nnn { ##1 } { #1 } { #2 } + }, + }, + {ERRORargkeyvaluenotfound}{ + execute={ + \semantex_error_arg_key_value_not_found:nnn { ##1 } { #1 } { #2 } + }, + }, + }, + definekeys[3]={ + {strifeqT}{ + execute={ + \str_if_eq:xxTF { #1 } { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { } + }, + }, + {strifeqF}{ + execute={ + \str_if_eq:xxTF { #1 } { #2 } + { } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + {ifblankTF}{ + execute={ + \tl_if_blank:xTF { #1 } + { \semantex_keys_set:nn { ##1 } { #2 } } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + {boolifTF}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } + { \tl_trim_spaces:n { #1 } } + { \semantex_keys_set:nn { ##1 } { #2 } } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + {intifgreaterT}{ + execute={ + \int_compare:nNnTF { #1 } > { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { } + }, + }, + {intifgreaterF}{ + execute={ + \int_compare:nNnTF { #1 } > { #2 } + { } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + {intifeqT}{ + execute={ + \int_compare:nNnTF { #1 } = { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { } + }, + }, + {intifeqF}{ + execute={ + \int_compare:nNnTF { #1 } = { #2 } + { } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + {intiflessT}{ + execute={ + \int_compare:nNnTF { #1 } < { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { } + }, + }, + {intiflessF}{ + execute={ + \int_compare:nNnTF { #1 } < { #2 } + { } + { \semantex_keys_set:nn { ##1 } { #3 } } + }, + }, + }, + definekeys[4]={ + {strifeqTF}{ + execute={ + \str_if_eq:xxTF { #1 } { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { \semantex_keys_set:nn { ##1 } { #4 } } + }, + }, + {intifgreaterTF}{ + execute={ + \int_compare:nNnTF { #1 } > { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { \semantex_keys_set:nn { ##1 } { #4 } } + }, + }, + {intifeqTF}{ + execute={ + \int_compare:nNnTF { #1 } = { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { \semantex_keys_set:nn { ##1 } { #4 } } + }, + }, + {intiflessTF}{ + execute={ + \int_compare:nNnTF { #1 } < { #2 } + { \semantex_keys_set:nn { ##1 } { #3 } } + { \semantex_keys_set:nn { ##1 } { #4 } } + }, + }, + }, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % THE COLLECTION OF SLIGHTLY LESS FUNDAMENTAL KEYS + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + dataprovide=symbol, + boolprovide=uppergrading, + boolsettrue=uppergrading, + boolprovide=output, + dataprovide=outputoptions, + boolprovide=par, + boolsettrue=par, + boolprovide=flexpar, + dataprovide=parseoptions, + dataprovide=texclass, + boolprovide=leftargument, + boolprovide=allowSemantexDelimiterSize, + boolsettrue=allowSemantexDelimiterSize, + dataprovide=heightphantom, + dataprovide=slantingphantom, + execute={ \semantex_data_seq_provide:nn { \semantex_this: } { commands_sequence } }, + definekeys[1]={ + {parent}{ execute={ \semantex_data_parent_set:nn { ##1 } { #1 } } }, + {class}{ execute={ \semantex_data_class_set:nn { ##1 } { #1 } } }, + {copy}{ execute={ \semantex_data_copy_object:nn { ##1 } { #1 } } }, + {clone}{ execute={ \semantex_data_clone_object:nn { ##1 } { #1 } } }, + {texclass}{ execute={ \semantex_data_tl_set:nnn { ##1 } { texclass } { #1 } } }, + {symbol}{ + execute={ + \semantex_data_tl_set:nnn { ##1 } { symbol } { #1 } + \semantex_data_tl_set:nnn { ##1 } { heightphantom } { #1 } + \semantex_data_tl_set:nnn { ##1 } { slantingphantom } { #1 } + } + }, + {symbolputright}{ execute={ \semantex_data_tl_put_right:nnn { ##1 } { symbol } { #1 } } }, + {symbolputleft}{ execute={ \semantex_data_tl_put_left:nnn { ##1 } { symbol } { #1 } } }, + {heightphantom}{ execute={ \semantex_data_tl_set:nnn { ##1 } { heightphantom } { #1 } } }, + {slantingphantom}{ execute={ \semantex_data_tl_set:nnn { ##1 } { slantingphantom } { #1 } } }, + {parseoptions}{ execute={ \semantex_add_to_parse_options:nn { ##1 } { #1 } } }, + {command}{ execute={ \semantex_data_seq_put_right:nnn { ##1 } { commands_sequence } { #1 } } }, + {output}{ execute={ \semantex_set_output:nn { ##1 } { #1 } } }, + {outputoptions}{ execute={ \semantex_add_to_output_options:nn { ##1 } { #1 } } }, + {dooutput}{ + strifeqTF={#1}{true} + { + boolsettrue={output}, + } + { + strifeqTF={#1}{false} + { + boolsetfalse={output}, + } + { + ERRORkeyvaluenotfound={dooutput}{#1}, + } + }, + }, + {gradingposition}{ + strifeqTF={#1}{upper} + { + boolsettrue={uppergrading}, + } + { + strifeqTF={#1}{lower} + { + boolsetfalse={uppergrading}, + } + { + ERRORkeyvaluenotfound={gradingposition}{#1}, + }, + }, + }, + {gradingpos}{ + strifeqTF={#1}{upper} + { + boolsettrue={uppergrading}, + } + { + strifeqTF={#1}{lower} + { + boolsetfalse={uppergrading}, + } + { + ERRORkeyvaluenotfound={gradingpos}{#1}, + }, + }, + }, + {allowSemantexDelimiterSize}{ + strifeqTF={#1}{true} + { + boolsettrue={allowSemantexDelimiterSize}, + } + { + strifeqTF={#1}{false} + { + boolsetfalse={allowSemantexDelimiterSize}, + } + { + ERRORkeyvaluenotfound={allowSemantexDelimiterSize}{#1}, + } + }, + }, + {default}{si={#1}}, + {degreedefault}{sd={#1}}, + {arg}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, + {*withothersep}{ + d*withothersep={#1}, + }, + {**withothersep}{ + d**withothersep={#1}, + }, + }, output=\SemantexBaseObject, - ifoutput=false, - symbol=, - gradingposition=upper, - %upper=, - %lower=, - leftpar=(, - rightpar=), - par=normal, + definekeys={ + {return}{ execute={ \semantex_return:n { ##1 } } }, + {innerreturn}{ execute={ \semantex_inner_return:n { ##1 } } }, + {rightreturn}{ execute={ \semantex_right_return:n { ##1 } } }, + {leftreturn}{ execute={ \semantex_left_return:n { ##1 } } }, + {parse}{ execute={ \semantex_parse:n { ##1 } } }, + {clearcommand}{ execute={ \semantex_data_seq_clear:nn { ##1 } { commands_sequence } } }, + {...}{sidots}, + {-}{sislot}, + {*}{sd*}, + {**}{sd**}, + }, + % The "spar" routine: + definekeys={ + {spar}{spar=}, + }, + definekeys[1]={ + {spar}{ execute={ \semantex_spar:nn { ##1 } { #1 } } }, + {sparsize}{ execute={ \semantex_data_tl_set:nnn { ##1 } { sparsize } { #1 } } }, + {leftspar}{ execute={ \semantex_data_tl_set:nnn { ##1 } { leftspar } { #1 } } }, + {rightspar}{ execute={ \semantex_data_tl_set:nnn { ##1 } { rightspar } { #1 } } }, + }, + definekeys[2]={ + {otherspar}{ execute={ \semantex_other_spar:nnn { ##1 } { #1 } { #2 } } }, + }, + definekeys[3]={ + {Otherspar}{ execute={ \semantex_other_spar_with_size:nnnn { ##1 } { #1 } { #2 } { #3 } } }, + }, leftspar=(, rightspar=), sparsize=normal, - %arg=, - setupperdots=\dots, - setlowerdots=\dots, - setupperslot=\g_semantex_bullet, - setlowerslot=\g_semantex_bullet, - setupperleftdots=\dots, - setlowerleftdots=\dots, - setupperleftslot=\g_semantex_bullet, - setlowerleftslot=\g_semantex_bullet, - singlekeys={ - {prime}{upper={\prime}}, - {'}{prime}, - {''}{prime,prime}, - {'''}{prime,prime,prime}, - {*}{sdegree=\g_semantex_bullet}, - {**}{sdegree=\g_semantex_double_bullet}, - {degree*}{degree=\g_semantex_bullet}, - {degree**}{degree=\g_semantex_double_bullet}, - {sdegree*}{sdegree=\g_semantex_bullet}, - {sdegree**}{sdegree=\g_semantex_double_bullet}, - {cdegree*}{cdegree=\g_semantex_bullet}, - {cdegree**}{cdegree=\g_semantex_double_bullet}, - {deg*}{deg=\g_semantex_bullet}, - {deg**}{deg=\g_semantex_double_bullet}, - {sdeg*}{sdeg=\g_semantex_bullet}, - {sdeg**}{sdeg=\g_semantex_double_bullet}, - {cdeg*}{cdeg=\g_semantex_bullet}, - {cdeg**}{cdeg=\g_semantex_double_bullet}, - {d*}{d=\g_semantex_bullet}, - {d**}{d=\g_semantex_double_bullet}, - {sd*}{sd=\g_semantex_bullet}, - {sd**}{sd=\g_semantex_double_bullet}, - {cd*}{cd=\g_semantex_bullet}, - {cd**}{cd=\g_semantex_double_bullet}, - {index*}{index=\g_semantex_bullet}, - {index**}{index=\g_semantex_double_bullet}, - {sindex*}{sindex=\g_semantex_bullet}, - {sindex**}{sindex=\g_semantex_double_bullet}, - {cindex*}{cindex=\g_semantex_bullet}, - {cindex**}{cindex=\g_semantex_double_bullet}, - {i*}{i=\g_semantex_bullet}, - {i**}{i=\g_semantex_double_bullet}, - {si*}{si=\g_semantex_bullet}, - {si**}{si=\g_semantex_double_bullet}, - {ci*}{ci=\g_semantex_bullet}, - {ci**}{ci=\g_semantex_double_bullet}, - {upper*}{upper=\g_semantex_bullet}, - {upper**}{upper=\g_semantex_double_bullet}, - {supper*}{supper=\g_semantex_bullet}, - {supper**}{supper=\g_semantex_double_bullet}, - {cupper*}{cupper=\g_semantex_bullet}, - {cupper**}{cupper=\g_semantex_double_bullet}, - {lower*}{lower=\g_semantex_bullet}, - {lower**}{lower=\g_semantex_double_bullet}, - {slower*}{slower=\g_semantex_bullet}, - {slower**}{slower=\g_semantex_double_bullet}, - {clower*}{clower=\g_semantex_bullet}, - {clower**}{clower=\g_semantex_double_bullet}, - {upperleft*}{upperleft=\g_semantex_bullet}, - {upperleft**}{upperleft=\g_semantex_double_bullet}, - {supperleft*}{supperleft=\g_semantex_bullet}, - {supperleft**}{supperleft=\g_semantex_double_bullet}, - {cupperleft*}{cupperleft=\g_semantex_bullet}, - {cupperleft**}{cupperleft=\g_semantex_double_bullet}, - {lowerleft*}{lowerleft=\g_semantex_bullet}, - {lowerleft**}{lowerleft=\g_semantex_double_bullet}, - {slowerleft*}{slowerleft=\g_semantex_bullet}, - {slowerleft**}{slowerleft=\g_semantex_double_bullet}, - {clowerleft*}{clowerleft=\g_semantex_bullet}, - {clowerleft**}{clowerleft=\g_semantex_double_bullet}, - {smash}{command=\smash}, - {tilde}{command=\tilde}, - {widetilde}{command=\widetilde}, - {overline}{command=\overline}, - {bar}{command=\bar}, - {bold}{command=\mathbf}, - {roman}{command=\mathrm}, - {mathord}{texclass=\mathord}, - {mathbin}{texclass=\mathbin}, - {mathop}{texclass=\mathop}, - {mathrel}{texclass=\mathrel}, - {leftreturn}{leftreturn=}, - {innerreturn}{innerreturn=}, - {rightreturn}{rightreturn=}, - {return}{return=}, - {spar}{spar=}, - {parse}{parse=}, - {par}{ifpar=true}, - {neverpar}{ifpar=never}, - {nopar}{ifpar=false}, - {clearupper}{clearupper=}, - {clearlower}{clearlower=}, - {clearupperleft}{clearupperleft=}, - {clearlowerleft}{clearlowerleft=}, - {clearcommand}{clearcommand=}, - {cleard}{cleard=}, - {cleardeg}{cleardeg=}, - {cleardegree}{cleardegree=}, - {cleari}{cleari=}, - {clearindex}{clearindex=}, - {upperdots}{upperdots=}, - {upper...}{upperdots=}, - {upperslot}{upperslot=}, - {upper-}{upperslot=}, - {lowerdots}{lowerdots=}, - {lower...}{lowerdots=}, - {lowerslot}{lowerslot=}, - {lower-}{lowerslot=}, - {upperleftdots}{upperleftdots=}, - {upperleft...}{upperleftdots=}, - {upperleftslot}{upperleftslot=}, - {upperleft-}{upperleftslot=}, - {lowerleftdots}{lowerleftdots=}, - {lowerleft...}{lowerleftdots=}, - {lowerleftslot}{lowerleftslot=}, - {lowerleft-}{lowerleftslot=}, - {idots}{idots=}, - {indexdots}{indexdots=}, - {islot}{islot=}, - {indexslot}{indexslot=}, - {i...}{idots=}, - {index...}{indexdots=}, - {i-}{islot=}, - {index-}{indexslot=}, - {ddots}{ddots=}, - {degdots}{degdots=}, - {degreedots}{degreedots=}, - {dslot}{dslot=}, - {degslot}{degslot=}, - {degreeslot}{degreeslot=}, - {d...}{ddots=}, - {deg...}{degdots=}, - {degree...}{degreedots=}, - {d-}{dslot=}, - {deg-}{degslot=}, - {degree-}{degreeslot=}, - {cupperdots}{cupperdots=}, - {cupper...}{cupperdots=}, - {cupperslot}{cupperslot=}, - {cupper-}{cupperslot=}, - {clowerdots}{clowerdots=}, - {clower...}{clowerdots=}, - {clowerslot}{clowerslot=}, - {clower-}{clowerslot=}, - {cupperleftdots}{cupperleftdots=}, - {cupperleft...}{cupperleftdots=}, - {cupperleftslot}{cupperleftslot=}, - {cupperleft-}{cupperleftslot=}, - {clowerleftdots}{clowerleftdots=}, - {clowerleft...}{clowerleftdots=}, - {clowerleftslot}{clowerleftslot=}, - {clowerleft-}{clowerleftslot=}, - {cidots}{cidots=}, - {cindexdots}{cindexdots=}, - {cislot}{cislot=}, - {cindexslot}{cindexslot=}, - {ci...}{cidots=}, - {cindex...}{cindexdots=}, - {ci-}{cislot=}, - {cindex-}{cindexslot=}, - {cddots}{cddots=}, - {cdegdots}{cdegdots=}, - {cdegreedots}{cdegreedots=}, - {cdslot}{cdslot=}, - {cdegslot}{cdegslot=}, - {cdegreeslot}{cdegreeslot=}, - {cd...}{cddots=}, - {cdeg...}{cdegdots=}, - {cdegree...}{cdegreedots=}, - {cd-}{cdslot=}, - {cdeg-}{cdegslot=}, - {cdegree-}{cdegreeslot=}, - {supperdots}{supperdots=}, - {supper...}{supperdots=}, - {supperslot}{supperslot=}, - {supper-}{supperslot=}, - {slowerdots}{slowerdots=}, - {slower...}{slowerdots=}, - {slowerslot}{slowerslot=}, - {slower-}{slowerslot=}, - {supperleftdots}{supperleftdots=}, - {supperleft...}{supperleftdots=}, - {supperleftslot}{supperleftslot=}, - {supperleft-}{supperleftslot=}, - {slowerleftdots}{slowerleftdots=}, - {slowerleft...}{slowerleftdots=}, - {slowerleftslot}{slowerleftslot=}, - {slowerleft-}{slowerleftslot=}, - {sidots}{sidots=}, - {sindexdots}{sindexdots=}, - {sislot}{sislot=}, - {sindexslot}{sindexslot=}, - {si...}{sidots=}, - {sindex...}{sindexdots=}, - {si-}{sislot=}, - {sindex-}{sindexslot=}, - {sddots}{sddots=}, - {sdegdots}{sdegdots=}, - {sdegreedots}{sdegreedots=}, - {sdslot}{sdslot=}, - {sdegslot}{sdegslot=}, - {sdegreeslot}{sdegreeslot=}, - {sd...}{sddots=}, - {sdeg...}{sdegdots=}, - {sdegree...}{sdegreedots=}, - {sd-}{sdslot=}, - {sdeg-}{sdegslot=}, - {sdegree-}{sdegreeslot=}, - {...}{sidots=}, - {-}{sislot=}, -% {argwithkeyval}{ -% valuekeys={ -% {arg}{argwithkeyval={####1}}, -% }, -% }, -% {argwithsinglekeys}{ -% valuekeys={ -% {arg}{argwithsinglekeys={####1}}, -% }, -% }, -% {argwithoutkeyval}{ -% valuekeys={ -% {arg}{argwithoutkeyval={####1}}, -% }, -% }, -% {argwithonesinglekey}{ -% valuekeys={ -% {arg}{argwithonesinglekey={####1}}, -% }, -% }, + % The argument: + dataprovide=arg, + boolprovide=nextargwithsep, + intprovide=numberofarguments, + dataprovide=prearg, + dataprovide=postarg, + definekeys={ + {argdots}{setargkeys={...}}, + {arg...}{setargkeys={dots}}, + {cargdots}{setargkeys={cdots}}, + {carg...}{setargkeys={c...}}, + {argslot}{setargkeys={slot}}, + {arg-}{setargkeys={-}}, + {cargslot}{setargkeys={cslot}}, + {carg-}{setargkeys={c-}}, + {cleararg}{ execute={ + \semantex_data_tl_clear:nn { ##1 } { arg } + \semantex_data_int_clear:nn { ##1 } { numberofarguments } + \semantex_data_bool_set_false:nn { ##1 } { nextargwithsep } + } + }, + {clearprearg}{ execute={ \semantex_data_tl_clear:nn { ##1 } { prearg } } }, + {clearpostarg}{ execute={ \semantex_data_tl_clear:nn { ##1 } { postarg } } }, }, - valuekeys={ - {default}{sindex={#1}}, - {arg}{argwithsinglekeys={#1}}, - {degreedefault}{sdegree={#1}}, - {*withothersep}{degreewithothersep={#1}{\g_semantex_bullet}}, - {**withothersep}{degreewithothersep={#1}{\g_semantex_double_bullet}}, - {degree*withothersep}{degreewithothersep={#1}{\g_semantex_bullet}}, - {degree**withothersep}{degreewithothersep={#1}{\g_semantex_double_bullet}}, - {deg*withothersep}{degwithothersep={#1}{\g_semantex_bullet}}, - {deg**withothersep}{degwithothersep={#1}{\g_semantex_double_bullet}}, - {d*withothersep}{dwithothersep={#1}{\g_semantex_bullet}}, - {d**withothersep}{dwithothersep={#1}{\g_semantex_double_bullet}}, - {index*withothersep}{indexwithothersep={#1}{\g_semantex_bullet}}, - {index**withothersep}{indexwithothersep={#1}{\g_semantex_double_bullet}}, - {i*withothersep}{iwithothersep={#1}{\g_semantex_bullet}}, - {i**withothersep}{iwithothersep={#1}{\g_semantex_double_bullet}}, - {upper*withothersep}{upperwithothersep={#1}{\g_semantex_bullet}}, - {upper**withothersep}{upperwithothersep={#1}{\g_semantex_double_bullet}}, - {lower*withothersep}{lowerwithothersep={#1}{\g_semantex_bullet}}, - {lower**withothersep}{lowerwithothersep={#1}{\g_semantex_double_bullet}}, - {upperleft*withothersep}{upperleftwithothersep={#1}{\g_semantex_bullet}}, - {upperleft**withothersep}{upperleftwithothersep={#1}{\g_semantex_double_bullet}}, - {lowerleft*withothersep}{lowerleftwithothersep={#1}{\g_semantex_bullet}}, - {lowerleft**withothersep}{lowerleftwithothersep={#1}{\g_semantex_double_bullet}}, - {sarg}{argwithkeyval={s={#1}}}, - {carg}{argwithkeyval={c={#1}}}, - {argwithothersep}{argwithkeyval={othersep={#1}}}, - {argdots}{argwithkeyval={...}}, - {arg...}{argwithkeyval={...}}, - {cargdots}{argwithkeyval={cdots=}}, - {carg...}{argwithkeyval={cdots=}}, - {argdotswithothersep}{argwithkeyval={dotswithothersep={#1}}}, - {arg...withothersep}{argwithkeyval={dotswithothersep={#1}}}, - {argdots}{argwithkeyval={-}}, - {arg-}{argwithkeyval={-}}, - {cargslot}{argwithkeyval={cslot=}}, - {carg-}{argwithkeyval={cslot=}}, - {argslotwithothersep}{argwithkeyval={slotwithothersep={#1}}}, - {arg-withothersep}{argwithkeyval={slotwithothersep={#1}}}, + definekeys[1]={ + {setargkeys}{ execute={ \semantex_arg_keys_set:nn { ##1 } { #1 } } }, + {argkeysset}{ execute={ \semantex_arg_keys_set:nn { ##1 } { #1 } } }, + {setargkeysx}{ execute={ \semantex_arg_keys_set_x:nn { ##1 } { #1 } } }, + {argkeyssetx}{ execute={ \semantex_arg_keys_set_x:nn { ##1 } { #1 } } }, + {setargsinglekeys}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, + {argsinglekeysset}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, + {setargsinglekeysx}{ execute={ \semantex_arg_singlekeys_set_x:nn { ##1 } { #1 } } }, + {argsinglekeyssetx}{ execute={ \semantex_arg_singlekeys_set_x:nn { ##1 } { #1 } } }, + {setoneargsinglekey}{ execute={ \semantex_arg_singlekey:nn { ##1 } { #1 } } }, + {oneargsinglekeyset}{ execute={ \semantex_arg_singlekey:nn { ##1 } { #1 } } }, + {setoneargsinglekeyx}{ execute={ \semantex_arg_singlekey_x:nn { ##1 } { #1 } } }, + {oneargsinglekeysetx}{ execute={ \semantex_arg_singlekey_x:nn { ##1 } { #1 } } }, + {setargwithoutkeyval}{ execute={ \semantex_arg_without_keyval:nn { ##1 } { #1 } } }, + {argwithoutkeyvalset}{ execute={ \semantex_arg_without_keyval:nn { ##1 } { #1 } } }, + {setargwithoutkeyvalx}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, + {argwithoutkeyvalsetx}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, + {prearg}{ execute={ \semantex_data_tl_put_left:nnn { ##1 } { prearg } { #1 } } }, + {postarg}{ execute={ \semantex_data_tl_put_left:nnn { ##1 } { postarg } { #1 } } }, + {setargsep}{ execute={ \semantex_data_tl_set:nnn { ##1 } { argsep } { #1 } } }, + {setargslot}{ execute={ \semantex_data_tl_set:nnn { ##1 } { argslot } { #1 } } }, + {setargdots}{ execute={ \semantex_data_tl_set:nnn { ##1 } { argdots } { #1 } } }, {argkeyval}{ - ifeqTF={#1}{true} + strifeqTF={#1}{true} { - valuekeys={ - {arg}{argwithkeyval={####1}}, + definekeys[1]={ + {arg}{execute={ \semantex_arg_keys_set:nn { ########1 } { ####1 } }}, }, } { - ifeqTF={#1}{false} + strifeqTF={#1}{false} { - valuekeys={ - {arg}{argwithoutkeyval={####1}}, + definekeys[1]={ + {arg}{ execute={ \semantex_arg_without_keyval:nn { ########1 } { ####1 } } }, }, } { - ifeqTF={#1}{singlekeys} + strifeqTF={#1}{singlekeys} { - valuekeys={ - {arg}{argwithsinglekeys={####1}}, + definekeys[1]={ + {arg}{ execute={ \semantex_arg_singlekeys_set:nn { ########1 } { ####1 } } }, }, } { - ifeqTF={#1}{onesinglekey} + strifeqTF={#1}{onesinglekey} { - valuekeys={ - {arg}{argwithonesinglekey={####1}}, + definekeys[1]={ + {arg}{ execute={ \semantex_arg_singlekey:nn { ########1 } { ####1 } } }, }, } { @@ -6399,29 +5684,1436 @@ }, }, }, + {argposition}{ + strifeqTF={#1}{left} + { + boolsettrue={leftargument}, + } + { + strifeqTF={#1}{right} + { + boolsetfalse={leftargument}, + } + { + ERRORkeyvaluenotfound={argposition}{#1}, + }, + }, + }, + {nextargwithsep}{ + strifeqTF={#1}{true} + { + boolsettrue={nextargwithsep}, + } + { + strifeqTF={#1}{false} + { + boolsetfalse={nextargwithsep}, + } + { + ERRORkeyvaluenotfound={nextargwithsep}{#1}, + }, + }, + }, + {sarg}{setargkeys={s={#1}}}, + {carg}{setargkeys={c={#1}}}, + {argdotswithothersep}{setargkeys={dotswithothersep={#1}}}, + {arg...withothersep}{setargkeys={dotswithothersep={#1}}}, + {argslotwithothersep}{setargkeys={slotwithothersep={#1}}}, + {arg-withothersep}{setargkeys={slotwithothersep={#1}}}, + }, + definekeys[2]={ + {argwithothersep}{setargkeys={othersep={#1}{#2}}}, + }, + setargsep={,}, + setargslot={ {-} }, + setargdots={ \dots }, + % Parentheses: + definekeys={ + {par}{usepar=true}, + {neverpar}{usepar=never}, + {nopar}{usepar=false}, + }, + definekeys[1]={ + {par}{ + execute={ + \semantex_data_tl_set:nnn { ##1 } { parsize } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { par } + }, + }, + {parsize}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { parsize } { #1 } }, + }, + {leftpar}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { leftpar } { #1 } }, + }, + {rightpar}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { rightpar } { #1 } }, + }, + {usepar}{ + strifeqTF={#1}{true} + { + boolsettrue={par}, + boolsetfalse={flexpar}, + } + { + strifeqTF={#1}{false} + { + boolsetfalse={par}, + boolsettrue={flexpar}, + } + { + strifeqTF={#1}{never} + { + boolsetfalse={par}, + boolsetfalse={flexpar}, + } + { + ERRORkeyvaluenotfound={usepar}{#1}, + }, + }, + }, + }, + }, + leftpar=(, + rightpar=), + par=normal, + % Accents, primes, bullets, etc.: + definekeys={ + {smash}{command=\smash}, + {prime}{upper={\prime}}, + {'}{prime}, + {''}{prime,prime}, + {'''}{prime,prime,prime}, + }, + % Upper indices: + dataprovide=upper, + boolprovide=nextupperwithsep, + intprovide=numberofupperindices, + dataprovide=preupper, + dataprovide=postupper, + definekeys={ + {upperslot}{ setkeysx={ upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperslot } } }, + {upper-}{upperslot}, + {supperslot}{ setkeysx={ supper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperslot } } }, + {supper-}{supperslot}, + {cupperslot}{ setkeysx={ cupper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperslot } } }, + {cupper-}{cupperslot}, + {upperdots}{ setkeysx={ upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperdots } } }, + {upper...}{upperdots}, + {supperdots}{ setkeysx={ supper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperdots } } }, + {supper...}{supperdots}, + {cupperdots}{ setkeysx={ cupper=\semantex_data_tl_get_exp_not:nn { ##1 } { upperdots } } }, + {cupper...}{cupperdots}, + {clearupper}{ + execute={ + \semantex_data_tl_clear:nn { ##1 } { upper } + \semantex_data_bool_set_false:nn { ##1 } { nextupperwithsep } + \semantex_data_int_clear:nn { ##1 } { numberofupperindices } + }, + }, + {clearpreupper}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { preupper } }, + }, + {clearpostupper}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { postupper } }, + }, + {upper*}{upper=\SemantexBullet}, + {upper**}{upper=\SemantexDoubleBullet}, + {supper*}{supper=\SemantexBullet}, + {supper**}{supper=\SemantexDoubleBullet}, + {cupper*}{cupper=\SemantexBullet}, + {cupper**}{cupper=\SemantexDoubleBullet}, + }, + definekeys[1]={ + {upper}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_tl_put_right:nnn { ##1 } { upper } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextupperwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperindices } + } + }, + }, + {supper}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_bool_get:nnTF { ##1 } { nextupperwithsep } + { + \semantex_data_tl_put_right:nnx { ##1 } { upper } + { \semantex_data_tl_get_exp_not:nn { ##1 } { uppersep } } + \semantex_data_tl_put_right:nnn { ##1 } { upper } { #1 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { upper } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextupperwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperindices } + } + }, + }, + {cupper}{ + execute={ + \tl_if_blank:nF{#1} + { + \semantex_data_bool_get:nnTF { ##1 } { nextupperwithsep } + { + \semantex_data_tl_put_right:nnn { ##1 } { upper } { , #1 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { upper } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextupperwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperindices } + } + } + }, + {preupper}{ + execute={ + \semantex_data_tl_put_left:nnn { ##1 } { preupper } { #1 } + }, + }, + {postupper}{ + execute={ + \semantex_data_tl_put_right:nnn { ##1 } { postupper } { #1 } + }, + }, + {upperputleft}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_tl_put_left:nnn { ##1 } { upper } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextupperwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperindices } + } + }, + }, + {setupperslot}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { upperslot } { #1 } }, + }, + {upperslotwithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperslot } } + } + }, + }, + {upper-withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperslot } } + } + }, + }, + {setupperdots}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { upperdots } { #1 } }, + }, + {upperdotswithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperdots } } + } + }, + }, + {upper...withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperdots } } + } + }, + }, + {upper*withothersep}{upperwithothersep={#1}{\SemantexBullet}}, + {upper**withothersep}{upperwithothersep={#1}{\SemantexDoubleBullet}}, + {setuppersep}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { uppersep } { #1 } }, + }, + {nextupperwithsep}{ + strifeqTF={#1}{false} + { + boolsetfalse={nextupperwithsep}, + } + { + strifeqTF={#1}{true} + { + boolsettrue={nextupperwithsep}, + } + { + ERRORkeyvaluenotfound={nextupperwithsep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {upperwithothersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextupperwithsep } + { \semantex_data_tl_put_right:nnn { ##1 } { upper } { #1 #2 } } + { \semantex_data_tl_put_right:nnn { ##1 } { upper } { #2 } } + \semantex_data_bool_set_true:nn { ##1 } { nextupperwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperindices } + }, + }, }, - argvaluekeys={ + setuppersep={ , }, + setupperdots={ \dots }, + setupperslot={ {-} }, + % Lower indices: + dataprovide=lower, + boolprovide=nextlowerwithsep, + intprovide=numberoflowerindices, + dataprovide=prelower, + dataprovide=postlower, + definekeys={ + {lowerslot}{ setkeysx={ lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerslot } } }, + {lower-}{lowerslot}, + {slowerslot}{ setkeysx={ slower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerslot } } }, + {slower-}{slowerslot}, + {clowerslot}{ setkeysx={ clower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerslot } } }, + {clower-}{clowerslot}, + {lowerdots}{ setkeysx={ lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerdots } } }, + {lower...}{lowerdots}, + {slowerdots}{ setkeysx={ slower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerdots } } }, + {slower...}{slowerdots}, + {clowerdots}{ setkeysx={ clower=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerdots } } }, + {clower...}{clowerdots}, + {clearlower}{ + execute={ + \semantex_data_tl_clear:nn { ##1 } { lower } + \semantex_data_bool_set_false:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_clear:nn { ##1 } { numberoflowerindices } + }, + }, + {clearprelower}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { prelower } }, + }, + {clearpostlower}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { postlower } }, + }, + {lower*}{lower=\SemantexBullet}, + {lower**}{lower=\SemantexDoubleBullet}, + {slower*}{slower=\SemantexBullet}, + {slower**}{slower=\SemantexDoubleBullet}, + {clower*}{clower=\SemantexBullet}, + {clower**}{clower=\SemantexDoubleBullet}, + }, + definekeys[1]={ + {lower}{ + execute={ + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_right:nnn { ##1 } { lower } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerindices } + } + }, + }, + {slower}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_bool_get:nnTF { ##1 } { nextlowerwithsep } + { + \semantex_data_tl_put_right:nnx { ##1 } { lower } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowersep } } + \semantex_data_tl_put_right:nnn { ##1 } { lower } { #1 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { lower } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerindices } + } + }, + }, + {clower}{ + execute={ + \tl_if_blank:nF{#1} + { + \semantex_data_bool_get:nnTF { ##1 } { nextlowerwithsep } + { + \semantex_data_tl_put_right:nnn { ##1 } { lower } { , #1 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { lower } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerindices } + } + } + }, + {prelower}{ + execute={ + \semantex_data_tl_put_left:nnn { ##1 } { prelower } { #1 } + }, + }, + {postlower}{ + execute={ + \semantex_data_tl_put_right:nnn { ##1 } { postlower } { #1 } + }, + }, + {lowerputleft}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_tl_put_left:nnn { ##1 } { lower } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerindices } + } + }, + }, + {setlowerslot}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowerslot } { #1 } }, + }, + {lowerslotwithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerslot } } + } + }, + }, + {lower-withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerslot } } + } + }, + }, + {setlowerdots}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowerdots } { #1 } }, + }, + {lowerdotswithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerdots } } + } + }, + }, + {lower...withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerdots } } + } + }, + }, + {lower*withothersep}{lowerwithothersep={#1}{\SemantexBullet}}, + {lower**withothersep}{lowerwithothersep={#1}{\SemantexDoubleBullet}}, + {setlowersep}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowersep } { #1 } }, + }, + {nextlowerwithsep}{ + strifeqTF={#1}{false} + { + boolsetfalse={nextlowerwithsep}, + } + { + strifeqTF={#1}{true} + { + boolsettrue={nextlowerwithsep}, + } + { + ERRORkeyvaluenotfound={nextlowerwithsep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {lowerwithothersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextlowerwithsep } + { \semantex_data_tl_put_right:nnn { ##1 } { lower } { #1 #2 } } + { \semantex_data_tl_put_right:nnn { ##1 } { lower } { #2 } } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerindices } + }, + }, + }, + setlowersep={ , }, + setlowerdots={ \dots }, + setlowerslot={ {-} }, + % Upper left indices: + dataprovide=upperleft, + intprovide=nextupperleftwithsep, + intprovide=numberofupperleftindices, + dataprovide=preupperleft, + dataprovide=postupperleft, + definekeys={ + {upperleftslot}{ setkeysx={ upperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftslot } } }, + {upperleft-}{upperleftslot}, + {supperleftslot}{ setkeysx={ supperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftslot } } }, + {supperleft-}{supperleftslot}, + {cupperleftslot}{ setkeysx={ cupperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftslot } } }, + {cupperleft-}{cupperleftslot}, + {upperleftdots}{ setkeysx={ upperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftdots } } }, + {upperleft...}{upperleftdots}, + {supperleftdots}{ setkeysx={ supperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftdots } } }, + {supperleft...}{supperleftdots}, + {cupperleftdots}{ setkeysx={ cupperleft=\semantex_data_tl_get_exp_not:nn { ##1 } { upperleftdots } } }, + {cupperleft...}{cupperleftdots}, + {clearupperleft}{ + execute={ + \semantex_data_tl_clear:nn { ##1 } { upperleft } + \semantex_data_bool_set_false:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_clear:nn { ##1 } { numberofupperleftindices } + }, + }, + {clearpreupperleft}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { preupperleft } }, + }, + {clearpostupperleft}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { postupperleft } }, + }, + {upperleft*}{upperleft=\SemantexBullet}, + {upperleft**}{upperleft=\SemantexDoubleBullet}, + {supperleft*}{supperleft=\SemantexBullet}, + {supperleft**}{supperleft=\SemantexDoubleBullet}, + {cupperleft*}{cupperleft=\SemantexBullet}, + {cupperleft**}{cupperleft=\SemantexDoubleBullet}, + }, + definekeys[1]={ + {upperleft}{ + execute={ + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperleftindices } + } + }, + }, + {supperleft}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_bool_get:nnTF { ##1 } { nextupperleftwithsep } + { + \semantex_data_tl_put_left:nnx { ##1 } { upperleft } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperleftsep } } + \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #1 } + } + { + \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperleftindices } + } + }, + }, + {cupperleft}{ + execute={ + \tl_if_blank:nF{#1} + { + \semantex_data_bool_get:nnTF { ##1 } { nextupperleftwithsep } + { + \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { , #1 } + } + { + \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperleftindices } + } + } + }, + {preupperleft}{ + execute={ + \semantex_data_tl_put_left:nnn { ##1 } { preupperleft } { #1 } + }, + }, + {postupperleft}{ + execute={ + \semantex_data_tl_put_right:nnn { ##1 } { postupperleft } { #1 } + }, + }, + {upperleftputright}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_tl_put_right:nnn { ##1 } { upperleft } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperleftindices } + } + }, + }, + {setupperleftslot}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { upperleftslot } { #1 } }, + }, + {upperleftslotwithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperleftslot } } + } + }, + }, + {upperleft-withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upperleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperleftslot } } + } + }, + }, + {setupperleftdots}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { upperleftdots } { #1 } }, + }, + {upperleftdotswithothersep}{ + execute={ + \semantex_valuekey:nnx { upperleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperleftdots } } + } + }, + }, + {upperleft...withothersep}{ + execute={ + \semantex_valuekey:nnx { upperleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upperleftdots } } + } + }, + }, + {upperleft*withothersep}{upperleftwithothersep={#1}{\SemantexBullet}}, + {upperleft**withothersep}{upperleftwithothersep={#1}{\SemantexDoubleBullet}}, + {setupperleftsep}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { upperleftsep } { #1 } }, + }, + {nextupperleftwithsep}{ + strifeqTF={#1}{false} + { + boolsetfalse={nextupperleftwithsep}, + } + { + strifeqTF={#1}{true} + { + boolsettrue={nextupperleftwithsep}, + } + { + ERRORkeyvaluenotfound={nextupperleftwithsep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {upperleftwithothersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextupperleftwithsep } + { \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #2 #1 } } + { \semantex_data_tl_put_left:nnn { ##1 } { upperleft } { #2 } } + \semantex_data_bool_set_true:nn { ##1 } { nextupperleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberofupperleftindices } + }, + }, + }, + setupperleftsep={ , }, + setupperleftdots={ \dots }, + setupperleftslot={ {-} }, + % Lower left indices: + dataprovide=lowerleft, + boolprovide=nextlowerleftwithsep, + intprovide=numberoflowerleftindices, + dataprovide=prelowerleft, + dataprovide=postlowerleft, + definekeys={ + {lowerleftslot}{ setkeysx={ lowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftslot } } }, + {lowerleft-}{lowerleftslot}, + {slowerleftslot}{ setkeysx={ slowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftslot } } }, + {slowerleft-}{slowerleftslot}, + {clowerleftslot}{ setkeysx={ clowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftslot } } }, + {clowerleft-}{clowerleftslot}, + {lowerleftdots}{ setkeysx={ lowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftdots } } }, + {lowerleft...}{lowerleftdots}, + {slowerleftdots}{ setkeysx={ slowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftdots } } }, + {slowerleft...}{slowerleftdots}, + {clowerleftdots}{ setkeysx={ clowerleft=\semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftdots } } }, + {clowerleft...}{clowerleftdots}, + {clearlowerleft}{ + execute={ + \semantex_data_tl_clear:nn { ##1 } { lowerleft } + \semantex_data_bool_set_false:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_clear:nn { ##1 } { numberoflowerleftindices } + }, + }, + {clearprelowerleft}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { prelowerleft } }, + }, + {clearpostlowerleft}{ + execute={ \semantex_data_tl_clear:nn { ##1 } { postlowerleft } }, + }, + {lowerleft*}{lowerleft=\SemantexBullet}, + {lowerleft**}{lowerleft=\SemantexDoubleBullet}, + {slowerleft*}{slowerleft=\SemantexBullet}, + {slowerleft**}{slowerleft=\SemantexDoubleBullet}, + {clowerleft*}{clowerleft=\SemantexBullet}, + {clowerleft**}{clowerleft=\SemantexDoubleBullet}, + }, + definekeys[1]={ + {lowerleft}{ + execute={ + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerleftindices } + } + }, + }, + {slowerleft}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_bool_get:nnTF { ##1 } { nextlowerleftwithsep } + { + \semantex_data_tl_put_left:nnx { ##1 } { lowerleft } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftsep } } + \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #1 } + } + { + \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerleftindices } + } + }, + }, + {clowerleft}{ + execute={ + \tl_if_blank:nF{#1} + { + \semantex_data_bool_get:nnTF { ##1 } { nextlowerleftwithsep } + { + \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { , #1 } + } + { + \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #1 } + } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerleftindices } + } + } + }, + {prelowerleft}{ + execute={ + \semantex_data_tl_put_left:nnn { ##1 } { prelowerleft } { #1 } + }, + }, + {postlowerleft}{ + execute={ + \semantex_data_tl_put_right:nnn { ##1 } { postlowerleft } { #1 } + }, + }, + {lowerleftputright}{ + execute={ + \tl_if_blank:nF { #1 } + { + \semantex_data_tl_put_right:nnn { ##1 } { lowerleft } { #1 } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerleftindices } + } + }, + }, + {setlowerleftslot}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowerleftslot } { #1 } }, + }, + {lowerleftslotwithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftslot } }, + } + }, + }, + {lowerleft-withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftslot } }, + } + }, + }, + {setlowerleftdots}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowerleftdots } { #1 } }, + }, + {lowerleftdotswithothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftdots } } + } + }, + }, + {lowerleft...withothersep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lowerleftwithothersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lowerleftdots } } + } + }, + }, + {lowerleft*withothersep}{lowerleftwithothersep={#1}{\SemantexBullet}}, + {lowerleft**withothersep}{lowerleftwithothersep={#1}{\SemantexDoubleBullet}}, + {setlowerleftsep}{ + execute={ \semantex_data_tl_set:nnn { ##1 } { lowerleftsep } { #1 } }, + }, + {nextlowerleftwithsep}{ + strifeqTF={#1}{false} + { + boolsetfalse={nextlowerleftwithsep}, + } + { + strifeqTF={#1}{true} + { + boolsettrue={nextlowerleftwithsep}, + } + { + ERRORkeyvaluenotfound={nextlowerleftwithsep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {lowerleftwithothersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextlowerleftwithsep } + { \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #2 #1 } } + { \semantex_data_tl_put_left:nnn { ##1 } { lowerleft } { #2 } } + \semantex_data_bool_set_true:nn { ##1 } { nextlowerleftwithsep } + \semantex_data_int_incr:nn { ##1 } { numberoflowerleftindices } + }, + }, + }, + setlowerleftsep={ , }, + setlowerleftdots={ \dots }, + setlowerleftslot={ {-} }, + % The "d" index: + definekeys={ + {dslot}{ + boolifTF={uppergrading} + { upperslot } + { lowerslot }, + }, + {d-}{dslot}, + {sdslot}{ + boolifTF={uppergrading} + { supperslot } + { slowerslot }, + }, + {sd-}{sdslot}, + {cdslot}{ + boolifTF={uppergrading} + { cupperslot } + { clowerslot }, + }, + {cd-}{cdslot}, + {ddots}{ + boolifTF={uppergrading} + { upperdots } + { lowerdots }, + }, + {d...}{ddots}, + {sddots}{ + boolifTF={uppergrading} + { supperdots } + { slowerdots }, + }, + {sd...}{sddots}, + {cddots}{ + boolifTF={uppergrading} + { cupperdots } + { clowerdots }, + }, + {cd...}{cddots}, + {cleard}{ + boolifTF={uppergrading} + { clearupper } + { clearlower }, + }, + {clearpred}{ + boolifTF={uppergrading} + { clearpreupper } + { clearprelower }, + }, + {clearpostd}{ + boolifTF={uppergrading} + { clearpostupper } + { clearpostlower }, + }, + {d*}{ + boolifTF={uppergrading} + { upper* } + { lower* }, + }, + {d**}{ + boolifTF={uppergrading} + { upper** } + { lower** }, + }, + {sd*}{ + boolifTF={uppergrading} + { supper* } + { slower* }, + }, + {sd**}{ + boolifTF={uppergrading} + { supper** } + { slower** }, + }, + {cd*}{ + boolifTF={uppergrading} + { cupper* } + { clower* }, + }, + {cd**}{ + boolifTF={uppergrading} + { cupper** } + { clower** }, + }, + }, + definekeys[1]={ + {d}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { upper } { #1 } } + { \semantex_valuekey:nnn { ##1 } { lower } { #1 } } + }, + }, + {sd}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { supper } { #1 } } + { \semantex_valuekey:nnn { ##1 } { slower } { #1 } } + }, + }, + {cd}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { cupper } { #1 } } + { \semantex_valuekey:nnn { ##1 } { clower } { #1 } } + }, + }, + {pred}{ + boolifTF={uppergrading} + { + preupper={#1}, + } + { + prelower={#1}, + }, + }, + {postd}{ + boolifTF={uppergrading} + { + postupper={#1}, + } + { + postlower={#1}, + }, + }, + {dputleft}{ + boolifTF={uppergrading} + { + upperputleft={#1}, + } + { + lowerputleft={#1}, + }, + }, + {setdslot}{ + boolifTF={uppergrading} + { + setupperslot={#1}, + } + { + setlowerslot={#1}, + } + }, + {dslotwithothersep}{ + boolifTF={uppergrading} + { + upperslotwithothersep={#1}, + } + { + lowerslotwithothersep={#1}, + }, + }, + {d-withothersep}{ + dslotwithothersep={#1}, + }, + {setddots}{ + boolifTF={uppergrading} + { + setupperdots={#1}, + } + { + setlowerdots={#1}, + } + }, + {ddotswithothersep}{ + boolifTF={uppergrading} + { + upperdotswithothersep={#1}, + } + { + lowerdotswithothersep={#1}, + }, + }, + {d...withothersep}{ + ddotswithothersep={#1}, + }, + {d*withothersep}{ + boolifTF={uppergrading} + { upper*withothersep={#1} } + { lower*withothersep={#1} }, + }, + {d**withothersep}{ + boolifTF={uppergrading} + { upper**withothersep={#1} } + { lower**withothersep={#1} }, + }, + {setdsep}{ + boolifTF={uppergrading} + { + setuppersep={#1}, + } + { + setlowersep={#1}, + }, + }, + {nextdwithsep}{ + strifeqTF={#1}{true} + { + boolifTF={uppergrading} + { + nextupperwithsep=true, + } + { + nextlowerwithsep=true, + }, + } + { + strifeqTF={#1}{false} + { + boolifTF={uppergrading} + { + nextupperwithsep=false, + } + { + nextlowerwithsep=false, + }, + } + { + ERRORkeyvaluenotfound={nextdwithothersep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {dwithothersep}{ + boolifTF={uppergrading} + { + upperwithothersep={#1}{#2}, + } + { + lowerwithothersep={#1}{#2}, + }, + }, + }, + % The "i" index: + definekeys={ + {islot}{ + boolifTF={uppergrading} + { lowerslot } + { upperslot }, + }, + {i-}{islot}, + {sislot}{ + boolifTF={uppergrading} + { slowerslot } + { supperslot }, + }, + {si-}{sislot}, + {cislot}{ + boolifTF={uppergrading} + { clowerslot } + { cupperslot }, + }, + {ci-}{cislot}, + {idots}{ + boolifTF={uppergrading} + { lowerdots } + { upperdots }, + }, + {i...}{idots}, + {sidots}{ + boolifTF={uppergrading} + { slowerdots } + { supperdots }, + }, + {si...}{sidots}, + {cidots}{ + boolifTF={uppergrading} + { clowerdots } + { cupperdots }, + }, + {ci...}{cidots}, + {cleari}{ + boolifTF={uppergrading} + { clearlower } + { clearupper }, + }, + {clearprei}{ + boolifTF={uppergrading} + { clearprelower } + { clearpreupper }, + }, + {clearposti}{ + boolifTF={uppergrading} + { clearpostlower } + { clearpostupper }, + }, + {i*}{ + boolifTF={uppergrading} + { lower* } + { upper* }, + }, + {i**}{ + boolifTF={uppergrading} + { lower** } + { upper** }, + }, + {si*}{ + boolifTF={uppergrading} + { slower* } + { supper* }, + }, + {si**}{ + boolifTF={uppergrading} + { slower** } + { supper** }, + }, + {ci*}{ + boolifTF={uppergrading} + { clower* } + { cupper* }, + }, + {ci**}{ + boolifTF={uppergrading} + { clower** } + { cupper** }, + }, + }, + definekeys[1]={ + {i}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { lower } { #1 } } + { \semantex_valuekey:nnn { ##1 } { upper } { #1 } } + }, + }, + {si}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { slower } { #1 } } + { \semantex_valuekey:nnn { ##1 } { supper } { #1 } } + }, + }, + {ci}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { clower } { #1 } } + { \semantex_valuekey:nnn { ##1 } { cupper } { #1 } } + }, + }, + {prei}{ + boolifTF={uppergrading} + { + prelower={#1}, + } + { + preupper={#1}, + }, + }, + {posti}{ + boolifTF={uppergrading} + { + postlower={#1}, + } + { + postupper={#1}, + }, + }, + {iputleft}{ + boolifTF={uppergrading} + { + lowerputleft={#1}, + }{ + upperputleft={#1}, + }, + }, + {setislot}{ + boolifTF={uppergrading} + { + setlowerslot={#1}, + } + { + setupperslot={#1}, + } + }, + {islotwithothersep}{ + boolifTF={uppergrading} + { + lowerslotwithothersep={#1}, + } + { + upperslotwithothersep={#1}, + }, + }, + {i-withothersep}{ + islotwithothersep={#1}, + }, + {setidots}{ + boolifTF={uppergrading} + { + setlowerdots={#1}, + } + { + setupperdots={#1}, + } + }, + {idotswithothersep}{ + boolifTF={uppergrading} + { + lowerdotswithothersep={#1}, + } + { + upperdotswithothersep={#1}, + }, + }, + {i...withothersep}{ + idotswithothersep={#1}, + }, + {i*withothersep}{ + boolifTF={uppergrading} + { lower*withothersep={#1} } + { upper*withothersep={#1} }, + }, + {i**withothersep}{ + boolifTF={uppergrading} + { lower**withothersep={#1} } + { upper**withothersep={#1} }, + }, + {setisep}{ + boolifTF={uppergrading} + { + setlowersep={#1}, + } + { + setuppersep={#1}, + }, + }, + {nextiwithsep}{ + strifeqTF={#1}{true} + { + boolifTF={uppergrading} + { + nextlowerwithsep={#1}, + } + { + nextupperwithsep={#1}, + }, + } + { + strifeqTF={#1}{false} + { + boolifTF={uppergrading} + { + nextupperwithsep={#1}, + } + { + nextlowerwithsep={#1}, + }, + } + { + ERRORkeyvaluenotfound={nextiwithothersep}{#1}, + }, + }, + }, + }, + definekeys[2]={ + {iwithothersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { uppergrading } + { \semantex_valuekey:nnn { ##1 } { lowerwithothersep } { { #1 } { #2 } } } + { \semantex_valuekey:nnn { ##1 } { upperwithothersep } { { #1 } { #2 } } } + }, + }, + }, + % Argument keyval interface + defineargkeys[1]={ + {execute}{execute={#1}}, + {setkeys}{ execute={ \semantex_keys_set:nn { ##1 } { #1 } } }, + {keysset}{ execute={ \semantex_keys_set:nn { ##1 } { #1 } } }, + {setkeysx}{ execute={ \semantex_keys_set_x:nn { ##1 } { #1 } } }, + {keyssetx}{ execute={ \semantex_keys_set_x:nn { ##1 } { #1 } } }, + {setargkeys}{ execute={ \semantex_arg_keys_set:nn { ##1 } { #1 } } }, + {argkeysset}{ execute={ \semantex_arg_keys_set:nn { ##1 } { #1 } } }, + {setargkeysx}{ execute={ \semantex_arg_keys_set_x:nn { ##1 } { #1 } } }, + {argkeyssetx}{ execute={ \semantex_arg_keys_set_x:nn { ##1 } { #1 } } }, + {setargsinglekeys}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, + {argsinglekeysset}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, + {setargsinglekeysx}{ execute={ \semantex_arg_singlekeys_set_x:nn { ##1 } { #1 } } }, + {argsinglekeyssetx}{ execute={ \semantex_arg_singlekeys_set_x:nn { ##1 } { #1 } } }, + {setoneargsinglekey}{ execute={ \semantex_arg_singlekey:nn { ##1 } { #1 } } }, + {oneargsinglekeyset}{ execute={ \semantex_arg_singlekey:nn { ##1 } { #1 } } }, + {setoneargsinglekeyx}{ execute={ \semantex_arg_singlekey_x:nn { ##1 } { #1 } } }, + {oneargsinglekeysetx}{ execute={ \semantex_arg_singlekey_x:nn { ##1 } { #1 } } }, + {setargwithoutkeyval}{ execute={ \semantex_arg_without_keyval:nn { ##1 } { #1 } } }, + {argwithoutkeyvalset}{ execute={ \semantex_arg_without_keyval:nn { ##1 } { #1 } } }, + {setargwithoutkeyvalx}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, + {argwithoutkeyvalsetx}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, {default}{s={#1}}, {-withothersep}{slotwithothersep={#1}}, {...withothersep}{dotswithothersep={#1}}, + {s}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextargwithsep } + { + \semantex_data_tl_put_right:nnx { ##1 } { arg } + { + \semantex_data_tl_get_exp_not:nn { ##1 } { argsep } + } + } + { + % do nothing + } + \semantex_data_tl_put_right:nnn { ##1 } { arg } { #1 } + \semantex_data_int_incr:nn { ##1 } { numberofarguments } + \semantex_data_bool_set_true:nn { ##1 } { nextargwithsep } + } + }, + {c}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextargwithsep } + { + \semantex_data_tl_put_right:nnn { ##1 } { arg } { , #1 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { arg } { #1 } + } + \semantex_data_int_incr:nn { ##1 } { numberofarguments } + \semantex_data_bool_set_true:nn { ##1 } { nextargwithsep } + } + }, + {dotswithothersep}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { othersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { argdots } } + } + }, + }, + {slotwithothersep}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { othersep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { argslot } } + } + }, + }, }, - argsinglekeys={ - {slot}{slot=}, - {-}{slot=}, - {cslot}{cslot=}, - {c-}{cslot=}, -% {*}{slot=}, % would be confusing since * does not correspond to slot in the indices - {dots}{dots=}, - {...}{dots=}, - {cdots}{cdots=}, - {c...}{cdots=}, + defineargkeys={ + {dots}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { s } + { + \semantex_data_tl_get_exp_not:nn { ##1 } { argdots } + } + }, + }, + {...}{dots}, + {cdots}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { c } + { + \semantex_data_tl_get_exp_not:nn { ##1 } { argdots } + } + }, + }, + {c...}{cdots}, + {slot}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { s } + { + \semantex_data_tl_get_exp_not:nn { ##1 } { argslot } + } + }, + }, + {-}{slot}, + {cslot}{ + execute={ + \semantex_arg_valuekey:nnx { ##1 } { c } + { + \semantex_data_tl_get_exp_not:nn { ##1 } { argslot } + } + }, + }, + {c-}{cslot}, + }, + defineargkeys[2]={ + {othersep}{ + execute={ + \semantex_data_bool_get:nnTF { ##1 } { nextargwithsep } + { + \semantex_data_tl_put_right:nnn { ##1 } { arg } { #1 #2 } + } + { + \semantex_data_tl_put_right:nnn { ##1 } { arg } { #2 } + } + \semantex_data_int_incr:nn { ##1 } { numberofarguments } + \semantex_data_bool_set_true:nn { ##1 } { nextargwithsep } + }, + }, }, ] \cs_set_eq:NN\__semantex_old_version_of_semantex_new_object_of_class_SemantexBaseObject:Nw \__semantex_new_object_of_class_SemantexBaseObject:Nw -\cs_set:Npn \__semantex_new_object_of_class_SemantexBaseObject:Nw#1 +\cs_set_protected:Npn \__semantex_new_object_of_class_SemantexBaseObject:Nw#1 { \msg_error:nnn { semantex } { created_a_SemantexBaseObject } { #1 } \__semantex_old_version_of_semantex_new_object_of_class_SemantexBaseObject:Nw #1 -}
\ No newline at end of file +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% PROCESSING PACKAGE KEYVAL SETUP +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\ProcessKeysOptions { semantex } + +% ... and they lived happily ever after.
\ No newline at end of file |