Fixed parser to accept initializing expressions starting with "(".

This commit is contained in:
Michael Meskes 2002-01-07 16:25:45 +00:00
parent 731204e090
commit 54452833ef
4 changed files with 18 additions and 6 deletions

View File

@ -1184,5 +1184,9 @@ Sun Dec 23 13:08:36 CET 2001
- Fixed several bugs concerning arrays of structs including a memory
allocation bug.
Mon Jan 7 12:18:01 CET 2002
- Fixed parser to accept initializing expressions starting with "(".
- Set ecpg version to 2.9.0.
- Set library version to 3.3.0.

View File

@ -5389,6 +5389,14 @@ c_stuff: c_anything { $$ = $1; }
{
$$ = cat_str(3, $1, make_str("("), make_str(")"));
}
| '(' c_stuff ')'
{
$$ = cat_str(3, make_str("("), $2, make_str(")"));
}
| '(' c_stuff ')' c_stuff
{
$$ = cat_str(4, make_str("("), $2, make_str(")"), $4);
}
;
c_list: c_term { $$ = $1; }

View File

@ -1,9 +1,8 @@
#include <string.h>
exec sql include sqlca;
exec sql whenever sqlerror do PrintAndStop(msg);
/* just a test comment */ exec sql whenever sqlerror do PrintAndStop(msg);
exec sql whenever sqlwarning do warn();
static void PrintAndStop(char *msg)

View File

@ -12,7 +12,8 @@ void sqlmeldung(char *meldung, short trans)
{
}
#define NO 0
exec sql define NONO 0;
#define YES 1
#ifdef _cplusplus
@ -24,8 +25,9 @@ namespace N
int main()
{ struct sa x,*y;
exec sql begin declare section;
int a=2;
int a=(int)2;
int b=2+2;
int b2=(14*7);
int d=x.member;
int g=fb(2);
int i=3^1;
@ -38,7 +40,6 @@ long iay /* = 1L */ ;
long long iax /* = 40000000000LL */ ;
exec sql end declare section;
/* not working */
int f=fa();
#ifdef _cplusplus
@ -57,7 +58,7 @@ exec sql whenever sqlerror do fd("50",1);
exec sql select now();
exec sql whenever sqlerror do fe(ENUM0);
exec sql select now();
/* ex ec sql whenever sqlerror do sqlmeldung(NULL,NO); */
exec sql whenever sqlerror do sqlmeldung(NULL, NONO);
exec sql select now();
return 0;
}