From 37d8bc265b3def2ea0d5bbd84b38fb064cfe1be1 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Fri, 31 Jan 2003 17:28:51 +0000 Subject: [PATCH] Added support for the unary plus operator in expressions. Amazingly, this never seems to be have been added to SWIG before ;-). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4247 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 350e4cdc4..5898e7fe1 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -4213,7 +4213,11 @@ exprcompound : expr PLUS expr { $$.val = NewStringf("-%s",$2.val); $$.type = $2.type; } - | NOT expr { + | PLUS expr %prec UMINUS { + $$.val = NewStringf("%s",$2.val); + $$.type = $2.type; + } + | NOT expr { $$.val = NewStringf("~%s",$2.val); $$.type = $2.type; }