Commit 54452833 authored by Michael Meskes's avatar Michael Meskes

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

parent 731204e0
...@@ -1184,5 +1184,9 @@ Sun Dec 23 13:08:36 CET 2001 ...@@ -1184,5 +1184,9 @@ Sun Dec 23 13:08:36 CET 2001
- Fixed several bugs concerning arrays of structs including a memory - Fixed several bugs concerning arrays of structs including a memory
allocation bug. 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 ecpg version to 2.9.0.
- Set library version to 3.3.0. - Set library version to 3.3.0.
...@@ -5389,6 +5389,14 @@ c_stuff: c_anything { $$ = $1; } ...@@ -5389,6 +5389,14 @@ c_stuff: c_anything { $$ = $1; }
{ {
$$ = cat_str(3, $1, make_str("("), make_str(")")); $$ = 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; } c_list: c_term { $$ = $1; }
......
#include <string.h> #include <string.h>
exec sql include sqlca; 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(); exec sql whenever sqlwarning do warn();
static void PrintAndStop(char *msg) static void PrintAndStop(char *msg)
......
...@@ -12,7 +12,8 @@ void sqlmeldung(char *meldung, short trans) ...@@ -12,7 +12,8 @@ void sqlmeldung(char *meldung, short trans)
{ {
} }
#define NO 0 exec sql define NONO 0;
#define YES 1 #define YES 1
#ifdef _cplusplus #ifdef _cplusplus
...@@ -24,8 +25,9 @@ namespace N ...@@ -24,8 +25,9 @@ namespace N
int main() int main()
{ struct sa x,*y; { struct sa x,*y;
exec sql begin declare section; exec sql begin declare section;
int a=2; int a=(int)2;
int b=2+2; int b=2+2;
int b2=(14*7);
int d=x.member; int d=x.member;
int g=fb(2); int g=fb(2);
int i=3^1; int i=3^1;
...@@ -38,7 +40,6 @@ long iay /* = 1L */ ; ...@@ -38,7 +40,6 @@ long iay /* = 1L */ ;
long long iax /* = 40000000000LL */ ; long long iax /* = 40000000000LL */ ;
exec sql end declare section; exec sql end declare section;
/* not working */
int f=fa(); int f=fa();
#ifdef _cplusplus #ifdef _cplusplus
...@@ -57,7 +58,7 @@ exec sql whenever sqlerror do fd("50",1); ...@@ -57,7 +58,7 @@ exec sql whenever sqlerror do fd("50",1);
exec sql select now(); exec sql select now();
exec sql whenever sqlerror do fe(ENUM0); exec sql whenever sqlerror do fe(ENUM0);
exec sql select now(); 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(); exec sql select now();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment