% verbatim-alt testphase Module
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Highly experimental module for tagging characters in verbatim
% LaTeX Project March 2025
% Licence https://www.latex-project.org/lppl.txt
\ProvidesFile{verbatim-alt-latex-lab-testphase.ltx}
        [2025-03-26 v 0.1 Highly experimental module for tagging characters in verbatim]
\makeatletter
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=13 \catcode `\}=13
\catcode`\\=12
|gdef|@xxverbatim#1\end{verbatim}[#1|end[verbatim]]
|gdef|@sxverbatim#1\end{verbatim*}[#1|end[verbatim*]]
|endgroup
\def\@xverbatim{\activechars\everypar{\tagobeyedline}\@xxverbatim}
\makeatother

\def\defactive#1#2\relax{%
  \def#1{\tagmcend\tagstructbegin{tag=Span,alt={ #2 }}\tagmcbegin{}\detokenize{#1}\tagmcend\tagstructend\tagmcbegin{}}%
  }
\protected\gdef\tagobeyedline{\tagmcend\tagstructbegin{tag=Span,alt={ new line }}\tagmcbegin{}\tagmcend\tagstructend\tagmcbegin{}}
  
\begingroup
\catcode`\B=1
\catcode`\E=2
\catcode`\(\active
\catcode`\)\active
\catcode`\{\active
\catcode`\}\active
\catcode`\;\active
\catcode`\,\active
\catcode`\"\active

\gdef\activecharsB%
\catcode`\(\active
\catcode`\)\active
\catcode`\{\active
\catcode`\}\active
\catcode`\;\active
\catcode`\,\active
\catcode`\"\active
 \defactive(open paren\relax
 \defactive)close paren\relax
 \defactive{open brace\relax
 \defactive}close brace\relax
 \defactive;semicolon\relax
 \defactive,comma\relax
 \defactive"quote\relax
 E
\endgroup
