From a4fc295416c7bd62136ff5e67c604c4550cd1db1 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Wed, 12 Jan 2000 18:22:34 +0000 Subject: [PATCH] Corrected the version git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@67 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Preprocessor/expr.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/SWIG/Source/Preprocessor/expr.c b/SWIG/Source/Preprocessor/expr.c index 2fb8d4a98..65c586d9f 100644 --- a/SWIG/Source/Preprocessor/expr.c +++ b/SWIG/Source/Preprocessor/expr.c @@ -13,9 +13,7 @@ * can be used and distributed. ****************************************************************************/ -static char cvsroot[] = "$Header$"; - -#include "swigcpp.h" +#include "swigcore.h" /* ----------------------------------------------------------------------------- * expr.c @@ -218,6 +216,22 @@ int SWIG_expr(DOH *s, int *error) { *error = 1; return 0; } + if ((token == TOKEN_INT) || (token == TOKEN_UINT) || (token == TOKEN_LONG) || (token == TOKEN_ULONG)) { + /* A number. Reduce EXPR_TOP to an EXPR_VALUE */ + stack[sp].value = (long) atol(Char(Scanner_text(scan))); + stack[sp].op = EXPR_VALUE; + } else if (token == TOKEN_PLUS) { } + else if ((token == TOKEN_MINUS) || (token == TOKEN_LNOT) || (token==TOKEN_NOT)) { + if (token == TOKEN_MINUS) token = EXPR_UMINUS; + stack[sp].value = token; + stack[sp++].op = EXPR_OP; + stack[sp].op = EXPR_TOP; + } else if ((token == TOKEN_LPAREN)) { + stack[sp++].op = EXPR_GROUP; + stack[sp].op = EXPR_TOP; + stack[sp].value = 0; + } else if (token == TOKEN_ENDLINE) { } + else goto syntax_error; break; case EXPR_VALUE: /* A value is on the stack. We may reduce or evaluate depending on what the next token is */