Skip to content

Commit

Permalink
Reinsert the last token when giving up on a path pgf-tikz#1025
Browse files Browse the repository at this point in the history
Cherry-pick hmenke@8a6c14c
  • Loading branch information
muzimuzhi committed Jun 17, 2021
1 parent feee4c6 commit 72d7517
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2437,6 +2437,16 @@
\endgroup%
\global\pgflinewidth=\tikzscope@linewidth%
\tikz@path@do@at@end%
%
% Optional step: Reinsert last token
%
% If there was an error, then \tikz@finish was called to give up on the
% path. Since we do not know whether the error was caused by a misspelled
% keyword or due to expansion, we reinsert the previously collected token here.
%
\expandafter\let\expandafter\tikz@expand@last@token@\csname tikz@expand@last@token\endcsname
\global\let\tikz@expand@last@token=\relax
\tikz@expand@last@token@
}%
\let\tikz@lib@scope@check\pgfutil@empty% this is a hook for the scopes library
\def\tikz@path@do@at@end{\tikz@lib@scope@check}%
Expand Down Expand Up @@ -2487,6 +2497,8 @@
\advance\tikz@expandcount by -1
\ifnum\tikz@expandcount<0\relax%
\tikzerror{Giving up on this path. Did you forget a semicolon?}%
% since the last token caused an error we should reinsert it and therefore save it
\global\let\tikz@expand@last@token=\pgf@let@token
\let\pgfutil@next=\tikz@finish%
\else%
\let\pgfutil@next=\tikz@@expand
Expand Down

0 comments on commit 72d7517

Please sign in to comment.