Fixed some bugs in C language parsing.

This commit is contained in:
Michael Meskes 2000-10-17 15:38:26 +00:00
parent 0db3cb253d
commit adeedf9047
6 changed files with 26 additions and 11 deletions

View File

@ -972,6 +972,10 @@ Mon Oct 16 21:33:17 CEST 2000
Tue Oct 17 08:09:16 CEST 2000 Tue Oct 17 08:09:16 CEST 2000
- Simplified parsing ofr connect rule. - Simplified parsing of connect rule.
Tue Oct 17 17:36:30 CEST 2000
- Fixed some bugs in C language parsing.
- Set ecpg version to 2.8.0. - Set ecpg version to 2.8.0.
- Set library version to 3.2.0. - Set library version to 3.2.0.

View File

@ -20,5 +20,7 @@ instead of libpq so we can write backend functions using ecpg.
remove space_or_nl and line_end from pgc.l remove space_or_nl and line_end from pgc.l
nested C comments do not work
Missing features: Missing features:
- SQLSTATE - SQLSTATE

View File

@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.64 2000/09/26 11:41:44 meskes Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.65 2000/10/17 15:38:25 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -676,6 +676,11 @@ cppline {space}*#(.*\\{line_end})*.*
<C>\[ { return('['); } <C>\[ { return('['); }
<C>\] { return(']'); } <C>\] { return(']'); }
<C>\= { return('='); } <C>\= { return('='); }
<C>"->" { return(S_MEMBER); }
<C>">>" { return(S_RSHIFT); }
<C>"<<" { return(S_LSHIFT); }
<C>"||" { return(S_OR); }
<C>"&&" { return(S_AND); }
<C>{other} { return S_ANYTHING; } <C>{other} { return S_ANYTHING; }
<C>{exec_sql}{define}{space_or_nl}* { BEGIN(def_ident); } <C>{exec_sql}{define}{space_or_nl}* { BEGIN(def_ident); }

View File

@ -174,8 +174,8 @@ make_name(void)
%token SQL_VALUE SQL_VAR SQL_WHENEVER %token SQL_VALUE SQL_VAR SQL_WHENEVER
/* C token */ /* C token */
%token S_ANYTHING S_AUTO S_CONST S_EXTERN %token S_AND S_ANYTHING S_AUTO S_CONST S_EXTERN S_LSHIFT
%token S_REGISTER S_STATIC S_VOLATILE %token S_MEMBER S_OR S_REGISTER S_RSHIFT S_STATIC S_VOLATILE
/* I need this and don't know where it is defined inside the backend */ /* I need this and don't know where it is defined inside the backend */
%token TYPECAST %token TYPECAST
@ -5298,11 +5298,16 @@ c_anything: IDENT { $$ = $1; }
| '-' { $$ = make_str("-"); } | '-' { $$ = make_str("-"); }
| '/' { $$ = make_str("/"); } | '/' { $$ = make_str("/"); }
| '%' { $$ = make_str("%"); } | '%' { $$ = make_str("%"); }
| S_AND { $$ = make_str("&&"); }
| S_ANYTHING { $$ = make_name(); } | S_ANYTHING { $$ = make_name(); }
| S_AUTO { $$ = make_str("auto"); } | S_AUTO { $$ = make_str("auto"); }
| S_CONST { $$ = make_str("const"); } | S_CONST { $$ = make_str("const"); }
| S_EXTERN { $$ = make_str("extern"); } | S_EXTERN { $$ = make_str("extern"); }
| S_LSHIFT { $$ = make_str("<<"); }
| S_MEMBER { $$ = make_str("->"); }
| S_OR { $$ = make_str("||"); }
| S_REGISTER { $$ = make_str("register"); } | S_REGISTER { $$ = make_str("register"); }
| S_RSHIFT { $$ = make_str(">>"); }
| S_STATIC { $$ = make_str("static"); } | S_STATIC { $$ = make_str("static"); }
| SQL_BOOL { $$ = make_str("bool"); } | SQL_BOOL { $$ = make_str("bool"); }
| SQL_ENUM { $$ = make_str("enum"); } | SQL_ENUM { $$ = make_str("enum"); }

View File

@ -1,4 +1,4 @@
all: test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 all: test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init
#LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq #LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq
LDFLAGS=-g -I ../include -I /usr/include/postgresql -L /usr/lib -lecpg -lpq LDFLAGS=-g -I ../include -I /usr/include/postgresql -L /usr/lib -lecpg -lpq

View File

@ -31,14 +31,13 @@ int g=fb(2);
int i=3^1; int i=3^1;
int j=1?1:2; int j=1?1:2;
/*int e=y->member; /* compile error */ int e=y->member;
/*int c=10>>2; /* compile error */ int c=10>>2;
/*bool h=2||1; /* compile error */ bool h=2||1;
long long iax; long iay /* = 1L */ ;
long long iax /* = 40000000000LL */ ;
exec sql end declare section; exec sql end declare section;
iax = 40000000000LL;
/* not working */ /* not working */
int f=fa(); int f=fa();