\RequirePackage{xparse}
\ProvidesExplPackage{semtex}{2020/09/07}{0.1beta}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																%
%		semtex -- for documents stripped of SemanTeX markup		%
%		https://ctan.org/pkg/semantex							%
%		(C) 2020 Sebastian Ørsted								%
%       sorsted@gmail.com										%
%																%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Bullets:

\box_new:N \g__semantex_bullet_box
\hbox_set:Nn \g__semantex_bullet_box { $\cdot$ }
\box_scale:Nnn \g__semantex_bullet_box {1.2} {1.2}
\tl_set:Nn\g_semantex_bullet
{
	\box_move_up:nn{-0.25ex}{\box_use:N \g__semantex_bullet_box}
}

\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


% Parentheses:

\cs_new:Npn\SemantexLeft { \mathopen{}\mathclose\bgroup\left }

\cs_new:Npn\SemantexRight { \aftergroup\egroup\right }

\tl_new:N\SemantexDelimiterSize

\DeclareDocumentCommand\SemantexParentheses { mmmm }
{
	\str_case:nnF { #1 } % This is where \big,\Big, etc. go.
	{
		{ normal } {
			\group_begin:
			\tl_clear:N \SemantexDelimiterSize
			\str_if_eq:nnF { #2 } { . } { \mathopen #2 }
			#4
			\str_if_eq:nnF { #3 } { . } { \mathclose #3 }
			\group_end:
		}
		{ auto } {
			\group_begin:
			\tl_set_eq:NN \SemantexDelimiterSize \middle
			\SemantexLeft #2
			#4
			\SemantexRight #3
			\group_end:
		}
		{ * } {
			\group_begin:
			\tl_set_eq:NN \SemantexDelimiterSize \middle
			\SemantexLeft #2
			#4
			\SemantexRight #3
			\group_end:
		}
	}
	{
		\group_begin:
		\tl_set_eq:NN\SemantexDelimiterSize #1
		\mathopen #1 #2
		#4
		\mathclose #1 #3
		\group_end:
	}
}

\DeclareDocumentCommand\SemantexNoParentheses { m }
{
	\group_begin:
	\tl_clear:N\SemantexDelimiterSize
	#1
	\group_end:
}