[MSI] sql.y allow for negative numbers

Aric Stewart aric at codeweavers.com
Wed Dec 15 10:01:48 CST 2004


Let negative number be parsed correctly. needed for accessing actions 
with sequences such as -1 or such.
-------------- next part --------------
Index: dlls/msi/sql.y
===================================================================
RCS file: /home/wine/wine/dlls/msi/sql.y,v
retrieving revision 1.18
diff -u -r1.18 sql.y
--- dlls/msi/sql.y	13 Dec 2004 21:19:02 -0000	1.18
+++ dlls/msi/sql.y	15 Dec 2004 16:51:57 -0000
@@ -62,9 +62,9 @@
 
 static struct expr * EXPR_complex( struct expr *l, UINT op, struct expr *r );
 static struct expr * EXPR_column( LPWSTR );
-static struct expr * EXPR_ival( struct sql_str *);
+static struct expr * EXPR_ival( struct sql_str *, int sign);
 static struct expr * EXPR_sval( struct sql_str *);
-static struct expr * EXPR_wildcard(void);
+static struct expr * EXPR_wildcard();
 
 %}
 
@@ -543,7 +543,11 @@
 const_val:
     TK_INTEGER
         {
-            $$ = EXPR_ival( &$1 );
+            $$ = EXPR_ival( &$1, 1 );
+        }
+  | TK_MINUS  TK_INTEGER
+        {
+            $$ = EXPR_ival( &$2, -1 );
         }
   | TK_STRING
         {
@@ -717,13 +721,13 @@
     return e;
 }
 
-static struct expr * EXPR_ival( struct sql_str *str )
+static struct expr * EXPR_ival( struct sql_str *str , int sign)
 {
     struct expr *e = HeapAlloc( GetProcessHeap(), 0, sizeof *e );
     if( e )
     {
         e->type = EXPR_IVAL;
-        e->u.ival = atoiW( str->data );
+        e->u.ival = atoiW( str->data ) * sign;
     }
     return e;
 }


More information about the wine-patches mailing list