Skip to content

Commit 5445283

Browse files
author
Michael Meskes
committed
Fixed parser to accept initializing expressions starting with "(".
1 parent 731204e commit 5445283

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,5 +1184,9 @@ Sun Dec 23 13:08:36 CET 2001
11841184

11851185
- Fixed several bugs concerning arrays of structs including a memory
11861186
allocation bug.
1187+
1188+
Mon Jan 7 12:18:01 CET 2002
1189+
1190+
- Fixed parser to accept initializing expressions starting with "(".
11871191
- Set ecpg version to 2.9.0.
11881192
- Set library version to 3.3.0.

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5389,6 +5389,14 @@ c_stuff: c_anything { $$ = $1; }
53895389
{
53905390
$$ = cat_str(3, $1, make_str("("), make_str(")"));
53915391
}
5392+
| '(' c_stuff ')'
5393+
{
5394+
$$ = cat_str(3, make_str("("), $2, make_str(")"));
5395+
}
5396+
| '(' c_stuff ')' c_stuff
5397+
{
5398+
$$ = cat_str(4, make_str("("), $2, make_str(")"), $4);
5399+
}
53925400
;
53935401

53945402
c_list: c_term { $$ = $1; }

src/interfaces/ecpg/test/test1.pgc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
#include <string.h>
32

43
exec sql include sqlca;
54

6-
exec sql whenever sqlerror do PrintAndStop(msg);
5+
/* just a test comment */ exec sql whenever sqlerror do PrintAndStop(msg);
76
exec sql whenever sqlwarning do warn();
87

98
static void PrintAndStop(char *msg)

src/interfaces/ecpg/test/test_init.pgc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ void sqlmeldung(char *meldung, short trans)
1212
{
1313
}
1414

15-
#define NO 0
15+
exec sql define NONO 0;
16+
1617
#define YES 1
1718

1819
#ifdef _cplusplus
@@ -24,8 +25,9 @@ namespace N
2425
int main()
2526
{ struct sa x,*y;
2627
exec sql begin declare section;
27-
int a=2;
28+
int a=(int)2;
2829
int b=2+2;
30+
int b2=(14*7);
2931
int d=x.member;
3032
int g=fb(2);
3133
int i=3^1;
@@ -38,7 +40,6 @@ long iay /* = 1L */ ;
3840
long long iax /* = 40000000000LL */ ;
3941
exec sql end declare section;
4042

41-
/* not working */
4243
int f=fa();
4344

4445
#ifdef _cplusplus
@@ -57,7 +58,7 @@ exec sql whenever sqlerror do fd("50",1);
5758
exec sql select now();
5859
exec sql whenever sqlerror do fe(ENUM0);
5960
exec sql select now();
60-
/* ex ec sql whenever sqlerror do sqlmeldung(NULL,NO); */
61+
exec sql whenever sqlerror do sqlmeldung(NULL, NONO);
6162
exec sql select now();
6263
return 0;
6364
}

0 commit comments

Comments
 (0)