Skip to content

Commit

Permalink
fixes #715
Browse files Browse the repository at this point in the history
  • Loading branch information
Skillmon authored and hmenke committed Aug 3, 2019
1 parent ff369f8 commit 5c746e5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
7 changes: 5 additions & 2 deletions doc/generic/pgf/text-en/pgfmanual-en-module-parser.tex
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ \section{Parser Module}%
This macro stores the letter to which |\pgfparsertoken| was let. So if
you'd use |\pgfparserparse{foo}a| this macro would be defined with
|\def\pgfparserletter{a}|. This definition is done before any action code is
executed. There are two special cases: If |{| or |}| would be the next letter
for the parser, this macro is defined to expand to |\bgroup| or |\egroup|.
executed. There are four special cases: If the next token is of category code
1, 2, 6, or 10, so with standard category codes the tokens |{|, |}|, |#|, and
\textvisiblespace\ (a space) would be treated differently. In those cases this
macro expands to |\bgroup|, |\egroup|, |##|, and \textvisiblespace\ for the
categories 1, 2, 6, and 10, respectively.
\end{command}%

\begin{command}{\pgfparserset\marg{key list}}%
Expand Down
36 changes: 26 additions & 10 deletions tex/generic/pgf/modules/pgfmoduleparser.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
\def\pgfparserlet@g
{%
\ifx\pgfparserlet@argb\pgfutil@sptoken
% will also gobble the \pgfparserlet@c after \fi
% will also gobble the \pgfparserlet@h after \fi
\pgfparserlet@gobble@space\pgfparserlet@f
\fi
\pgfparserlet@h
Expand Down Expand Up @@ -496,24 +496,40 @@
{}
{\csname \pgfparser@current\space final action\endcsname}%
}
{%
\futurelet\pgfparsertoken\pgfparser@getnexttoken@a
}%
{\futurelet\pgfparsertoken\pgfparser@getnexttoken@a}%
}
\pgfutil@protected\def\pgfparser@getnexttoken@a
{%
\pgfparser@getnexttoken@iftokengobble\bgroup\bgroup
% check the problematic categories based on the meaning of the token
\edef\pgfparser@tokencategory{\pgfparser@extractmeaning\pgfparsertoken}%
\pgfparser@getnexttoken@ifcategory\pgfparser@category@i\bgroup
{%
\pgfparser@getnexttoken@iftokengobble\egroup\egroup
\pgfparser@getnexttoken@ifcategory\pgfparser@category@ii\egroup
{%
\pgfparser@getnexttoken@iftokengobble\pgfutil@sptoken{ }%
{\pgfparser@getnexttoken@defchar}%
\pgfparser@getnexttoken@ifcategory\pgfparser@category@x{ }%
{%
\pgfparser@getnexttoken@ifcategory\pgfparser@category@vi{####}%
{\pgfparser@getnexttoken@defchar}%
}%
}%
}%
}
\pgfutil@protected\def\pgfparser@getnexttoken@iftokengobble#1#2%
\begingroup
\def\pgfparser@extractmeaning#1%
{%
\ifx\pgfparsertoken#1%
\endgroup
\def\pgfparser@extractmeaning##1%
{\expandafter\pgfparser@extractmeaning@\meaning##1#1#1\pgfparser@mark}%
\def\pgfparser@extractmeaning@##1#1##2#1##3\pgfparser@mark{##1#1##2}%
}
\catcode`\ =12\pgfparser@extractmeaning{ } % ends the group
\edef\pgfparser@category@i{\pgfparser@extractmeaning\bgroup}
\edef\pgfparser@category@ii{\pgfparser@extractmeaning\egroup}
\edef\pgfparser@category@vi{\pgfparser@extractmeaning#}
\edef\pgfparser@category@x{\pgfparser@extractmeaning\pgfutil@sptoken}
\pgfutil@protected\def\pgfparser@getnexttoken@ifcategory#1#2%
{%
\ifx\pgfparser@tokencategory#1%
\def\pgfparserletter{#2}%
\pgfparser@getnexttoken@gobble
\fi
Expand Down

0 comments on commit 5c746e5

Please sign in to comment.