Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgfmath: reset " catcode inside parser #1070

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions tex/generic/pgf/math/pgfmathparser.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@
\def\pgfmath@dots{...}
\def\pgfmath@char@zero{0}
\def\pgfmath@char@quote{"}
\begingroup
\catcode`\"=13
\gdef\pgfmath@char@quote@active{"}
\endgroup
\def\pgfmath@char@exclamation{!}
\def\pgfmath@char@plus{+}
\def\pgfmath@char@minus{-}
Expand Down Expand Up @@ -338,7 +342,7 @@
% See |\pgfmathdeclareoperator| (below). Note that |+| and |-|
% that are also declared as operators have been tested before so
% they should never be parsed as binary (infix) operator at this stage.
\expandafter\ifx\csname pgfmath@operation@\expandafter\string\pgfmath@token @prefix\endcsname\pgfmath@token
\ifcsname pgfmath@operation@\expandafter\string\pgfmath@token @prefix\endcsname
\let\pgfmath@parse@next=\pgfmath@parse@prefix@operator
\else
\ifpgfmath@quickparse
Expand Down Expand Up @@ -370,22 +374,27 @@
\def\pgfmath@parse@prefix@operator{%
\ifx\pgfmath@token\pgfmath@char@quote% Quote character.
\let\pgfmath@parse@next=\pgfmath@parse@operand@quote%
\else%
\ifx\pgfmath@token\pgfmath@char@exclamation% Prefix !.
\pgfmath@stack@push@operation{not}%
\let\pgfmath@parse@next=\pgfmath@parse@@operand%
\else% Anything else, just push and hope.
\expandafter\pgfmath@stack@push@operation\expandafter{\pgfmath@token}%
\let\pgfmath@parse@next=\pgfmath@parse@@operand%
\fi%
\fi%
\else\ifx\pgfmath@token\pgfmath@char@quote@active% Active quote character.
\let\pgfmath@parse@next=\pgfmath@parse@operand@quote@active%
\else\ifx\pgfmath@token\pgfmath@char@exclamation% Prefix !.
\pgfmath@stack@push@operation{not}%
\let\pgfmath@parse@next=\pgfmath@parse@@operand%
\else% Anything else, just push and hope.
\expandafter\pgfmath@stack@push@operation\expandafter{\pgfmath@token}%
\let\pgfmath@parse@next=\pgfmath@parse@@operand%
\fi\fi\fi%
\pgfmath@parse@next%
}%


% Quote part of an expression.
%
\def\pgfmath@parse@operand@quote#1"{%
\def\pgfmath@parse@operand@quote#1"{\pgfmath@parse@operand@quote@indeed{#1}}
\begingroup
\catcode`\"=13
\gdef\pgfmath@parse@operand@quote@active#1"{\pgfmath@parse@operand@quote@indeed{#1}}
\endgroup
\def\pgfmath@parse@operand@quote@indeed#1{%
\def\pgfmathresult{#1}%
\expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
\pgfmath@parse@@operator%
Expand Down