From 8b5cabd324bccc42c0b495d7ee33d7ba395477c4 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Sun, 21 Jul 2002 08:26:52 +0000 Subject: [PATCH] Re-committing the whole big_bison tag. --- src/interfaces/ecpg/lib/execute.c | 7 ++--- src/interfaces/ecpg/preproc/keywords.c | 11 ++++++- src/interfaces/ecpg/preproc/pgc.l | 42 +++++++++++++++++--------- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c index 4723d09a8bb..945d4e0b972 100644 --- a/src/interfaces/ecpg/lib/execute.c +++ b/src/interfaces/ecpg/lib/execute.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.37 2002/06/12 12:06:53 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.37.2.1 2002/07/21 08:26:52 meskes Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -56,7 +56,7 @@ struct sqlca sqlca = }; /* This function returns a newly malloced string that has the \ - in the argument quoted with \ and the ' quote with ' as SQL92 says. + in the argument quoted with \ and the ' quoted with ' as SQL92 says. */ static char * @@ -84,13 +84,12 @@ quote_postgres(char *arg, int lineno) default: ; } - res[ri] = arg[i]; } res[ri++] = '\''; res[ri] = '\0'; - + return res; } diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index db27bbbbf23..ac5320d4d13 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.50.2.1 2002/07/01 07:10:10 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.50.2.2 2002/07/21 08:26:52 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -44,6 +44,8 @@ static ScanKeyword ScanKeywords[] = { {"as", AS}, {"asc", ASC}, {"assertion", ASSERTION}, + {"assignment", ASSIGNMENT}, + {"asymmetric", ASYMMETRIC}, {"at", AT}, {"authorization", AUTHORIZATION}, {"backward", BACKWARD}, @@ -77,6 +79,7 @@ static ScanKeyword ScanKeywords[] = { {"committed", COMMITTED}, {"constraint", CONSTRAINT}, {"constraints", CONSTRAINTS}, + {"conversion", CONVERSION_P}, {"copy", COPY}, {"create", CREATE}, {"createdb", CREATEDB}, @@ -98,6 +101,7 @@ static ScanKeyword ScanKeywords[] = { {"deferred", DEFERRED}, {"definer", DEFINER}, {"delete", DELETE_P}, + {"delimiter", DELIMITER}, {"delimiters", DELIMITERS}, {"desc", DESC}, {"distinct", DISTINCT}, @@ -251,6 +255,8 @@ static ScanKeyword ScanKeywords[] = { {"setof", SETOF}, {"share", SHARE}, {"show", SHOW}, + {"similar", SIMILAR}, + {"simple", SIMPLE}, {"smallint", SMALLINT}, {"some", SOME}, {"stable", STABLE}, @@ -262,6 +268,7 @@ static ScanKeyword ScanKeywords[] = { {"storage", STORAGE}, {"strict", STRICT}, {"substring", SUBSTRING}, + {"symmetric", SYMMETRIC}, {"sysid", SYSID}, {"table", TABLE}, {"temp", TEMP}, @@ -274,6 +281,7 @@ static ScanKeyword ScanKeywords[] = { {"toast", TOAST}, {"trailing", TRAILING}, {"transaction", TRANSACTION}, + {"treat", TREAT}, {"trigger", TRIGGER}, {"trim", TRIM}, {"true", TRUE_P}, @@ -304,6 +312,7 @@ static ScanKeyword ScanKeywords[] = { {"with", WITH}, {"without", WITHOUT}, {"work", WORK}, + {"write", WRITE}, {"year", YEAR_P}, {"zone", ZONE}, }; diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 9813b737925..bbd5d31459c 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.94.2.2 2002/07/01 15:01:37 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.94.2.3 2002/07/21 08:26:52 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -89,14 +89,14 @@ static struct _if_value * We use exclusive states for quoted strings, extended comments, * and to eliminate parsing troubles for numeric strings. * Exclusive states: - * bit string literal + * bit string literal * extended C-style comments - thomas 1997-07-12 * delimited identifiers (double-quoted identifiers) - thomas 1997-10-27 * hexadecimal numeric string - thomas 1997-11-16 * quoted strings - thomas 1997-07-30 */ -%x xbit +%x xb %x xc %x xd %x xdc @@ -108,10 +108,10 @@ static struct _if_value /* Bit string */ -xbitstart [bB]{quote} -xbitstop {quote} -xbitinside [^']* -xbitcat {quote}{whitespace_with_newline}{quote} +xbstart [bB]{quote} +xbstop {quote} +xbinside [^']* +xbcat {quote}{whitespace_with_newline}{quote} /* Hexadecimal number */ @@ -120,6 +120,10 @@ xhstop {quote} xhinside [^']+ xhcat {quote}{whitespace_with_newline}{quote} +/* National character + */ +xnstart [nN]{quote} + /* C version of hex number */ xch 0[xX][0-9A-Fa-f]* @@ -318,13 +322,13 @@ cppline {space}*#(.*\\{space})*.* <> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated /* comment"); } -{xbitstart} { +{xbstart} { token_start = yytext; - BEGIN(xbit); + BEGIN(xb); startlit(); addlitchar('b'); } -{xbitstop} { +{xbstop} { BEGIN(SQL); if (literalbuf[strspn(literalbuf, "01") + 1] != '\0') mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input."); @@ -333,10 +337,10 @@ cppline {space}*#(.*\\{space})*.* } {xhinside} | -{xbitinside} { addlit(yytext, yyleng); } +{xbinside} { addlit(yytext, yyleng); } {xhcat} | -{xbitcat} { /* ignore */ } -<> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); } +{xbcat} { /* ignore */ } +<> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); } {xhstart} { token_start = yytext; @@ -362,7 +366,15 @@ cppline {space}*#(.*\\{space})*.* } <> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated hexadecimal integer"); } - +{xnstart} { + /* National character. + * Need to remember type info to flow it forward into the parser. + * Not yet implemented. - thomas 2002-06-17 + */ + token_start = yytext; + BEGIN(xq); + startlit(); + } {xqstart} { token_start = yytext; state_before = YYSTATE; @@ -579,7 +591,7 @@ cppline {space}*#(.*\\{space})*.* */ if (ptr == NULL) { - yylval.str = mm_strdup( yytext); + yylval.str = mm_strdup(yytext); return IDENT; } } -- 2.39.5