This question is related to TikZ: pgfutil-common: pgfutil@in@ - how does it work? and is a result of coping with that problem. I've already read How to change #catcode in a macro, but it didn't help me.
So, here is minimalistic example of what I have. Play with \makeatletter ... \makeatother inside document environment.
\documentclass{article}
\usepackage{tikz}
% Consider start of library here (this part is located in a separate file included by means of `\usetikzlibrary`).
\makeatletter
\def \myparse #1{%
\def \myparse@ ##1 @ ##2\pgf@stop{%
\def \beforeat{##1}%
\def \afterat{##2}%
}
%
\def \tikz@temp{#1}%
%
\def \beforeat{false before}%
\def \afterat{false after}
\edef \pgf@marshal{\noexpand \pgfutil@in@{@}{\tikz@temp}}%
\pgf@marshal \ifpgfutil@in@%
\expandafter \myparse@ \tikz@temp\pgf@stop%
\fi%
}
\makeatother
% Consider end of library here.
% User's file starts here.
\begin{document}
\makeatletter % Play with commenting out this line.
\myparse{true before @ true after}
\makeatother % and this one.
\beforeat\par
\afterat\par
\end{document}
I'd like to eliminate the need in \makeatletter ... \makeatother in user's file, while remaining usage of @ symbol.
