Skip to content

Commit adeedf9

Browse files
author
Michael Meskes
committed
Fixed some bugs in C language parsing.
1 parent 0db3cb2 commit adeedf9

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,10 @@ Mon Oct 16 21:33:17 CEST 2000
972972

973973
Tue Oct 17 08:09:16 CEST 2000
974974

975-
- Simplified parsing ofr connect rule.
975+
- Simplified parsing of connect rule.
976+
977+
Tue Oct 17 17:36:30 CEST 2000
978+
979+
- Fixed some bugs in C language parsing.
976980
- Set ecpg version to 2.8.0.
977981
- Set library version to 3.2.0.

src/interfaces/ecpg/TODO

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ instead of libpq so we can write backend functions using ecpg.
2020

2121
remove space_or_nl and line_end from pgc.l
2222

23+
nested C comments do not work
24+
2325
Missing features:
2426
- SQLSTATE

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.64 2000/09/26 11:41:44 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.65 2000/10/17 15:38:25 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -676,6 +676,11 @@ cppline {space}*#(.*\\{line_end})*.*
676676
<C>\[ { return('['); }
677677
<C>\] { return(']'); }
678678
<C>\= { return('='); }
679+
<C>"->" { return(S_MEMBER); }
680+
<C>">>" { return(S_RSHIFT); }
681+
<C>"<<" { return(S_LSHIFT); }
682+
<C>"||" { return(S_OR); }
683+
<C>"&&" { return(S_AND); }
679684
<C>{other} { return S_ANYTHING; }
680685

681686
<C>{exec_sql}{define}{space_or_nl}* { BEGIN(def_ident); }

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ make_name(void)
174174
%token SQL_VALUE SQL_VAR SQL_WHENEVER
175175

176176
/* C token */
177-
%token S_ANYTHING S_AUTO S_CONST S_EXTERN
178-
%token S_REGISTER S_STATIC S_VOLATILE
177+
%token S_AND S_ANYTHING S_AUTO S_CONST S_EXTERN S_LSHIFT
178+
%token S_MEMBER S_OR S_REGISTER S_RSHIFT S_STATIC S_VOLATILE
179179

180180
/* I need this and don't know where it is defined inside the backend */
181181
%token TYPECAST
@@ -5298,11 +5298,16 @@ c_anything: IDENT { $$ = $1; }
52985298
| '-' { $$ = make_str("-"); }
52995299
| '/' { $$ = make_str("/"); }
53005300
| '%' { $$ = make_str("%"); }
5301+
| S_AND { $$ = make_str("&&"); }
53015302
| S_ANYTHING { $$ = make_name(); }
53025303
| S_AUTO { $$ = make_str("auto"); }
53035304
| S_CONST { $$ = make_str("const"); }
53045305
| S_EXTERN { $$ = make_str("extern"); }
5306+
| S_LSHIFT { $$ = make_str("<<"); }
5307+
| S_MEMBER { $$ = make_str("->"); }
5308+
| S_OR { $$ = make_str("||"); }
53055309
| S_REGISTER { $$ = make_str("register"); }
5310+
| S_RSHIFT { $$ = make_str(">>"); }
53065311
| S_STATIC { $$ = make_str("static"); }
53075312
| SQL_BOOL { $$ = make_str("bool"); }
53085313
| SQL_ENUM { $$ = make_str("enum"); }

src/interfaces/ecpg/test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100
1+
all: test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init
22

33
#LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq
44
LDFLAGS=-g -I ../include -I /usr/include/postgresql -L /usr/lib -lecpg -lpq

src/interfaces/ecpg/test/test_init.pgc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ int g=fb(2);
3131
int i=3^1;
3232
int j=1?1:2;
3333

34-
/*int e=y->member; /* compile error */
35-
/*int c=10>>2; /* compile error */
36-
/*bool h=2||1; /* compile error */
37-
long long iax;
34+
int e=y->member;
35+
int c=10>>2;
36+
bool h=2||1;
37+
long iay /* = 1L */ ;
38+
long long iax /* = 40000000000LL */ ;
3839
exec sql end declare section;
3940

40-
iax = 40000000000LL;
41-
4241
/* not working */
4342
int f=fa();
4443

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy