@@ -558,6 +558,7 @@ sub pgfmath_checkuserfunction {
558558
559559BEGIN {
560560 $PGFMathFunctions = {
561+ ' !pref' => sub { int (!$_ [0]); },
561562 not => sub { int (!$_ [0]) },
562563 ' ==' => sub { int ($_ [0] == $_ [1]) },
563564 equal => sub { int ($_ [0] == $_ [1]) },
@@ -589,7 +590,7 @@ BEGIN {
589590 ' /' => sub { $_ [0] / pgfmath_divisor($_ [1]); },
590591 divide => sub { $_ [0] / pgfmath_divisor($_ [1]); },
591592 div => sub { int ($_ [0] / pgfmath_divisor($_ [1])); },
592- ' !' => sub { pgfmathfactorial($_ [0]); },
593+ ' !post ' => sub { pgfmathfactorial($_ [0]); },
593594 ' r' => sub { rad2deg($_ [0]); },
594595 e => sub { $E ; },
595596 pi => sub { $PI ; },
@@ -769,8 +770,13 @@ SIZER : /(?:depth|height|width)/
769770QTEX : '"' /[^"]*/ '"' { $item[2]; }
770771CMP : /==|>=?|<=?|!=/
771772BOOLOP : /&&|\|\|/
772- PREFIX : /-|!|\+/
773- POSTFIX : /!|r/
773+
774+ # the meaning of ! depends on its position
775+ # pgfmathparser has a hardcoded notion of 'double character' operator
776+ # '!' could be part of '!=', so we forbid that sequence
777+ PREFIX : /-|\+/ | '!' ...!'=' { '!pref'; }
778+ POSTFIX : 'r' | '!' ...!'=' { '!post'; }
779+
774780ADDOP : /\+|=|-/
775781MULOP : /\*|\//
776782
0 commit comments